Skip to content

Introduce MCP tools#2427

Open
YuchengZhou821 wants to merge 14 commits intomainfrom
Introduce-MCP-support
Open

Introduce MCP tools#2427
YuchengZhou821 wants to merge 14 commits intomainfrom
Introduce-MCP-support

Conversation

@YuchengZhou821
Copy link
Contributor

This pull request introduces integration with MCP servers, enabling external tool execution and orchestration within the runtime system. The changes add support for configuring MCP servers, managing their connections, injecting tool schemas into the LLM, and handling tool calls and results in the agent's workflow. The implementation is modular, with new classes for client management and orchestration, and updates to configuration and runtime initialization to support MCP functionality.

MCP Server Integration and Orchestration

  • Added MCPClientManager and transport support for stdio and HTTP, including tool discovery, schema conversion, and tool call execution (src/mcp_servers/client.py).
  • Introduced MCPOrchestrator to manage MCP tool execution, intercept tool calls from LLM output, execute tools concurrently, and re-invoke LLM with tool results (src/mcp_servers/orchestrator.py).
  • Provided a loader function for MCP servers (load_mcp) to initialize connections based on configuration (src/mcp_servers/__init__.py).

Configuration and Runtime Changes

  • Extended ModeConfig and RuntimeConfig to support MCP server configuration, including parsing and loading from config files (src/runtime/config.py, src/runtime/converter.py). [1] [2] [3] [4] [5] [6] [7]
  • Updated runtime initialization and orchestrator lifecycle to create and close MCP orchestrator, ensuring proper startup and shutdown of MCP connections (src/runtime/cortex.py). [1] [2] [3] [4]

LLM and Action Handling

  • Injected MCP tool schemas into LLM function schemas, and updated action conversion logic to handle MCP tool calls distinctly (src/llm/function_schemas.py).
  • Modified the agent tick loop to process MCP tool actions and merge results before further action execution (src/runtime/cortex.py).

Prompt and Tool Description Improvements

  • Enhanced agent prompt generation to include descriptions of available MCP tools for LLM guidance (src/fuser/__init__.py).

These changes collectively enable seamless integration of external MCP tools into the agent's workflow, allowing the LLM to call tools, receive results, and generate informed responses.

Copilot AI review requested due to automatic review settings February 27, 2026 01:40
@YuchengZhou821 YuchengZhou821 requested review from a team as code owners February 27, 2026 01:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 81.78295% with 47 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/mcp_servers/client.py 73.22% 34 Missing ⚠️
src/mcp_servers/orchestrator.py 93.00% 7 Missing ⚠️
src/fuser/__init__.py 25.00% 3 Missing ⚠️
src/runtime/cortex.py 85.71% 2 Missing ⚠️
src/llm/function_schemas.py 66.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 12 comments.

@YuchengZhou821 YuchengZhou821 requested a review from a team as a code owner February 28, 2026 01:54
@github-actions github-actions bot added the tests Test files label Feb 28, 2026
@github-actions github-actions bot added dependencies Pull requests that update a dependency file config Configuration files labels Feb 28, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated 6 comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated 3 comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Configuration files dependencies Pull requests that update a dependency file python Python code robotics Robotics code changes tests Test files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants