Skip to content

Jules was unable to complete the task in time. Please review the work… #4211

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tommy-ca
Copy link

… done so far and provide feedback for Jules to continue.

… done so far and provide feedback for Jules to continue.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This commit includes the initial implementation phases for Model Context Protocol (MCP) integration into Aider.

Completed Steps & Changes:

1.  **MCP Configuration Loading:**
    *   Defined `MCPServerConfig` class in `aider/mcp/mcp_config.py` to store individual server configurations, including URL parsing for stdio/http.
    *   Modified `aider/args.py`:
        *   Added CLI arguments (`--mcp-servers`, `--no-mcp`, `--mcp-enable-server`, `--mcp-disable-server`).
        *   Implemented `process_mcp_configurations` function to load `mcp_servers` from YAML, apply environment variable settings, and handle CLI overrides, populating `args.mcp_server_configs`.
    *   Updated `aider/main.py` to call `process_mcp_configurations` after argument parsing.

2.  **Core MCP Management Classes:**
    *   Created `aider/mcp/mcp_manager.py`.
    *   Implemented `MCPConnectedServer` class: Manages connection state, session, and capabilities for a single MCP server. Includes methods for `connect`, `disconnect`, `fetch_capabilities`, `read_resource_content`, and `execute_mcp_tool`. SDK interactions for connection are stubbed with `NotImplementedError` for detailed stdio/http client handling, while capability listing uses actual (though currently dummy due to connection stubs) SDK method calls.
    *   Implemented `MCPManager` class: Manages multiple `MCPConnectedServer` instances. Provides methods for connecting/disconnecting, status reporting, capability refreshing, and accessing aggregated tools/resources.

3.  **MCP Python SDK Integration (Basic):**
    *   Replaced placeholder SDK types in `aider/mcp/mcp_manager.py` with actual types from the `mcp` SDK (`ClientSession`, `mcp_types.ResourceDefinition`, etc.).
    *   Integrated actual SDK calls for `session.initialize()`, `session.close()`, `session.list_resources()`, `session.list_tools()`, `session.list_prompts()` within `MCPConnectedServer`.
    *   The detailed implementation of `stdio_client` and `streamablehttp_client` usage in `MCPConnectedServer.connect()` remains a work-in-progress, currently stubbed to allow structural development.

4.  **User Commands for MCP Management:**
    *   Modified `aider/commands.py` to add:
        *   `/mcp_status` (aliased as `/mcp_list_servers`): Displays status of configured MCP servers.
        *   `/mcp_connect <server_name>`: Attempts to connect to a specified MCP server.
        *   `/mcp_disconnect <server_name>`: Disconnects from a specified MCP server.
        *   `/mcp_rescan [server_name]`: Refreshes capabilities from specified or all connected servers.
    *   These commands interact with `MCPManager` and use `asyncio.get_event_loop().run_until_complete()` for async calls.
    *   Help messages for new commands have been updated.

Current Status:
The foundational pieces for MCP integration are in place. I can load configurations and have the internal machinery and commands for you to manage MCP server connections. The next steps would involve fully implementing the SDK's stream/client management for connections in `MCPConnectedServer.connect()` and then proceeding to integrate MCP resource and tool usage into my chat workflow.
… done so far and provide feedback for Jules to continue.
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.

2 participants