Add mcp-client module: ChatClient calling tools from real external MCP servers over stdio
defaultToolCallbacks(ToolCallbackProvider) wires two real stdio MCP servers (the official filesystem server and git server) into ChatClient, contrasted with defaultTools(Object) for a local @Tool method. Every call -- MCP-sourced or local -- is logged through one Micrometer ObservationHandler<ToolCallingObservationContext>; a first version wired that handler two ways at once and every call logged twice, which is now a regression test. No real LLM is used anywhere: every test builds an AssistantMessage.ToolCall by hand and drives it through the real ToolCallingManager bean against real npx/uvx-launched MCP server processes. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FtpJvZfg4nvLvtzgJTDWpB
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
spring:
|
||||
application:
|
||||
name: mcp-client
|
||||
ai:
|
||||
# No real model call is made anywhere in this module's tests (see ToolCallingManagerTest) --
|
||||
# this starter exists only to give the demo a ChatClient.Builder to wire tool callbacks into.
|
||||
openai:
|
||||
api-key: ${OPENAI_API_KEY:not-a-real-key-see-readme}
|
||||
mcp:
|
||||
client:
|
||||
enabled: true
|
||||
name: mcp-client-demo
|
||||
version: 1.0.0
|
||||
request-timeout: 20s
|
||||
type: SYNC
|
||||
toolcallback:
|
||||
enabled: true
|
||||
stdio:
|
||||
connections:
|
||||
filesystem:
|
||||
command: ${MCP_CLIENT_NPX_CMD:npx}
|
||||
args:
|
||||
- "-y"
|
||||
- "@modelcontextprotocol/server-filesystem"
|
||||
- ${MCP_CLIENT_FS_ROOT:./fixtures/workspace}
|
||||
git:
|
||||
command: ${MCP_CLIENT_UVX_CMD:uvx}
|
||||
args:
|
||||
- "mcp-server-git"
|
||||
- "--repository"
|
||||
- ${MCP_CLIENT_GIT_REPO:./fixtures/demo-repo}
|
||||
Reference in New Issue
Block a user