RD-Agent
RD-Agent copied to clipboard
fix: add mcp components
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
- Introduce a new
rdagent.components.mcppackage with a dedicatedcontext7module, including client, prompts, examples, and README, enabling MCP-based doc search. - Add/modify pipeline hooks to surface error context and enable doc retrieval, notably in
rdagent/components/coder/data_science/pipeline/eval.pyand itsprompts.yaml. - Update
rdagent/app/data_science/conf.pyto make Context7 usage configurable; control via theCONTEXT7_ENABLEDenvironment variable. Also adjusts the hypothesis critique toggle default. - Touch related evaluator logic under
rdagent/components/coder/CoSTEER/evaluators.pyto align with the pipeline changes. - Minor housekeeping edits in
.devcontainer/devcontainer.jsonand.gitignore.
Why it matters
- Adds an opt-in documentation search path that improves error diagnosis and remediation during coding runs, reducing manual context switching and speeding iteration.
Configuration
- To enable Context7 MCP at runtime, set:
CONTEXT7_ENABLED=1andMCP_ENABLED=True
Motivation 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
- [x] Add new feature
- [ ] Fix bugs
- [x] Update documentation