Some checks failed
Test / rust-fmt-check (pull_request) Failing after 2m12s
Test / frontend-typecheck (pull_request) Successful in 2m23s
Test / frontend-tests (pull_request) Successful in 2m22s
Test / rust-clippy (pull_request) Successful in 3m55s
Test / rust-tests (pull_request) Successful in 5m10s
PR Review Automation / review (pull_request) Failing after 11m6s
Adds full Model Context Protocol (MCP) server management, enabling the
AI assistant to discover and call tools from external MCP servers during
triage conversations.
Backend (Rust):
- rmcp 1.7.0 dependency (client + stdio + Streamable HTTP transports)
- Migration 018: mcp_servers, mcp_tools, mcp_resources tables with
CHECK constraints for transport_type, auth_type, discovery_status
- src/mcp/ module: models, store, client, adapter, discovery, commands,
transport/{stdio,http}
- AppState gains mcp_connections: Arc<TokioMutex<HashMap<...>>>
- .setup() hook auto-discovers enabled servers at startup
- 8 new Tauri commands wired into invoke_handler
- execute_mcp_tool_call: PII scan + mandatory audit_log before execution
- Auth values encrypted at rest via integrations::auth::encrypt_token();
scrubbed before any frontend response
Frontend:
- MCPServers.tsx settings page (/settings/mcp) with server list,
status badges, Discover Now, Add/Edit modal, enable/disable toggle
- tauriCommands.ts: McpServer, McpTool, McpServerStatus types + 8 cmds
- App.tsx: Plug icon, /settings/mcp route, sidebar nav entry
Tests (TDD): 15 new tests, all green
- 5 migration tests (written before migration, red → green)
- 5 store CRUD + encryption tests
- 5 adapter sanitization + conversion tests
Verification: 185/185 Rust, 94/94 Vitest, clippy -D warnings: 0
3.9 KiB
3.9 KiB
MCP Server Support — Ticket Summary
Description
Adds MCP (Model Context Protocol) server management to the application, allowing the AI assistant to discover and call tools from external MCP servers during triage conversations.
The implementation covers:
- Settings page at
/settings/mcpfor managing server connections - Support for
stdio(local processes) andhttp(Streamable HTTP) transports - Auth types:
none,api_key,bearer,oauth2 - Auto-discovery of enabled servers at application startup
- Transparent injection of discovered tools into every AI chat session
- Security-first design: encrypted credential storage, mandatory audit logging, PII scanning
Acceptance Criteria
- Users can add, edit, enable/disable, and delete MCP server configurations
- "Discover Now" connects to the server, lists tools and resources, and persists results
- Enabled servers auto-connect on app launch via
.setup()hook - MCP tools appear in the AI chat tool list and are callable by the AI
auth_valueis always AES-256-GCM encrypted at rest; never returned to frontendwrite_audit_event()is called before every MCP tool execution- PII scan on tool call arguments (non-blocking warning on detection)
- stdio transport rejects relative paths; never uses
sh -c - All existing tests continue to pass (185 Rust, 94 Vitest)
- Zero clippy warnings; zero TypeScript errors
Work Implemented
Backend (Rust)
| Phase | Files | Description |
|---|---|---|
| 0 | Cargo.toml |
Added rmcp = "1.7.0" with client + transport features; version → 0.3.0 |
| 1 | db/migrations.rs |
Migration 018: mcp_servers, mcp_tools, mcp_resources tables with CHECK constraints |
| 2a | mcp/models.rs, mcp/store.rs |
Data types; full CRUD with encrypted auth storage |
| 2b | mcp/transport/stdio.rs, mcp/transport/http.rs |
Transport builders for subprocess and Streamable HTTP |
| 2c | mcp/client.rs |
McpConnection type alias; connect/list/call wrappers |
| 2d | mcp/adapter.rs |
sanitize_name, build_tool_key, mcp_tools_to_ai_tools, get_enabled_mcp_tools |
| 2e | mcp/discovery.rs |
discover_server, init_all_servers |
| 2f | mcp/commands.rs, state.rs, lib.rs |
8 Tauri commands; mcp_connections field on AppState; .setup() hook |
| 5 | ai/tools.rs, commands/ai.rs |
get_enabled_mcp_tools async helper; execute_mcp_tool_call with PII scan + audit |
Frontend (TypeScript / React)
| Phase | Files | Description |
|---|---|---|
| 3 | src/lib/tauriCommands.ts |
McpServer, McpTool, McpResource, McpServerStatus, request types; 8 command wrappers |
| 4 | src/pages/Settings/MCPServers.tsx |
Full settings page: server list, status badges, Discover Now, Add/Edit modal |
| 4 | src/App.tsx |
Added Plug icon, /settings/mcp route and nav entry |
Wiki
docs/wiki/MCP-Servers.md— newdocs/wiki/Database.md— migration 018 documenteddocs/wiki/IPC-Commands.md— 8 new commandsdocs/wiki/Security-Model.md— MCP security section
Testing Needed
Automated (all passing)
- Rust: 185 tests (64 existing + 5 migration 018 + 5 store + 3 adapter + 5 migration idempotency + misc)
- Vitest: 94 tests (all existing + 3 new MCP frontend tests)
cargo clippy -- -D warnings: zero warningsnpx tsc --noEmit: zero errors
Manual verification checklist
- Add an HTTP MCP server → click Discover Now → tools appear in list
- Add a stdio MCP server → Discover Now → process spawns, tools appear
- Disable a server → its tools absent from next triage chat session
- Start a triage chat → MCP tools visible in AI tool suggestions
- AI calls an MCP tool → audit log entry written in Security page
- Delete a server → live connection removed, tools gone from next session
- Enter an invalid command path (relative) for stdio → error shown in UI
Branch
feature/mcp-server-support