Phase 2: Client-Side MCP Infrastructure & Connection Testing #124

Closed
opened 2025-11-22 22:45:21 +00:00 by rwachters · 0 comments
rwachters commented 2025-11-22 22:45:21 +00:00 (Migrated from github.com)

Phase 2: Client-Side MCP Infrastructure & Connection Testing

Epic: NF.EA1 - Local MCP Servers

Description

This issue covers the creation of the core client-side services responsible for managing the lifecycle of local MCP server processes and handling communication over the Model Context Protocol. The primary goal is to build the foundation for starting, stopping, and interacting with local servers, culminating in a user-facing "Test Connection" feature to validate a server's configuration.


User Stories & Acceptance Criteria

✅ Task Checklist

  • US2.1: Implement Local MCP Server Process Manager

    • Create a LocalMCPServerProcessManager service responsible for low-level OS process management.
    • Implement platform-specific logic (expect/actual) for starting and stopping STDIO processes based on a LocalMCPServer configuration.
    • The service must manage the stdin, stdout, and stderr streams of the child process.
    • It should track the state of running processes (e.g., PID, status).
  • US2.2: Implement Local MCP Server Manager (High-Level Orchestration)

    • Create a high-level LocalMCPServerManager service to act as the main entry point for MCP server operations.
    • This service will orchestrate other services (ProcessManager, MCPClientService, LocalMCPServerRepository).
    • It will maintain an in-memory state of all configured local servers, including their running status.
    • Implement methods to startServer, stopServer, and getServerStatus.
  • US2.3: Implement MCP Client Service (MCP Operations Layer)

    • Create an MCPClientService that wraps the MCP SDK/library.
    • This service will be responsible for protocol-level interactions.
    • Implement a testConnection method that establishes an MCP connection over the I/O streams provided by the ProcessManager and performs a handshake or basic request to verify connectivity.
    • Implement a discoverTools method that uses the MCP connection to request the list of available tools from a server.
  • US2.4: Implement Local MCP Server Connection Testing UI

    • Add a "Test Connection" button to the (forthcoming) MCP server configuration UI.
    • When clicked, the button should trigger the LocalMCPServerManager to start the server (if not running), execute the testConnection flow via the MCPClientService, and then stop the server.
    • The UI must display the result of the test to the user (e.g., "Success" or "Failed: [error message]").

Architectural Context

This phase introduces three key client-side services with a clear separation of concerns:

  • LocalMCPServerProcessManager (Low-Level): This service is the platform-specific layer that knows how to interact with the operating system. Its only job is to start, stop, and monitor OS processes. It has no knowledge of the Model Context Protocol.

  • MCPClientService (Mid-Level): This service is the protocol-specific layer. It understands how to speak MCP using the provided SDK. It takes I/O streams from the ProcessManager and uses them to perform MCP operations like discovery and testing. It has no knowledge of the application's overall state management.

  • LocalMCPServerManager (High-Level): This is the application's orchestration layer. It ties everything together. It responds to UI events (like "Test Connection"), uses the LocalMCPServerRepository to get server configurations, tells the ProcessManager to start/stop processes, and invokes the MCPClientService to perform protocol operations. It is responsible for managing the state and lifecycle of the servers from the user's perspective.

This layered approach ensures that platform-specific code, protocol-specific code, and application logic are cleanly separated, making the system easier to maintain and test.

# Phase 2: Client-Side MCP Infrastructure & Connection Testing **Epic**: `NF.EA1 - Local MCP Servers` ## Description This issue covers the creation of the core client-side services responsible for managing the lifecycle of local MCP server processes and handling communication over the Model Context Protocol. The primary goal is to build the foundation for starting, stopping, and interacting with local servers, culminating in a user-facing "Test Connection" feature to validate a server's configuration. --- ## User Stories & Acceptance Criteria ### ✅ Task Checklist - [ ] **US2.1: Implement Local MCP Server Process Manager** - [ ] Create a `LocalMCPServerProcessManager` service responsible for low-level OS process management. - [ ] Implement platform-specific logic (`expect`/`actual`) for starting and stopping STDIO processes based on a `LocalMCPServer` configuration. - [ ] The service must manage the `stdin`, `stdout`, and `stderr` streams of the child process. - [ ] It should track the state of running processes (e.g., PID, status). - [ ] **US2.2: Implement Local MCP Server Manager (High-Level Orchestration)** - [ ] Create a high-level `LocalMCPServerManager` service to act as the main entry point for MCP server operations. - [ ] This service will orchestrate other services (`ProcessManager`, `MCPClientService`, `LocalMCPServerRepository`). - [ ] It will maintain an in-memory state of all configured local servers, including their running status. - [ ] Implement methods to `startServer`, `stopServer`, and `getServerStatus`. - [ ] **US2.3: Implement MCP Client Service (MCP Operations Layer)** - [ ] Create an `MCPClientService` that wraps the MCP SDK/library. - [ ] This service will be responsible for protocol-level interactions. - [ ] Implement a `testConnection` method that establishes an MCP connection over the I/O streams provided by the `ProcessManager` and performs a handshake or basic request to verify connectivity. - [ ] Implement a `discoverTools` method that uses the MCP connection to request the list of available tools from a server. - [ ] **US2.4: Implement Local MCP Server Connection Testing UI** - [ ] Add a "Test Connection" button to the (forthcoming) MCP server configuration UI. - [ ] When clicked, the button should trigger the `LocalMCPServerManager` to start the server (if not running), execute the `testConnection` flow via the `MCPClientService`, and then stop the server. - [ ] The UI must display the result of the test to the user (e.g., "Success" or "Failed: [error message]"). --- <details> <summary><h3>Architectural Context</h3></summary> This phase introduces three key client-side services with a clear separation of concerns: - **`LocalMCPServerProcessManager` (Low-Level)**: This service is the platform-specific layer that knows how to interact with the operating system. Its only job is to start, stop, and monitor OS processes. It has no knowledge of the Model Context Protocol. - **`MCPClientService` (Mid-Level)**: This service is the protocol-specific layer. It understands how to speak MCP using the provided SDK. It takes I/O streams from the `ProcessManager` and uses them to perform MCP operations like discovery and testing. It has no knowledge of the application's overall state management. - **`LocalMCPServerManager` (High-Level)**: This is the application's orchestration layer. It ties everything together. It responds to UI events (like "Test Connection"), uses the `LocalMCPServerRepository` to get server configurations, tells the `ProcessManager` to start/stop processes, and invokes the `MCPClientService` to perform protocol operations. It is responsible for managing the state and lifecycle of the servers from the user's perspective. This layered approach ensures that platform-specific code, protocol-specific code, and application logic are cleanly separated, making the system easier to maintain and test. </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Torvian.eu/chatbot#124
No description provided.