-
-
Notifications
You must be signed in to change notification settings - Fork 1k
fix: add mcp components #1141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: add mcp components #1141
Conversation
…age and mcp to be discussed; the extraction logic not done yet; the config load is ugly) init commit 2
- Refine context7.py prompt - Handle/pause on timeout - Optimize context7 logic - Pass content downstream when enabled - Add PyTorch Image Models (timm) search to index.ts
- Implement litellm integration for MCP extra configuration - Enable flexible model calling through litellm adapter Next steps: - [ ] Multi-MCP registration and validation - [ ] Eval module testing - [ ] Code refactoring for better readability - [ ] README documentation
Replace dual-function API (query_mcp/query_mcp_auto) with single flexible interface supporting three modes: auto (all services), single service, and multi-service parallel processing. Key improvements: - Remove API complexity: one function instead of two - Enable true parallelism: services run concurrently, not sequentially - Add MultiServiceContext for efficient connection management - Fix LiteLLM tool calling edge cases with proper finish_reason handling - Update examples demonstrating new unified interface Performance impact: Multi-service queries now execute in parallel rather than trying services one by one, significantly reducing response time. Breaking change: query_mcp_auto() removed, use query_mcp() instead.
- Add verbose parameter to control logging output levels
- Default (verbose=False): Show only essential logs
- Verbose mode (verbose=True): Show detailed debugging info
- Enhance error detection with comprehensive pattern matching
- Add rate limit error detection ('rate limit', 'too many
requests')
- Add content availability errors ('no content available')
- Fix MCP services returning errors as successful responses
- Refactor error handling with data-driven approach
- Consolidate error patterns into ERROR_DEFINITIONS constant
- Eliminate code duplication in error detection functions
- Add priority-based error message formatting
- Remove cost calculation logging from LiteLLM backend
- Clean up unused imports and improve code organization
mcp_config.json.example
Outdated
| "mcpServices": { | ||
| "context7": { | ||
| "url": "http://localhost:8123/mcp", | ||
| "handler": "rdagent.components.mcp.context7.handler:Context7Handler", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mix the API Handler and the prompt customization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two different responsibility.
- API Handler (1 - 1)
- prompt customization. ( Agent level custmization, Many-to-many )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MCPAgent + MCPService( API Handler is included)
improve error handling
3e3cee1 to
8bfc09c
Compare
Description
This PR integrates a new MCP (Model Context Protocol) Context7 capability and wires it into the coder/data-science pipeline so the agent can search relevant documentation when encountering implementation errors.
Key changes
rdagent.components.mcppackage with a dedicatedcontext7module, including client, prompts, examples, and README, enabling MCP-based doc search.rdagent/components/coder/data_science/pipeline/eval.pyand itsprompts.yaml.rdagent/app/data_science/conf.pyto make Context7 usage configurable; control via theCONTEXT7_ENABLEDenvironment variable. Also adjusts the hypothesis critique toggle default.rdagent/components/coder/CoSTEER/evaluators.pyto align with the pipeline changes..devcontainer/devcontainer.jsonand.gitignore.Why it matters
Configuration
CONTEXT7_ENABLED=1andMCP_ENABLED=TrueMotivation and Context
Agent runs often fail due to missing APIs, library nuances, or environment quirks. Integrating an MCP-driven doc search lets the system proactively fetch relevant references based on the current error, guiding the next fix step. The added config flag ensures teams can roll this out gradually and A/B the impact.
Types of changes