An MCP server gives an AI application a standard way to use tools, data and prompts: files, databases, business APIs and search. The Model Context Protocol (MCP) is the adapter boundary between them.
The host owns the conversation, model access, permissions and orchestration. It creates one MCP client for each server relationship. A server advertises callable tools, readable resources and reusable prompts, then translates approved requests into its backing files, databases or APIs.
MCP is not the model, not the agent loop and not an automatic security boundary. The model proposes a tool invocation; the host decides whether it is allowed; the client sends a JSON-RPC message; the host returns the result to the model. Local servers commonly use stdio. Network services use Streamable HTTP.
The handshake you learned
is now the legacy path.
The current revision, 2026-07-28, is stateless. The familiar initialize handshake and protocol sessions belong to 2025-11-25 and earlier. You still need to understand both: plenty of clients and servers in the wild speak the older revision, and a well-behaved implementation can talk to either.
The initialize → initialized lifecycle is legacy. In 2026-07-28 there is no initialize handshake, no Mcp-Session-Id, no standalone HTTP GET stream and no independent server-to-client JSON-RPC requests. This article shows the legacy flow, labelled clearly, alongside its modern replacement.
| Revision | What changed |
|---|---|
| 2025-03-26 | Streamable HTTP replaces the older two-endpoint HTTP+SSE transport. |
| 2025-06-18 | Structured tool output, elicitation, OAuth resource-server separation and resource indicators. JSON-RPC batching removed. |
| 2025-11-25 | URL elicitation, sampling with tools, recommended Client ID Metadata Documents; experimental core tasks. |
| 2026-07-28 · current | Per-request version and capabilities; server/discover; MRTR; subscriptions/listen; resultType; explicit state handles; tasks moved to an extension. Roots, sampling, logging and Dynamic Client Registration deprecated. |
One host, many clients.
Each client, one server.
A client/server relationship is one-to-one; a host is not limited to one server. HTTP requests can reach different replicas without creating a modern protocol session. And a server need not contain an LLM at all: it can be a perfectly deterministic adapter.
Talks to every client through the host
Child process
OS permissions / sandbox
Independent HTTPS service · validates tokens as a resource server
Separate downstream credentials
Independent HTTPS service
Its own access controls
What is 2 + 3?
Ask a server.
The simplest useful example is a server with one add tool. Follow it through both protocol eras. Notice who does what: the model only proposes; the host checks policy and asks the user when required; the client speaks the protocol; the server executes.
- LEGACY · 2025-11-25 and earlier only
- 1Host to MCP client1Start local process / configure HTTP endpoint
- 2MCP client to MCP server2initialize(version, clientInfo, client capabilities)
- 3MCP server to MCP client3result(version, serverInfo, server capabilities)
- 4MCP client to MCP server4notifications/initialized (no id; no response)
- 5MCP client to MCP server5tools/list
- 6MCP server to MCP client6Tool names, descriptions, input/output schemas
- 7User to Host7What is 2 + 3?
- 8Host to LLM8User request + selected tool schemas
- 9LLM to Host9Propose add(a=2, b=3)
- Host checks policy and obtains approval when required
- 10Host to User10Approval if required by host policy
- 11User to Host11Approve or deny
- 12Host to MCP client12Approved invocation
- 13MCP client to MCP server13tools/call(name=add, arguments)
- 14MCP server to MCP client14content + structuredContent / tool error
- 15MCP client to Host15Tool result
- 16Host to LLM16Tool result tied to the model tool-call id
- 17LLM to Host17Final answer
- 18Host to User185
- MODERN · 2026-07-28 · no initialize handshake, no protocol session
- OPTIONAL · discovery / dual-era stdio probe
- 1MCP client to MCP server1server/discover + per-request _meta
- 2MCP server to MCP client2supportedVersions + capabilities + identity metadata
- 3MCP client to MCP server3tools/list + version + clientCapabilities in _meta
- 4MCP server to MCP client4resultType=complete, tools, ttlMs, cacheScope
- Host/model selects a tool and the host authorizes its invocation
- 5MCP client to MCP server5tools/call(id=10) + per-request _meta
- OPTIONAL · more user input needed (MRTR)
- 6MCP server to MCP client6resultType=input_required; inputRequests; requestState
- 7MCP client to User7Elicitation with accept / decline / cancel
- 8User to MCP client8Reviewed answer
- 9MCP client to MCP server9Retry original tools/call(id=11), inputResponses, requestState
- 10MCP server to MCP client10resultType=complete; content; structuredContent
- Host sends the result back to its model
- OPTIONAL · change notifications requested
- 11MCP client to MCP server11subscriptions/listen (POST response stream on HTTP)
- 12MCP server to MCP client12Acknowledged + opted-in change notifications
MRTR means multi round-trip requests. What used to be a server request becomes data inside an interim result. A client answers it by retrying the original operation with a new JSON-RPC id. Do not confuse this targeted continuation with blindly retrying a failed mutation.
Tools, resources, prompts.
And who chooses each.
A server exposes three primitives. The client side can provide others. The useful question for each is not just “what is it?” but “who decides when it is used, and who authorizes it?”
Model-selected; host-authorized
Application-controlled
User-controlled
User answers via the host
Client-controlled; deprecated
| Primitive | Mechanism and owner |
|---|---|
| Tools | tools/list → tools/call. Model-controlled selection; host policy and user consent still govern execution. |
| Resources | resources/list or templates/list → resources/read. The application chooses context; a resource URI need not be an HTTP URL. |
| Prompts | prompts/list → prompts/get. The user chooses a named template; fetching a prompt does not itself call an LLM. |
| Elicitation | User-controlled form or URL interaction, mediated by the client. Modern: elicitation/create embedded in inputRequests. |
| Roots · deprecated | The application supplies user/workspace scope. Advisory file:// directories, not an OS sandbox. Modern inputRequests may carry roots/list. |
| Sampling · deprecated | The client/host controls access to its model, with user oversight of request and response. Modern inputRequests may carry sampling/createMessage. |
Sampling, roots and elicitation do not share a neat three-label taxonomy. Distinguish who requests something (the server) from who authorizes and supplies it (the host, application and user).
Two eras.
One place to finish.
initialize → result → initialized
Negotiated capabilities / optional HTTP session
Logical state; no protocol session
Per-request version + capabilities
Gather input; retry with a new id
Closing a response SSE stream cancels that request; a broken stream loses the in-flight result. For stdio, close input and wait for the process to exit. There is no JSON-RPC shutdown method.
Seven steps between
a question and a result.
- Bind a server to a clientA local stdio client launches the configured executable and connects stdin/stdout. A remote client targets an MCP HTTP endpoint. Neither transport supplies your agent loop.
- Identify the protocol eraModern servers implement
server/discover; clients may query it. A dual-era stdio client probes discovery and falls back to initialize on a legacy response. A recognised modern unsupported-version error means retry with a supported version, not fall back blindly. - Declare optional capabilitiesLegacy: negotiate in initialize and use only the negotiated features. Modern: every request includes protocolVersion and clientCapabilities in
params._meta; server capabilities are advertised by discovery. A missing feature is not permission to guess a method. - Discover context and actionsList tools, resources and prompts as supported; follow
nextCursorpagination. Modern list/read results carry cache hints. Scope caches by authorization; deterministic tool ordering helps model prompt caches. - Adapt schemas into the model APIThe host converts selected MCP tool definitions into its provider’s tool format. The LLM proposes a name and arguments; it does not write directly to an MCP socket. Model call ids and JSON-RPC request ids are different correlation domains.
- Authorize, invoke and validateEnforce tool allowlists, schemas, least-privilege credentials and approval. The client sends
tools/call; the server validates inputs and backing-system permissions. Client-side hiding is not server-side authorization. - Continue the model loopSend the validated tool result back with the originating model call id. The model may answer or request more tools. A server’s content is untrusted data, not higher-priority instructions.
JSON-RPC 2.0 message types
| Type | Wire shape |
|---|---|
| Request | jsonrpc: 2.0, id, method, optional params. Requires a matching response; ids correlate concurrent calls. |
| Success response | jsonrpc: 2.0, same id, result. Modern ordinary results include resultType: complete. |
| Error response | jsonrpc: 2.0, same id, error: {code, message, optional data}. Never result and error together. |
| Notification | jsonrpc: 2.0, method, optional params; no id and no response. Example: legacy notifications/initialized or a subscribed tools/list_changed event. |
MCP no longer supports JSON-RPC batch arrays. In stdio each message is one UTF-8 JSON line; embedded newlines inside strings are escaped. In modern MCP, servers send responses and scoped notifications, not independent JSON-RPC requests. Protocol errors differ from successful results containing isError: true, which signal tool execution failure.
// LEGACY ONLY: each object below is a separate message, not a batch.
// Client -> server
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{
"protocolVersion":"2025-11-25",
"capabilities":{"elicitation":{"form":{}}},
"clientInfo":{"name":"ndorbit-example-client","version":"1.0.0"}
}}
// Server -> client
{"jsonrpc":"2.0","id":1,"result":{
"protocolVersion":"2025-11-25",
"capabilities":{"tools":{},"resources":{},"prompts":{}},
"serverInfo":{"name":"ndorbit-example-server","version":"1.0.0"}
}}
// Client -> server; no response
{"jsonrpc":"2.0","method":"notifications/initialized"}
// Later, client -> server
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{
"name":"add","arguments":{"a":2,"b":3}
}}
// Server -> client
{"jsonrpc":"2.0","id":2,"result":{
"content":[{"type":"text","text":"5"}],
"structuredContent":{"result":5},"isError":false
}}
// MODERN: optional discovery, followed by an independent tool call.
// Comments are explanatory JSONC; remove them for raw JSON.
{"jsonrpc":"2.0","id":"d1","method":"server/discover","params":{
"_meta":{
"io.modelcontextprotocol/protocolVersion":"2026-07-28",
"io.modelcontextprotocol/clientCapabilities":{},
"io.modelcontextprotocol/clientInfo":{"name":"ndorbit-example-client","version":"1.0.0"}
}
}}
{"jsonrpc":"2.0","id":"d1","result":{
"resultType":"complete","supportedVersions":["2026-07-28"],
"capabilities":{"tools":{},"resources":{},"prompts":{}},
"ttlMs":60000,"cacheScope":"public",
"_meta":{"io.modelcontextprotocol/serverInfo":{"name":"ndorbit-example-server","version":"1.0.0"}}
}}
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{
"name":"add","arguments":{"a":2,"b":3},
"_meta":{
"io.modelcontextprotocol/protocolVersion":"2026-07-28",
"io.modelcontextprotocol/clientCapabilities":{},
"io.modelcontextprotocol/clientInfo":{"name":"ndorbit-example-client","version":"1.0.0"}
}
}}
{"jsonrpc":"2.0","id":3,"result":{
"resultType":"complete",
"content":[{"type":"text","text":"5"}],
"structuredContent":{"result":5},"isError":false
}}
Required modern metadata goes in params._meta on every request, including tools/list. Client identity is SHOULD, not MUST; version and client capabilities are required. A modern server rejects an unsupported version with -32022 and its supported list.
Transport and session handling
| Transport / era | Mechanics |
|---|---|
| stdio · both eras | The host launches a subprocess; stdin/stdout carry newline-delimited JSON-RPC. stderr is for logs. No HTTP OAuth handshake. A process relationship is not an HTTP session. |
| HTTP+SSE · deprecated | 2024 transport: the client opens an SSE endpoint that announces a separate POST endpoint. Keep only for compatibility; do not adopt in new systems. |
| Streamable HTTP · legacy | 2025-03-26 through 2025-11-25: a single MCP endpoint, POST with JSON or SSE response; optional GET back-channel; optional Mcp-Session-Id echoed on later calls; DELETE termination if supported. An expired session 404 requires a new initialize. Optional event-id resumption. |
| Streamable HTTP · modern | 2026-07-28: one endpoint, POST per request; JSON or request-scoped SSE response. No session id, GET back-channel, DELETE session lifecycle or Last-Event-ID resumption. subscriptions/listen provides opted-in change notifications through a POST response stream. |
POST /mcp HTTP/1.1
Content-Type: application/json
Accept: application/json, text/event-stream
MCP-Protocol-Version: 2026-07-28
Mcp-Method: tools/call
Mcp-Name: add
[body: the modern tools/call JSON above]
# Protected servers additionally require:
Authorization: Bearer <audience-bound-access-token>
Modern headers mirror the body: version, method and name (for tools/call, resources/read and prompts/get). Servers must reject mismatches. Optional x-mcp-header schema annotations mirror approved primitive arguments into Mcp-Param-* headers; never put secrets or personal information there. Structured output uses structuredContent and an optional outputSchema; ordinary output should also include serialised text for older consumers.
Return explicit opaque handles, such as a workflow id, and accept them as later tool arguments. Authorize each handle against the verified caller on every request. Design mutation tools with idempotency controls: neither a JSON-RPC id nor an HTTP retry guarantees exactly-once execution.
Where authorization fits
- MCP HTTP authorization is optional overall. A protected MCP server is an OAuth resource server, not necessarily the authorization server. Authorization happens at the transport boundary, before executing the RPC.
- The client discovers protected-resource metadata (RFC 9728), then the authorization server’s metadata. It obtains a client id through Client ID Metadata Documents, pre-registration or legacy Dynamic Client Registration.
- For a user flow, open the authorization server’s consent UI with PKCE and the MCP resource indicator, then exchange the code with its verifier. Validate the expected issuer, including a returned
iss, before redeeming the code. - Send the audience-bound token in
Authorization: Beareron every HTTP request, never in a query string. Validate audience, expiry, issuer and required permissions at the server. - Keep MCP access separate from server-to-upstream access. Acquire distinct downstream credentials; never blindly relay a client’s token to another API. Local stdio servers typically receive credentials through a controlled environment, not the HTTP OAuth flow.
The current authorization specification references OAuth 2.1 as an IETF draft, not a final RFC. Dynamic Client Registration remains available for compatibility but is deprecated in 2026-07-28; do not treat it as mandatory.
One tool, one resource,
one prompt.
Run with Python 3.13.5 and the official mcp 2.3.0 package. The same subprocess passed tools/list, tools/call, resources/list, resources/read, prompts/list and prompts/get in modern auto mode (2026-07-28) and legacy mode (2025-11-25). MCP Inspector CLI independently returned add(2, 3) = 5. No hosted LLM or cloud account was needed.
The official Python SDK v2 renamed FastMCP to MCPServer: from mcp.server import MCPServer. It keeps the decorator style. Do not mix it with v1’s from mcp.server.fastmcp import FastMCP, or confuse the official mcp distribution with the separate fastmcp package. The official TypeScript SDK is also on v2, split into @modelcontextprotocol/server and @modelcontextprotocol/client.
Set up a reproducible environment
mkdir mcp-example && cd mcp-example
python3 -m venv .venv
.venv/bin/python -m pip install "mcp[cli]==2.3.0"
# Save the next two blocks as server.py and smoke.py.
# Optional uv equivalent, if uv is installed:
# uv init --python 3.13
# uv add "mcp[cli]==2.3.0"
# uv run python smoke.py
from mcp.server import MCPServer
mcp = MCPServer("ND Orbit MCP example")
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two integers without side effects."""
return a + b
@mcp.resource("lesson://intro")
def intro() -> str:
"""Read a short lesson note."""
return "MCP connects a host's clients to tools, resources, and prompts."
@mcp.prompt()
def explain(topic: str) -> str:
"""Prepare a user-selected explanation request."""
return f"Explain {topic} to an engineer, with one concrete example."
if __name__ == "__main__":
mcp.run(transport="stdio")
The type annotations build the tool’s input schema; the int result is exposed as structuredContent with result equal to 5. The resource is read-only data. The prompt returns a reusable user request, not an already-generated answer. The server writes nothing to stdout itself: in stdio, stdout is the protocol pipe.
import asyncio
import sys
from pathlib import Path
from importlib.metadata import version
from mcp import Client, StdioServerParameters
async def check(mode: str) -> None:
params = StdioServerParameters(
command=sys.executable,
args=[str(Path(__file__).with_name("server.py"))],
)
async with Client(params, mode=mode) as client:
tools = await client.list_tools()
assert [t.name for t in tools.tools] == ["add"]
result = await client.call_tool("add", {"a": 2, "b": 3})
assert not result.is_error
assert result.structured_content == {"result": 5}
resources = await client.list_resources()
assert len(resources.resources) == 1
note = await client.read_resource("lesson://intro")
assert "MCP connects" in note.contents[0].text
prompts = await client.list_prompts()
assert [p.name for p in prompts.prompts] == ["explain"]
prompt = await client.get_prompt("explain", {"topic": "MCP"})
assert "Explain MCP" in prompt.messages[0].content.text
print(f"PASS mode={mode} protocol={client.protocol_version} "
f"mcp={version('mcp')} add={result.structured_content}")
async def main() -> None:
await check("auto")
await check("legacy")
if __name__ == "__main__":
asyncio.run(main())
.venv/bin/python smoke.py
# Observed output:
PASS mode=auto protocol=2026-07-28 mcp=2.3.0 add={'result': 5}
PASS mode=legacy protocol=2025-11-25 mcp=2.3.0 add={'result': 5}
The SDK v2 Client manages era detection and transport teardown; unlike older ClientSession examples, it does not call initialize explicitly. Python attributes are snake_case (is_error, structured_content); the wire JSON stays camelCase.
Inspect interactively and from the CLI
# Launch the browser Inspector with no target, or pass the server command:
npx @modelcontextprotocol/inspector
npx @modelcontextprotocol/inspector "$PWD/.venv/bin/python" "$PWD/server.py"
# CLI: list, then call
npx -y @modelcontextprotocol/inspector --cli "$PWD/.venv/bin/python" "$PWD/server.py" \
--method tools/list
npx -y @modelcontextprotocol/inspector --cli "$PWD/.venv/bin/python" "$PWD/server.py" \
--method tools/call --tool-name add --tool-arg a=2 --tool-arg b=3
- ConnectChoose stdio and the absolute
.venvPython executable plus theserver.pyargument. Inspector spawns the server; do not separately run a stdio server expecting an HTTP port. - Inspect the three server primitivesList tools and call
addwith a=2, b=3; list resources and readlesson://intro; list prompts and getexplainwith topic=MCP. Inspect the schemas and the JSON-RPC traffic. - Check errors and capability differencesTry a non-integer argument and inspect the failure. Compare the modern discovery flow with legacy initialize. Host UIs may expose only a subset of server primitives.
Use the private launch URL that Inspector prints. Do not publish its per-launch proxy token or disable proxy authentication.
Register it in a host
{
"mcpServers": {
"ndorbit-mcp-example": {
"command": "/absolute/path/mcp-example/.venv/bin/python",
"args": ["/absolute/path/mcp-example/server.py"]
}
}
}
In Claude Desktop, Settings → Developer → Edit Config opens claude_desktop_config.json. Merge the entry into mcpServers rather than overwriting other servers, replace both illustrative paths with real ones, then fully restart the host. Ask it to use add for 2 + 3, review any approval and verify the answer is 5. Resources and prompts may appear in different parts of the UI, or not at all: tool support alone does not imply full MCP support.
A standard pipe
is not a trusted one.
| Failure mode | Engineering response |
|---|---|
| stdio stdout pollution | No print or debug banners on server stdout: it is the protocol pipe. Log to stderr. |
| Tool poisoning / prompt injection | Descriptions, instructions, annotations and results can contain adversarial text. Treat them as untrusted data; a readOnlyHint or friendly description is not proof. Enforce allowlists and permissions outside the model. |
| Confused deputy | An OAuth proxy must bind consent to the actual requesting client and user; do not reuse another client’s prior third-party consent. Validate redirect URIs, state and PKCE; store tokens per verified identity. |
| Token passthrough · forbidden | Only accept tokens issued for this MCP resource. Never accept arbitrary upstream tokens and forward them unchanged. Separate client→MCP and MCP→upstream authorization. |
| Over-broad scopes | Start with minimal scopes; use explicit scope challenges for elevation. Validate permissions for each operation and object. A tool filter does not replace backend authorization. |
| DNS rebinding / local HTTP | Validate Origin on incoming HTTP connections; invalid present origins require 403. Bind local development servers to 127.0.0.1, validate Host as appropriate, and authenticate. CORS alone is not authentication. |
| Rug-pull tool changes | A previously approved name can gain a new schema, description or effect. Pin package versions, review tool-definition diffs, refresh discovery on changes and re-approve material changes. |
| Unsafe execution / exfiltration | Require human review of sensitive tool name, arguments, destination and effect. Read operations can exfiltrate data too. Sandbox local servers; minimise files, network access and environment variables. |
| SSRF during OAuth discovery | Validate metadata and redirect URLs; restrict egress to private and cloud-metadata destinations. A remote server’s OAuth URLs are untrusted input. |
| State and retries | Bind workflow handles and MRTR continuation state to caller and operation. Limit lifetimes; audit without secrets. Add timeouts, rate limits and idempotency; avoid double mutations after uncertain failures. |
Human-in-the-loop means a real ability to deny the actual operation, not an automatically accepted, model-generated confirmation. Elicitation is not a substitute for authorization. Form elicitation must never ask for passwords, API keys, access tokens or payment credentials.
MCP standardises the conversation.
It does not certify the server.
Even a perfectly implemented MCP server inherits its process privileges unless OS or container controls restrict it. Roots are not a sandbox. For running untrusted code safely, see the earlier field note, Give the agent a workbench .
Same idea,
different names.
Documentation checked 8 November 2026. Names identify architectural roles, not identical APIs or feature matrices. A platform advertising MCP does not necessarily support every primitive, auth mode, extension or protocol revision.
| Platform | Equivalent / MCP support |
|---|---|
| OpenAI functions + Agents SDK | Function calling: your app registers schemas, executes calls and returns output. The Agents SDK adds the loop and MCP clients for stdio, Streamable HTTP and legacy SSE; a hosted MCP tool delegates a remote connection to the Responses API. |
| AWS Bedrock Agents Classic | Action groups define OpenAPI or function schemas and invoke Lambda or return control to the app. Not itself an MCP endpoint. Classic entered maintenance and closed to new customers on 30 July 2026; prefer AgentCore for new work. |
| AWS AgentCore Gateway | A managed MCP façade and aggregator over OpenAPI, Lambda, Smithy and remote MCP targets, with separate inbound and outbound auth. |
| Microsoft Foundry Agent Service | Built-in, function and OpenAPI tools plus a remote MCP tool with server URL, label, project connections, allowlists and approval. Consumes remote endpoints, not local stdio subprocesses. |
| Open WebUI | In-process Python tools and external OpenAPI servers. Native MCP over Streamable HTTP; stdio and legacy SSE can be bridged into OpenAPI with mcpo. MCP server registration is admin-only. |
| Google ADK / Agent Platform | ADK function tools are direct functions; McpToolset imports external MCP tools over stdio or HTTP, and ADK can expose MCP. Check each managed service’s protocol support individually. |
| A2A | A complementary protocol for independent agents: discover an Agent Card, delegate tasks and exchange messages and artifacts while the remote agent keeps its own loop. Not a tool-invocation replacement. MCP can equip either agent. |
Roots, sampling, logging and Dynamic Client Registration are deprecated, not removed: they become eligible for removal no earlier than a revision on or after 28 July 2027.
MCP server FAQ.
What is an MCP server?
A program that exposes tools, resources and prompts to AI applications over the Model Context Protocol. It translates approved requests into calls to its own files, databases or APIs. It does not need an LLM of its own.
What is the difference between MCP and function calling?
Function calling is how one model API describes and requests a tool; your application executes it. MCP standardises how any host discovers and calls tools that live in separate servers, so one server works with many AI applications.
Is the initialize handshake still required?
Not in the current 2026-07-28 revision. Clients send the protocol version and capabilities with every request and may call server/discover. The initialize → notifications/initialized flow is the legacy path for 2025-11-25 and earlier.
Should my MCP server use stdio or Streamable HTTP?
Use stdio for a local server the host launches as a child process. Use Streamable HTTP for a remote, shared service; protect it as an OAuth resource server and validate the token audience on every request.
Who decides when a tool runs?
The model proposes a tool call, but the host decides: it checks policy, asks the user when required, and only then sends tools/call. The server must still validate inputs and permissions itself.
Is MCP the same as A2A?
No. MCP connects an agent to tools and data. A2A lets independent agents delegate tasks to each other while each keeps its own loop. They are complementary: an A2A agent may use MCP tools.
Try it: a bounded read-only file tool
Add read_note(relative_path: str) to server.py, before mcp.run. Use a fixed, server-configured notes directory, not a dependency on deprecated roots. Create a harmless hello.txt fixture. Resolve the base and candidate paths, reject absolute paths and candidates outside the base (including symlink escapes), allow only regular UTF-8 text files, and cap the read at 64 KiB before decoding. Return text or a clear tool error, never secrets or arbitrary system files.
- Test the happy pathRestart Inspector, refresh
tools/list, inspect the schema and readhello.txt. Add a smoke-client call that asserts the fixture content. - Test the boundaryVerify rejection of
../outside.txt, an absolute path, a symlink into an outside directory, a missing file and a file larger than 64 KiB. Confirm errors do not disclose unrelated paths or data. - Explain the security modelA resolve-and-contain check is useful for a trusted fixture, not a complete defence against adversarial filesystem races. In production, combine race-resistant file opening with an OS sandbox or read-only mount and restricted process privileges.
Read the source.
Primary documentation behind this article. Dated specification revisions distinguish current rules from historical examples; platform behaviour is documentation-verified, not deployed in each cloud.
- Model Context Protocol · Specification
Current and dated revisions, lifecycle, transports and authorization.
- Model Context Protocol · Documentation
Concepts, architecture, local host configuration and security guidance.
- Official Python SDK
MCPServer, Client and the v2 migration notes.
- Official TypeScript SDK
Server and client packages.
- MCP Inspector
Browser UI and CLI for testing servers.
- RFC 9728 · OAuth Protected Resource Metadata
How clients discover a protected MCP server’s authorization requirements.
- OpenAI · Function calling
Application-executed tool schemas.
- OpenAI Agents SDK · MCP
stdio, Streamable HTTP and hosted MCP tools.
- AWS · AgentCore Gateway
Managed MCP façade over APIs, Lambda and MCP targets.
- Microsoft Foundry · MCP tool
Connecting agents to remote MCP servers.
- Open WebUI · Documentation
Native MCP and OpenAPI tool servers.
- Google ADK · MCP tools
McpToolset and exposing ADK tools over MCP.
- A2A protocol
Agent-to-agent delegation and its relationship to MCP.
