Skip to content

Conversation

@Sakalya100
Copy link

Model Context Protocol (MCP) Integration Feature PR

Features

  • Updated Architecture of CortexOn backend to integrate MCP client-server architecture

Fixes

  • Updated pydantic-ai dependencies to version 0.1.2.

Technical Details

This PR introduces MCP integration with all existing capabilities supported by agent through a MCP Server

3rd-Son and others added 17 commits April 17, 2025 11:28
✅ **Implemented MCP integration in Cortexon using `pydantic-ai-mcp`**

- The **Orchestrator Agent** now acts as the **MCP client**, while the other agents function as **MCP servers**.
- This enables seamless coordination and communication between distributed agents.

⚠️ **Current Blocker:**  
Encountering a `ModuleNotFoundError` for `pydantic_ai.mcp`, which seems to be a dependency issue.

> cc @AryanGurav106 — need help resolving this import issue.
- Updated `anthropic`, `groq`, and `openai` dependencies to their latest versions.
- Refactored agent initialization to use `provider` instead of `anthropic_client` for better clarity.
…alization

- Updated pydantic-ai dependencies to version 0.1.2.
- Initialized AnthropicProvider with API key in code, planner, and orchestrator agents as per new updates
- Added MCP server initialization and proper client call to server
1. Changed MCP Server initialisation using MCPServerHTTP
2. Updated cortex_on Dockerfile to run server on 3001 port
- Updated `anthropic`, `groq`, and `openai` dependencies to their latest versions.
- Refactored agent initialization to use `provider` instead of `anthropic_client` for better clarity.
…alization

- Updated pydantic-ai dependencies to version 0.1.2.
- Initialized AnthropicProvider with API key in code, planner, and orchestrator agents as per new updates
- Added MCP server initialization and proper client call to server
1. Changed MCP Server initialisation using MCPServerHTTP
2. Updated cortex_on Dockerfile to run server on 3001 port
- Updated Dockerfile to run only the main API, with the MCP server started programmatically in a separate thread.
- Refactored instructor.py to dynamically register MCP server tools and manage their execution, improving modularity and reducing direct dependencies in the MCP server.
- Added threading support for MCP server initialization to enhance responsiveness.
- Moved the ask_human function from instructor.py to orchestrator_agent.py, attached to client directly to avoid future event loops
AryanGurav106 and others added 6 commits April 26, 2025 20:51
- Added a unique message_id to responses in instructor.py and orchestrator_agent.py to improve message tracking.
- Updated StreamResponse format to include message_id for better identification of messages.
- Modified ChatList component to handle message_id for updating and rendering messages, ensuring accurate message updates and preventing duplicates.
- Introduced a ServerManager class to handle multiple MCP server instances, allowing for dynamic server startup and management.
- Updated the start_mcp_server function for better server initialization and registration of tools.
- Enhanced the register_tools function to target specific server instances, improving modularity.
- Modified the SystemInstructor class to support multiple server configurations, ensuring flexibility in orchestration.
- Added backward compatibility for legacy server startup methods.
- Refactored code and added ServerManager class and tool registration to mcp_server.py for server related functionalities
- Removed print statements
- Removed unused dependencies imported in files
- Restructured instructor.py with SystemInstructor class only
- Added support for GitHub and Server Time mcp servers
- Added dynamic prompts and server initialisation in runtime
Sakalya100 and others added 16 commits May 3, 2025 18:22
    - Dynamic Prompts Update with respect to servers and tools associated in the config
    - Streaming of status update for external server to UI through websocket
    - Handling proper server reset and shutdown on New Chat to overcome duplicate tool name issue when re-attaching servers and tools in runtime
- Added GET and POST APIs for MCP UI
- Added request models for POST API for standaridzed request
… error handling to backend

- Added concise success/error messages for enable/disable actions in MCP service components
- Removed all detailed frontend error parsing and validation logic
- Now rely on backend for all error handling and validation, reducing frontend complexity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants