Currently McpSyncServer stores tools in a CopyOnWriteArrayList that is read directly on each tools/list request. To
make tools dynamic, users must manually call addTool() / removeTool() + notifyToolsListChanged() to keep the internal
list in sync with an external source (e.g. a database).
This works, but it pushes synchronization logic into application code — every place that creates/updates/deletes a
tool must also update the server, which is error-prone and tightly couples business logic to the MCP server instance.
Proposal: Add a pluggable ToolProvider (or ToolSupplier) callback interface that the server invokes on each tools/list
request, so users can supply tools from any dynamic source without manual sync:
@FunctionalInterface
public interface SyncToolProvider {
List listTools(McpSyncServerExchange exchange);
}
This way, toolsListRequestHandler would call the provider instead of reading from the static list, and users simply
implement the interface to query a database, call an API, etc. — no addTool/removeTool/notifyToolsListChanged
bookkeeping needed.
Currently McpSyncServer stores tools in a CopyOnWriteArrayList that is read directly on each tools/list request. To
make tools dynamic, users must manually call addTool() / removeTool() + notifyToolsListChanged() to keep the internal
list in sync with an external source (e.g. a database).
This works, but it pushes synchronization logic into application code — every place that creates/updates/deletes a
tool must also update the server, which is error-prone and tightly couples business logic to the MCP server instance.
Proposal: Add a pluggable ToolProvider (or ToolSupplier) callback interface that the server invokes on each tools/list
request, so users can supply tools from any dynamic source without manual sync:
@FunctionalInterface
public interface SyncToolProvider {
List listTools(McpSyncServerExchange exchange);
}
This way, toolsListRequestHandler would call the provider instead of reading from the static list, and users simply
implement the interface to query a database, call an API, etc. — no addTool/removeTool/notifyToolsListChanged
bookkeeping needed.