Phase 3: MCP Tool Discovery and Refresh #125
Labels
No labels
Epic 5
MCP
P1
PR-0
PR-1
api
api-layer
architecture
area:backend
area:frontend
arrow
authentication
backend
bug
chat
client
clipboard
common-module
compose
cross-cutting
cross-cutting-requirement
data-layer
data-models
database
desktop-client
documentation
duplicate
enhancement
epic
epic-1
epic-2
epic-3
epic-4
epic-5
epic-6
epic-7
epic-llm-config
error-handling
feature
frontend
good first issue
help wanted
implementation
infrastructure
installer
invalid
kotlin
ktor
llm
medium-priority
message
multiplatform
needs-review
needs-triage
packaging
performance
phase-1
phase-2
phase-3
phase-4
phase-5
phase3
phase:3
priority: high
question
refactor
refactoring
resource-sharing
security
server
server-module
services
session
session-management
settings
setup
shutdown
state
storage
streaming
sub-issue
tests
tooling
type:task
ui
ui/ux
user-accounts
user-management
ux
viewmodel
websocket
windows
windows-integration
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Torvian.eu/chatbot#125
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase 3: MCP Tool Discovery and Refresh
Epic:
NF.EA1 - Local MCP ServersDescription
This issue focuses on implementing the tool discovery and refresh mechanism. The user needs to be able to query a configured local MCP server to see what tools it offers and persist them. Furthermore, if the tools on the MCP server change, the user must be able to refresh the list to see the updates.
This process is client-driven: the client will start the local server, perform the MCP discovery, and then send the results to the backend for persistence.
User Stories & Acceptance Criteria
✅ Task Checklist
US3.1: Implement Local MCP Tool Discovery and Persistence
LocalMCPServerManager:MCPClientServiceto execute thediscoverToolsMCP command.ToolDefinitions to the backend via a new API endpoint (e.g.,POST /api/v1/local-mcp-servers/{serverId}/tools/sync).ToolDefinitionTable.LocalMCPServervia theLocalMCPToolDefinitionTable.US3.2: Implement Tool Refresh Mechanism
/sync) must be enhanced to handle updates intelligently:Architectural Context
Client-Driven Workflow: The client is responsible for orchestrating the entire discovery process. It manages the lifecycle of the local OS process, initiates the MCP communication, and pushes the results to the server. This design keeps the server agnostic of the complexities of managing local processes and speaking MCP.
Stateless Server API: The server exposes a stateless API endpoint (
/sync) that accepts a complete list of tools for a given MCP server. This makes the server's logic robust and idempotent. It doesn't need to know the previous state; it simply synchronizes its database to match the state provided by the client.Synchronization Logic: The core of this phase is the server-side synchronization logic. This logic must correctly diff the incoming tool list against the existing persisted tools for that server and perform the necessary create, update, and delete operations. Encapsulating this in a transactional service method (e.g.,
ToolService.synchronizeMcpTools) is critical for maintaining data integrity.