Interface McpClient
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
AbstractMcpClient, HttpMcpClient, StdioMcpClient
A minimal MCP client speaking JSON-RPC 2.0 to shaft-mcp. Implementations perform the
initialize / notifications/initialized handshake lazily on first use.
Two implementations exist: an ephemeral stdio child (one-shot mode) and a persistent streamable-HTTP daemon connection (session mode).
-
Method Summary
Modifier and TypeMethodDescriptionInvokestools/callfor the given tool name and arguments.tools.jackson.databind.JsonNodecallToolRaw(String name, tools.jackson.databind.node.ObjectNode arguments) Invokes a tool and returns the raw JSON-RPCresultnode (for--json).voidclose()Performs theinitializehandshake if it has not already run.Lists the tools advertised by the server viatools/list.tools.jackson.databind.JsonNode
-
Method Details
-
initialize
InitializeResult initialize()Performs theinitializehandshake if it has not already run.- Returns:
- the negotiated server identity
-
listTools
-
callTool
Invokestools/callfor the given tool name and arguments.- Parameters:
name- the tool namearguments- the arguments object (may be empty, nevernull)- Returns:
- the tool result
-
listToolsRaw
tools.jackson.databind.JsonNode listToolsRaw()- Returns:
- the raw JSON-RPC
resultnode of atools/listcall (for--json)
-
callToolRaw
tools.jackson.databind.JsonNode callToolRaw(String name, tools.jackson.databind.node.ObjectNode arguments) Invokes a tool and returns the raw JSON-RPCresultnode (for--json).- Parameters:
name- the tool namearguments- the arguments object- Returns:
- the raw
resultnode
-
close
void close()- Specified by:
closein interfaceAutoCloseable
-