From fbee82e6d7e3c784dc2152796544ebf267fc99b6 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sun, 8 Mar 2026 14:00:26 -0400 Subject: [PATCH] chore(conductor): Add new track 'External MCP Server Support' --- conductor/tracks.md | 10 ++++- .../external_mcp_support_20260308/index.md | 5 +++ .../metadata.json | 8 ++++ .../external_mcp_support_20260308/plan.md | 42 +++++++++++++++++++ .../external_mcp_support_20260308/spec.md | 39 +++++++++++++++++ 5 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 conductor/tracks/external_mcp_support_20260308/index.md create mode 100644 conductor/tracks/external_mcp_support_20260308/metadata.json create mode 100644 conductor/tracks/external_mcp_support_20260308/plan.md create mode 100644 conductor/tracks/external_mcp_support_20260308/spec.md diff --git a/conductor/tracks.md b/conductor/tracks.md index 66cd094..81513c5 100644 --- a/conductor/tracks.md +++ b/conductor/tracks.md @@ -7,9 +7,17 @@ This file tracks all major tracks for the project. Each track has its own detail ## Phase 4: High-Fidelity UX & Tools *Initialized: 2026-03-08* +### Architecture & Backend + +1. [ ] **Track: External MCP Server Support** + *Link: [./tracks/external_mcp_support_20260308/](./tracks/external_mcp_support_20260308/)* + *Goal: Add support for external MCP servers (Local Stdio and Remote SSE/WS) with flexible configuration and lifecycle management (including auto-start on project load).* + +--- + ### GUI Overhauls & Visualizations -1. [ ] **Track: Advanced Log Management and Session Restoration** +2. [ ] **Track: Advanced Log Management and Session Restoration** *Link: [./tracks/log_session_overhaul_20260308/](./tracks/log_session_overhaul_20260308/)* *Goal: Centralize log management, improve session restoration reliability with full-UI replay mode, and optimize log size via external script/output referencing. Implement transient diagnostic logging for system warnings.* diff --git a/conductor/tracks/external_mcp_support_20260308/index.md b/conductor/tracks/external_mcp_support_20260308/index.md new file mode 100644 index 0000000..220e92d --- /dev/null +++ b/conductor/tracks/external_mcp_support_20260308/index.md @@ -0,0 +1,5 @@ +# Track external_mcp_support_20260308 Context + +- [Specification](./spec.md) +- [Implementation Plan](./plan.md) +- [Metadata](./metadata.json) diff --git a/conductor/tracks/external_mcp_support_20260308/metadata.json b/conductor/tracks/external_mcp_support_20260308/metadata.json new file mode 100644 index 0000000..fbbf3a3 --- /dev/null +++ b/conductor/tracks/external_mcp_support_20260308/metadata.json @@ -0,0 +1,8 @@ +{ + "track_id": "external_mcp_support_20260308", + "type": "feature", + "status": "new", + "created_at": "2026-03-08T14:00:00Z", + "updated_at": "2026-03-08T14:00:00Z", + "description": "Add support for external MCP servers (Local Stdio and Remote SSE/WS) with flexible configuration and lifecycle management." +} diff --git a/conductor/tracks/external_mcp_support_20260308/plan.md b/conductor/tracks/external_mcp_support_20260308/plan.md new file mode 100644 index 0000000..b5d8a61 --- /dev/null +++ b/conductor/tracks/external_mcp_support_20260308/plan.md @@ -0,0 +1,42 @@ +# Implementation Plan: External MCP Server Support + +## Phase 1: Configuration & Data Modeling +- [ ] Task: Define the schema for external MCP server configuration. + - [ ] Update `src/models.py` to include `MCPServerConfig` and `MCPConfiguration` classes. + - [ ] Implement logic to load `mcp_config.json` from global and project-specific paths. +- [ ] Task: Integrate configuration loading into `AppController`. + - [ ] Ensure the MCP config path is correctly resolved from `config.toml` and `manual_slop.toml`. +- [ ] Task: Write unit tests for configuration loading and validation. +- [ ] Task: Conductor - User Manual Verification 'Phase 1: Configuration & Data Modeling' (Protocol in workflow.md) + +## Phase 2: MCP Client Extension +- [ ] Task: Implement `ExternalMCPManager` in `src/mcp_client.py`. + - [ ] Add support for managing multiple MCP server sessions. + - [ ] Implement the `StdioMCPClient` for local subprocess communication. + - [ ] Implement the `RemoteMCPClient` for SSE/WebSocket communication. +- [ ] Task: Update Tool Discovery. + - [ ] Implement `list_external_tools()` to aggregate tools from all active external servers. +- [ ] Task: Update Tool Dispatch. + - [ ] Modify `mcp_client.dispatch()` and `mcp_client.async_dispatch()` to route tool calls to either native tools or the appropriate external server. +- [ ] Task: Write integration tests for stdio and remote MCP client communication (using mock servers). +- [ ] Task: Conductor - User Manual Verification 'Phase 2: MCP Client Extension' (Protocol in workflow.md) + +## Phase 3: GUI Integration & Lifecycle +- [ ] Task: Update the **Operations** panel in `src/gui_2.py`. + - [ ] Create a new "External Tools" section. + - [ ] List discovered tools from active external servers. + - [ ] Add a "Refresh External MCPs" button to reload configuration and rediscover tools. +- [ ] Task: Implement Lifecycle Management. + - [ ] Add the "Auto-start on Project Load" logic to start servers when a project is initialized. + - [ ] Add status indicators (e.g., color-coded dots) for each external server in the GUI. +- [ ] Task: Write visual regression tests or simulation scripts to verify the updated Operations panel. +- [ ] Task: Conductor - User Manual Verification 'Phase 3: GUI Integration & Lifecycle' (Protocol in workflow.md) + +## Phase 4: Agent Integration & HITL +- [ ] Task: Update AI tool declarations. + - [ ] Ensure `ai_client.py` includes external tools in the tool definitions sent to Gemini/Anthropic. +- [ ] Task: Verify HITL Approval Flow. + - [ ] Ensure that calling an external tool correctly triggers the `ConfirmDialog` modal. + - [ ] Verify that approved external tool results are correctly returned to the AI. +- [ ] Task: Perform a final end-to-end verification with a real external MCP server. +- [ ] Task: Conductor - User Manual Verification 'Phase 4: Agent Integration & HITL' (Protocol in workflow.md) diff --git a/conductor/tracks/external_mcp_support_20260308/spec.md b/conductor/tracks/external_mcp_support_20260308/spec.md new file mode 100644 index 0000000..ba54247 --- /dev/null +++ b/conductor/tracks/external_mcp_support_20260308/spec.md @@ -0,0 +1,39 @@ +# Specification: External MCP Server Support + +## Overview +This feature adds support for integrating external Model Context Protocol (MCP) servers into Manual Slop. This allows agents to utilize tools from a wide ecosystem of MCP servers (like those for databases, APIs, or specialized utilities) alongside the application's native tools. + +## Functional Requirements +- **Server Protocol Support:** + - **Local Stdio:** Support for launching local subprocesses and communicating via JSON-RPC over stdio. + - **Remote (SSE/WS):** Support for connecting to remote MCP servers via Server-Sent Events or WebSockets. +- **Flexible Configuration:** + - The path to the MCP configuration file (e.g., `mcp_config.json`) must be configurable globally in `config.toml`. + - Support for per-project overrides in `manual_slop.toml` to specify a project-specific MCP configuration. +- **Lifecycle Management:** + - Provide a "Auto-start on Project Load" checkbox for each configured MCP server (or as a global/per-project default). + - If enabled, the server starts automatically when the project is loaded. + - If disabled, servers should be initialized on-demand or via a manual "Start" button in the GUI. +- **Tool Discovery & UI Integration:** + - Automatically discover tools from configured servers using the MCP `listTools` capability. + - Display discovered tools in a unified "External Tools" section within the **Operations** panel. + - Ensure external tools are correctly mapped to agent tool declarations (Gemini, Anthropic, etc.). +- **Security & HITL:** + - All tool calls from external MCP servers must adhere to the application's existing Human-in-the-Loop (HITL) approval mechanism. + - Users must review and approve the parameters of any external tool call before execution. + +## Non-Functional Requirements +- **Performance:** Asynchronous communication with MCP servers to avoid blocking the main GUI thread. +- **Robustness:** Gracefully handle server connection failures, timeouts, and process crashes. +- **Scalability:** Support for multiple external MCP servers simultaneously. + +## Acceptance Criteria +- [ ] Users can specify an MCP config path in `config.toml` and `manual_slop.toml`. +- [ ] The GUI lists tools from configured external servers in a unified section. +- [ ] Selecting an external tool correctly generates a tool call for the AI. +- [ ] Approving an external tool call successfully executes it via the MCP bridge and returns the output to the AI. +- [ ] Local stdio servers and remote SSE/WS servers are both functional. + +## Out of Scope +- Support for MCP Resources or Prompts (focusing strictly on Tools for this track). +- Managing installation of external MCP server dependencies (e.g., `npm install`, `pip install`).