Enable stdio MCP tool and resource method calls

The runtime already framed JSON-RPC initialize traffic over stdio, so this extends the same transport with typed helpers for tools/list, tools/call, resources/list, and resources/read plus fake-server tests that exercise real request/response roundtrips.

Constraint: Must build on the existing stdio JSON-RPC framing rather than introducing a separate MCP client layer
Rejected: Leave method payloads as untyped serde_json::Value blobs | weakens call sites and test assertions
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep new MCP stdio methods aligned with upstream MCP camelCase field names when adding more request/response types
Tested: cargo fmt --manifest-path rust/Cargo.toml --all; cargo clippy --manifest-path rust/Cargo.toml -p runtime --all-targets -- -D warnings; cargo test --manifest-path rust/Cargo.toml -p runtime
Not-tested: Live integration against external MCP servers
This commit is contained in:
Yeachan-Heo
2026-03-31 22:45:24 +00:00
parent 8b6bf4cee7
commit 5f46fec5ad
2 changed files with 451 additions and 29 deletions

View File

@@ -47,7 +47,9 @@ pub use mcp_client::{
pub use mcp_stdio::{
spawn_mcp_stdio_process, JsonRpcError, JsonRpcId, JsonRpcRequest, JsonRpcResponse,
McpInitializeClientInfo, McpInitializeParams, McpInitializeResult, McpInitializeServerInfo,
McpStdioProcess,
McpListResourcesParams, McpListResourcesResult, McpListToolsParams, McpListToolsResult,
McpReadResourceParams, McpReadResourceResult, McpResource, McpResourceContents,
McpStdioProcess, McpTool, McpToolCallContent, McpToolCallParams, McpToolCallResult,
};
pub use oauth::{
code_challenge_s256, generate_pkce_pair, generate_state, loopback_redirect_uri,