-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
What specific problem does this solve?
Feature Request: External MCP Server Integration for "Enhance Prompt"
π Summary
This feature request proposes adding support in RooCode to route the "Enhance Prompt" functionality through an external MCP (Model Context Protocol) server. The purpose is to allow advanced users to replace RooCode's default LLM-based enhancement with a custom enhancement pipeline, such as one powered by DSPy (see https://dspy.ai/api/) memory injection, or other structured prompt augmentation systems.
This enhancement should be user-configurable through the RooCode settings interface and easily extendable in future updates.
βοΈ Motivation
Currently, the "Enhance Prompt" button in RooCode rewrites user prompts using a static system prompt and routes the input through the default model provider. While this improves clarity and completeness, it lacks modularity, memory access, and extensibility.
Many developers and researchers want:
- Programmatic control over prompt enhancement
- Integration of memory/context into prompt transformations
- Feedback-driven rewriting (e.g., CoT, ReAct, few-shot injection)
- Support for DSPy and other LLM orchestration systems
βοΈ Proposed Feature
1. New Settings (in settings.json or internal config store):
"enhancePrompt.useExternalServer": true,
"enhancePrompt.endpoint": "http://localhost:8000/enhance"2. Expected Request Payload (POST to external MCP endpoint):
{
"prompt": "raw user prompt",
"context": [
{ "role": "user", "content": "..." },
{ "role": "assistant", "content": "..." }
],
"model": "gpt-4"
}3. Expected Response:
{
"enhancedPrompt": "rewritten or optimized prompt"
}ποΈ Code Changes
File: src/core/webview/messageEnhancer.ts
Add import:
import fetch from "node-fetch"; // or use global fetch in ElectronModify inside enhanceMessage():
if (settings.enhancePrompt?.useExternalServer) {
try {
const response = await fetch(settings.enhancePrompt.endpoint, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
prompt: userPrompt,
context: contextMessages,
model: this.llm?.modelID ?? "unknown"
})
});
const result = await response.json();
return result.enhancedPrompt ?? userPrompt;
} catch (err) {
console.error("Failed to enhance prompt via external server:", err);
// Fallback to default logic
}
}
// Existing internal enhancement logic...π‘ Benefits
- β Allows prompt enhancement logic to be modular, externalized, and testable.
- β Supports local DSPy servers, memory augmentation, retrieval, chain-of-thought rewriting, and more.
- β Makes RooCode more extensible for power users, research workflows, and enterprise setups.
- β Compatible with future DSPy features like multi-objective prompt optimization.
- β Fully backward compatible and optional.
π Optional Enhancements (Future Work)
- UI toggle in Settings > Experimental to enable/disable external MCP routing.
- Logging panel to show prompt transformation previews.
- Ability to test multiple enhancement strategies via dropdown.
π Summary for Developers
To implement this:
- Add two new settings.
- Wrap the
enhanceMessage()logic in a conditional that checks foruseExternalServer. - POST prompt + context to the configured endpoint.
- Use the returned enhanced prompt.
- Fallback to existing internal logic if the request fails or the setting is disabled.
This enables seamless external override of RooCode's Enhance Prompt system with almost zero impact on the current user base.
Additional context (optional)
No response
Roo Code Task Links (Optional)
No response
Request checklist
- I've searched existing Issues and Discussions for duplicates
- This describes a specific problem with clear impact and context
How will we know it works? (Acceptance Criteria - REQUIRED if contributing, optional otherwise)
No response
Technical considerations (REQUIRED if contributing, optional otherwise)
No response
Trade-offs and risks (REQUIRED if contributing, optional otherwise)
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status