Connect

6 / 7

Connect the system ยท 06

Connect the MCP Server

The capstone places the five protocol primitives into one request lifecycle. A client can discover capabilities, call a tool, and read a resource while the server validates each self-contained request and returns the complete protocol response.

Protocol boundary

JSON-RPC envelopes, ids, results, and errors.

Application boundary

Tool registration, dispatch, resources, and typed content.

build_jsonrpc_request

self-contained client requests

Constructs each JSON-RPC envelope. The capstone adds _meta with the client protocol version, identity, and capabilities.

build_mcp_tool

tools/list

Publishes the tool names, descriptions, and input schemas.

validate_tool_arguments

tools/call validation

Checks model-supplied arguments before application code runs.

dispatch_mcp_tool

tool registry

Routes a validated name to one registered Python function.

read_mcp_resource

resources/read

Resolves a URI into text and its declared MIME type.

Two protocol fields are added in the capstone

Each request carries _meta so the server can read the client's protocol version, identity, and capabilities. The first server/discover request returns the versions and capabilities supported by the server. The request envelope, validation, dispatch, tools, and resources remain the same primitives you implemented.

Run the complete request lifecycle.

Keep the protocol contracts visible while you assemble a transport-independent request handler.

Start the capstone