Home โ€บ Blog โ€บ MCP and Tool Ecosystems
Deep Dive ยท With a from-scratch MCP server ๐Ÿ”Œ

MCP and Tool Ecosystems: How Agents Discover, Connect to and Use External Capabilities

Every agent needs tools, and without a standard every tool integration is custom โ€” built again for each model, app and runtime. The Model Context Protocol is the open standard that fixes this: a server exposes tools, resources and prompts once, and any compatible host can discover and use them. This piece explains the protocol as it actually works on the wire โ€” components, schemas, discovery, the call flow, transports, authorization and security โ€” using an MCP server written from the specification in plain Python, verified against the official SDK.

How to read this: protocol details are from the MCP specification (current version 2025-11-25) and its official blog. "Our run" output comes from the scripts in Run It Yourself: a server and a host written without any SDK, and a check that the official MCP Python SDK can talk to that server. Several details in the source infographic differ from the specification; they're corrected in place and listed in Corrections. This is the fourteenth piece in the How LLMs Are Built series, following Tool and Function Calling.

Why MCP

Without a standard

Every tool integration is custom ยท hard to maintain and scale ยท inconsistent interfaces and authentication ยท duplicated effort for each model and runtime ยท limited tool discovery ยท security and governance get harder with every integration.

What MCP provides

A standard, model-friendly interface ยท discovery of tools and resources ยท consistent schemas for tools, resources and prompts ยท easier integration with many data sources and apps ยท better permissions and governance ยท works across models, agents and platforms.

The economics are the point: with M applications and N tools, custom integration needs up to M ร— N connectors; with a shared protocol each side implements it once, M + N. Anthropic released MCP as an open standard in November 2024. In December 2025 it was donated to the Agentic AI Foundation, a Linux Foundation fund co-founded by Anthropic, Block and OpenAI, so the protocol now has vendor-neutral governance.

High-Level Architecture

Follow the goal "Review the latest customer escalation and prepare a response":

  1. The agent (the model and its planning loop) decides what capability is needed and which tool to use.
  2. The MCP host โ€” the application running the agent, such as a desktop assistant or IDE โ€” manages the session, permissions, context and tool access.
  3. For each server it connects to, the host runs an MCP client, which maintains that connection, handles discovery and exchanges structured requests and responses.
  4. MCP servers expose capabilities from real systems: file systems, databases, SaaS applications (CRM, email, calendar) and custom internal tools.
  5. Structured results (tool outputs, resources, data) flow back, and the host updates the agent's context and state so it can continue the plan or produce a final result.

One detail the source infographic gets wrong: it draws a single MCP client fanning out to four servers. In the specification each client keeps a one-to-one connection with one server; a host that uses four servers runs four clients. That isolation is deliberate โ€” each connection has its own capabilities, credentials and lifecycle.

MCP Components

ComponentRole
HostThe application running the agent: user session and context, permissions and policy, manages clients
ClientOne per server connection: handshake, capability discovery, requests and responses
ServerExposes tools, resources and prompts; translates between MCP and an external system; handles its own authentication; local or remote
Tools (actions)Executable operations with a name, description and input schema; can read or modify external systems. Model-controlled: the model decides to call them.
Resources (data)Readable context โ€” files, records, schemas, logs โ€” identified by URI. Application-controlled: the host decides what to read into context.
Prompts (templates)Reusable prompt patterns with arguments for common tasks. User-controlled: typically chosen by the user, for example as a slash command.

Clients can offer features to servers too: sampling (a server asks the host's model to generate text), roots (which directories a server may work in) and elicitation (a server asks the user for more information).

What It Looks Like on the Wire

MCP messages are JSON-RPC 2.0. Every session starts with a handshake: the client sends initialize with the protocol version it wants and its capabilities; the server answers with the version it will use and what it offers; the client confirms with an notifications/initialized notification. Then discovery. This is our client connecting to our CRM server over stdio โ€” the exact bytes exchanged:

-> {"jsonrpc": "2.0", "method": "initialize", "params": {"protocolVersion": "2025-11-25", "capabilities": {}, "clientInfo": {"name": "demo-host", "version": "0.1"}}, "id": 1}
<- {"jsonrpc": "2.0", "id": 1, "result": {"protocolVersion": "2025-11-25", "capabilities": {"tools": {}, "resources": {}}, "serverInfo": {"name": "crm-server", "version": "0.1.0"}}}
-> {"jsonrpc": "2.0", "method": "notifications/initialized"}
-> {"jsonrpc": "2.0", "method": "tools/list", "id": 2}
<- {"jsonrpc": "2.0", "id": 2, "result": {"tools": [{"name": "get_ticket", "description": "Get a support ticket with its conversation history.", "inputSchema": {"type": "object", "properties": {"ticket_id": {"type": "string"}}, "required": ["ticket_id"]}, "annotations": {"readOnlyHint": true, "destructiveHint": false}}, {"name": "get_account", "description": "Get a customer account: plan, status, spend.", "inputSchema": {"type": "object", "properties": {"customer_id": {"type": "string"}}, "required": ["customer_id"]}, "annotations": {"readOnlyHint": true, "destructiveHint": false}, "outputSchema": {"type": "object", "properties": {"name": {"type": "string"}, "plan": {"type": "string"}, "status": {"type": "string"}, "monthly_spend": {"type": "number"}}}}]}}
-> {"jsonrpc": "2.0", "method": "resources/list", "id": 3}
<- {"jsonrpc": "2.0", "id": 3, "result": {"resources": [{"uri": "crm://contracts/C-77", "name": "Acme Dental contract", "mimeType": "text/plain"}]}}

The server offered tools and resources but not prompts, so the client didn't ask for prompts โ€” capabilities negotiated at the start decide which methods are used later.

Tool, Resource and Prompt Schemas

From our server, in the specification's field names (camelCase):

Tool
name, description, inputSchema (JSON Schema), optional outputSchema for structured results, and optional annotations โ€” hints such as readOnlyHint and destructiveHint that a host can use to auto-approve safe tools and flag risky ones. Results return content (text, images and more) and, with an output schema, structuredContent.
Resource and prompt
A resource has a uri (for example crm://contracts/C-77), a name, and a mimeType; resources/read returns its contents. A prompt has a name, description and a list of arguments; prompts/get fills them in and returns ready-to-use messages for the model.

Annotations are hints, not guarantees โ€” the specification says hosts must not trust them from untrusted servers โ€” so a host policy should treat an unannotated or untrusted tool as risky.

Capability Discovery

Agents learn what's available at runtime: connect to a server (over stdio or HTTP), read its metadata (name, version) and capabilities from initialize, list tools, resources and prompts, inspect their schemas, and cache the results for tool routing and planning. Servers can notify clients when their list changes (notifications/tools/list_changed), so a cache can be refreshed. In our run the host discovered two servers โ€” a CRM server with get_ticket, get_account and a contract resource, and an email server with send_email and a draft_support_response prompt โ€” and built one tool registry from both.

Tool Invocation Flow

  1. The agent decides to use a tool, based on the plan and the available capabilities.
  2. The host selects the server and tool (for example Slack โ†’ send_message).
  3. Arguments are validated against the input schema.
  4. The client sends a tools/call request via JSON-RPC.
  5. The server executes it against the external system.
  6. It returns a structured response โ€” success or error.
  7. The host adds the result to the agent's context and updates state.
  8. The agent continues the plan or replans.

From the model's side, MCP tools usually arrive through the model API's own function-calling interface: the host converts each MCP tool into a function definition, and converts the model's function call into tools/call. MCP standardizes the connection between host and tools; function calling is how the model asks.

A Multi-Server Workflow

The source infographic's example โ€” review a customer escalation and draft a response โ€” uses a CRM, a document store, a database, web search and email. Our run implements it with two servers:

3) workflow: 'Review the latest customer escalation and prepare a response'
   get_ticket -> Refund not received (high), customer C-77
   get_account -> {'name': 'Acme Dental', 'plan': 'Enterprise', 'status': 'active', 'monthly_spend': 1200}
   resources/read crm://contracts/C-77 -> 'Enterprise plan. Refunds are processed within 10 business days of approval. Escalations answered within 24 hours.'
   prompts/get draft_support_response -> 1 message(s) for the model:
      You are a support agent. Using this context, draft a professional, empathetic reply: Refund not received; history ['Mar 3: customer reports missing re...
   send_email to the customer (approved) -> sent to ops@acmedental.example
   send_email to an outside address -> blocked by host policy

Each step used a different MCP feature: two tools for the ticket and account, a resource for the contract, a prompt template for the draft, and a tool again to send it. The host approved send_email to the customer's own domain and blocked it to an outside address โ€” a policy it applied because the tool is annotated destructiveHint: true.

Transports, Authentication and Permissions

MCP defines two standard transports: stdio, where the host launches the server as a local subprocess and they exchange messages over standard input and output (what our run uses), and Streamable HTTP, where the server runs independently and can serve many clients, optionally streaming with server-sent events.

For HTTP servers, the specification's authorization is based on OAuth 2.1: the MCP server acts as an OAuth resource server and the client obtains an access token from an authorization server. Local stdio servers take credentials from their environment instead. Enterprises layer their usual methods on top โ€” API keys for simple services, service accounts for server-to-server calls, single sign-on (SAML, OIDC). Whatever the method, apply the same permission principles: separate read and write capabilities, least privilege, scoped permissions per tool, user consent for sensitive actions, tenant and data isolation, audit logging. Set approval boundaries by risk โ€” approve once, per session, or per action.

Error Handling and Resilience

MCP distinguishes two kinds of error, and our run shows both:

Tool execution errors
Returned as a normal result with isError: true and a message the model can read and act on โ€” "No such ticket", "Missing required argument(s): ['subject', 'body']". The model can correct itself.
Protocol errors
Standard JSON-RPC errors for problems the model shouldn't have caused: an unknown tool (-32602), an unknown resource (-32002), an unknown method (-32601). The host handles these.

Around them, the usual resilience patterns: refresh the tool list when a capability is missing, regenerate on schema validation errors, refresh expired tokens, retry rate-limited calls with backoff, fail over to an alternate server, set timeouts, and degrade gracefully โ€” use an alternate tool or tell the user.

Security Considerations

A tool ecosystem is a supply chain: every server you connect can see requests, return content into the model's context, and act in the world. Practices: least-privilege permissions; validate and sanitize tool inputs and outputs; treat tool output as untrusted, because it can carry prompt injection; isolate credentials and use secure storage; enforce data-access policies and tenant boundaries; monitor and audit all tool usage; require human approval for sensitive actions; rotate credentials regularly. MCP-specific risks to know by name: tool poisoning (instructions hidden in a tool's description, which the model reads), changed definitions after a user has approved a server, and token passthrough โ€” a server forwarding the client's token to another service, which the specification forbids. Only connect servers you trust, and review what each one can do.

MCP vs Other Approaches

ApproachWhat it isBest for
MCPA standard protocol between hosts and tool/data servers, with runtime discovery of tools, resources and promptsAgents using many tools and systems; reusing one integration across apps and models
Function callingHow a model API lets the model request a call; tools are defined per requestSimple integrations inside one application โ€” and the layer MCP tools are usually delivered through
Direct API integrationCustom code calling a system's APIOne app, one system, full control
RAGRetrieving documents into the contextRead-only knowledge โ€” and it can itself be exposed as an MCP tool or resource

These aren't really rivals: a typical agent uses function calling to let the model choose, MCP to reach the tools, and RAG behind some of those tools.

Production Deployment and Observability

In production, users (web, API, IDE) talk to agent runtimes, which reach MCP servers โ€” file, database, SaaS, internal API and custom-tool servers โ€” in front of storage, databases, SaaS applications, internal services and third-party APIs. Many organizations add an MCP gateway in between to centralize policy, authentication, routing and observability; that's a common deployment pattern, not part of the protocol. Observability and governance: log all tool calls, arguments and results; track latency, success rate and error rates; monitor token usage and cost per tool and agent; audit user and agent access patterns; set usage limits and quotas; detect anomalous activity; trace across multi-step workflows; and build dashboards and alerts.

MCP in one paragraph
MCP is an open JSON-RPC protocol that lets any compatible host connect to any compatible server: after an initialize handshake that negotiates version and capabilities, the host's client discovers the server's tools (actions the model can call), resources (data the application can read) and prompts (templates users can pick), with JSON Schemas and behaviour hints. It runs locally over stdio or remotely over Streamable HTTP with OAuth 2.1, reports tool failures as readable results and protocol failures as JSON-RPC errors, and turns M ร— N custom integrations into M + N. It standardizes the plumbing; permissions, approval, auditing and trust in each server remain the host's job.

Run It Yourself

Three files. The server and the host use only the Python standard library โ€” no SDK โ€” so every protocol message is visible. The third connects the official MCP Python SDK's client to our server, as an independent check that the hand-written server follows the protocol.

mcp_server.py โ€” an MCP server over stdio:

"""A minimal MCP server over stdio, written from the specification with no SDK.

Messages are JSON-RPC 2.0, one per line on stdin/stdout. Implements: initialize, ping, tools/list,
tools/call, resources/list, resources/read, prompts/list, prompts/get. Run as `mcp_server.py crm` or
`mcp_server.py email` to get one of two example servers.
"""
import json, sys

KIND = sys.argv[1] if len(sys.argv) > 1 else "crm"
SUPPORTED = ["2025-11-25", "2025-06-18", "2025-03-26"]

TICKETS = {"T-1042": {"customer": "C-77", "subject": "Refund not received", "priority": "high",
                      "history": ["Mar 3: customer reports missing refund", "Mar 5: agent promised update in 48h"]}}
ACCOUNTS = {"C-77": {"name": "Acme Dental", "plan": "Enterprise", "status": "active", "monthly_spend": 1200}}
SENT = []

def tool(name, desc, props, required, read_only, out=None):
    t = {"name": name, "description": desc,
         "inputSchema": {"type": "object", "properties": props, "required": required},
         "annotations": {"readOnlyHint": read_only, "destructiveHint": not read_only}}
    if out: t["outputSchema"] = out
    return t

SERVERS = {
    "crm": {
        "tools": [tool("get_ticket", "Get a support ticket with its conversation history.",
                       {"ticket_id": {"type": "string"}}, ["ticket_id"], True),
                  tool("get_account", "Get a customer account: plan, status, spend.",
                       {"customer_id": {"type": "string"}}, ["customer_id"], True,
                       {"type": "object", "properties": {"name": {"type": "string"}, "plan": {"type": "string"},
                        "status": {"type": "string"}, "monthly_spend": {"type": "number"}}})],
        "resources": [{"uri": "crm://contracts/C-77", "name": "Acme Dental contract", "mimeType": "text/plain"}],
        "prompts": [],
    },
    "email": {
        "tools": [tool("send_email", "Send an email to a customer.", {"to": {"type": "string"}, "subject": {"type": "string"},
                       "body": {"type": "string"}}, ["to", "subject", "body"], False)],
        "resources": [],
        "prompts": [{"name": "draft_support_response", "description": "Draft a professional reply to a customer.",
                     "arguments": [{"name": "context", "description": "Ticket and account details", "required": True}]}],
    },
}
S = SERVERS[KIND]
CONTRACT = "Enterprise plan. Refunds are processed within 10 business days of approval. Escalations answered within 24 hours."

def call_tool(name, args):
    if name == "get_ticket":
        t = TICKETS.get(args.get("ticket_id"))
        if not t: return {"content": [{"type": "text", "text": "No such ticket"}], "isError": True}
        return {"content": [{"type": "text", "text": json.dumps(t)}], "structuredContent": t}
    if name == "get_account":
        a = ACCOUNTS.get(args.get("customer_id"))
        if not a: return {"content": [{"type": "text", "text": "No such customer"}], "isError": True}
        return {"content": [{"type": "text", "text": json.dumps(a)}], "structuredContent": a}
    if name == "send_email":
        SENT.append(args); return {"content": [{"type": "text", "text": f"sent to {args['to']}"}]}

def handle(msg):
    m, p = msg.get("method"), msg.get("params", {})
    if m == "initialize":
        v = p.get("protocolVersion"); v = v if v in SUPPORTED else SUPPORTED[0]     # version negotiation
        caps = {k: {} for k in ("tools", "resources", "prompts") if S[k]}
        return {"protocolVersion": v, "capabilities": caps, "serverInfo": {"name": f"{KIND}-server", "version": "0.1.0"}}
    if m == "ping": return {}
    if m == "tools/list": return {"tools": S["tools"]}
    if m == "tools/call":
        spec = next((t for t in S["tools"] if t["name"] == p.get("name")), None)
        if not spec: raise ValueError(-32602, f"Unknown tool: {p.get('name')}")          # protocol error
        args = p.get("arguments", {})
        missing = [r for r in spec["inputSchema"]["required"] if r not in args]
        if missing:                                                                     # tool execution error
            return {"content": [{"type": "text", "text": f"Missing required argument(s): {missing}"}], "isError": True}
        return call_tool(spec["name"], args)
    if m == "resources/list": return {"resources": S["resources"]}
    if m == "resources/read":
        if p.get("uri") != "crm://contracts/C-77": raise ValueError(-32002, "Resource not found")
        return {"contents": [{"uri": p["uri"], "mimeType": "text/plain", "text": CONTRACT}]}
    if m == "prompts/list": return {"prompts": S["prompts"]}
    if m == "prompts/get":
        ctx = p.get("arguments", {}).get("context", "")
        return {"description": "Support reply", "messages": [{"role": "user", "content": {"type": "text",
                "text": f"You are a support agent. Using this context, draft a professional, empathetic reply:\n{ctx}"}}]}
    raise ValueError(-32601, f"Method not found: {m}")

for line in sys.stdin:
    msg = json.loads(line)
    if "id" not in msg: continue                                    # notifications (e.g. notifications/initialized)
    try: reply = {"jsonrpc": "2.0", "id": msg["id"], "result": handle(msg)}
    except ValueError as e: reply = {"jsonrpc": "2.0", "id": msg["id"], "error": {"code": e.args[0], "message": e.args[1]}}
    sys.stdout.write(json.dumps(reply) + "\n"); sys.stdout.flush()

mcp_lab.py โ€” a host with one client per server, running the workflow:

"""An MCP host + client, written from the specification with no SDK, running a multi-server workflow.

The host launches two MCP servers as subprocesses (stdio transport), performs the initialize handshake,
discovers their tools/resources/prompts, and runs a customer-escalation workflow. It enforces a host policy
from tool annotations: read-only tools run automatically, destructive tools need user approval.
The planner is scripted (it issues the calls an agent would). Standard library only.
"""
import json, subprocess, sys, time

class MCPClient:
    """One client per server connection, as the MCP architecture prescribes."""
    def __init__(self, name, show_wire=False):
        self.name, self.show, self.next_id = name, show_wire, 0
        self.proc = subprocess.Popen([sys.executable, "mcp_server.py", name], stdin=subprocess.PIPE,
                                     stdout=subprocess.PIPE, text=True, bufsize=1)
    def send(self, method, params=None, notify=False):
        msg = {"jsonrpc": "2.0", "method": method}
        if params is not None: msg["params"] = params
        if not notify: self.next_id += 1; msg["id"] = self.next_id
        line = json.dumps(msg)
        if self.show: print(f"   -> {line}")
        self.proc.stdin.write(line + "\n")
        if notify: return None
        reply = self.proc.stdout.readline()
        if self.show: print(f"   <- {reply.strip()}")
        reply = json.loads(reply)
        if "error" in reply: raise RuntimeError(f"JSON-RPC error {reply['error']['code']}: {reply['error']['message']}")
        return reply["result"]
    def connect(self):
        r = self.send("initialize", {"protocolVersion": "2025-11-25", "capabilities": {},
                                     "clientInfo": {"name": "demo-host", "version": "0.1"}})
        self.send("notifications/initialized", notify=True)
        self.info, self.caps = r["serverInfo"], r["capabilities"]
        self.tools = self.send("tools/list")["tools"] if "tools" in self.caps else []
        self.resources = self.send("resources/list")["resources"] if "resources" in self.caps else []
        self.prompts = self.send("prompts/list")["prompts"] if "prompts" in self.caps else []
        return r
    def close(self): self.proc.stdin.close(); self.proc.wait()

class Host:
    """Owns the connections, the tool registry, the permission policy and the audit log."""
    def __init__(self, approve): self.clients, self.registry, self.audit, self.approve = {}, {}, [], approve
    def add(self, client):
        client.connect(); self.clients[client.name] = client
        for t in client.tools: self.registry[t["name"]] = (client, t)
    def call(self, tool, args):
        client, spec = self.registry[tool]
        destructive = spec.get("annotations", {}).get("destructiveHint", True)       # unannotated = assume risky
        if destructive and not self.approve(tool, args):
            self.audit.append((tool, "blocked: user did not approve")); return None
        t = time.perf_counter(); r = client.send("tools/call", {"name": tool, "arguments": args})
        ms = (time.perf_counter() - t) * 1000
        self.audit.append((tool, f"{'error' if r.get('isError') else 'ok'} in {ms:.1f} ms"))
        return r

print("1) connect: the initialize handshake and discovery, on the wire (crm server)")
crm = MCPClient("crm", show_wire=True)
host = Host(approve=lambda tool, args: args.get("to", "").endswith("@acmedental.example"))
host.add(crm); crm.show = False
host.add(MCPClient("email"))
print("\n2) capability discovery across servers")
for c in host.clients.values():
    print(f"   {c.info['name']}: tools {[t['name'] for t in c.tools]}, resources {[r['uri'] for r in c.resources]}, "
          f"prompts {[p['name'] for p in c.prompts]}")
print("   annotations:", {n: s['annotations'] for n, (_, s) in host.registry.items()})

print("\n3) workflow: 'Review the latest customer escalation and prepare a response'")
ticket = host.call("get_ticket", {"ticket_id": "T-1042"})["structuredContent"]
print(f"   get_ticket -> {ticket['subject']} ({ticket['priority']}), customer {ticket['customer']}")
account = host.call("get_account", {"customer_id": ticket["customer"]})["structuredContent"]
print(f"   get_account -> {account}")
contract = crm.send("resources/read", {"uri": "crm://contracts/C-77"})["contents"][0]["text"]
print(f"   resources/read crm://contracts/C-77 -> {contract!r}")
prompt = host.clients["email"].send("prompts/get", {"name": "draft_support_response", "arguments":
         {"context": f"{ticket['subject']}; history {ticket['history']}; plan {account['plan']}; contract: {contract}"}})
print(f"   prompts/get draft_support_response -> {len(prompt['messages'])} message(s) for the model:")
print("      " + prompt["messages"][0]["content"]["text"][:150].replace("\n", " ") + "...")
draft = ("We're sorry your refund is late. Under your Enterprise contract, refunds are processed within "
         "10 business days of approval; we've escalated yours and will confirm within 24 hours.")   # the model's draft
r = host.call("send_email", {"to": "ops@acmedental.example", "subject": "Your refund (T-1042)", "body": draft})
print(f"   send_email to the customer (approved) -> {r['content'][0]['text']}")
r = host.call("send_email", {"to": "someone@elsewhere.example", "subject": "Refund data", "body": draft})
print(f"   send_email to an outside address -> {'blocked by host policy' if r is None else r}")

print("\n4) errors")
r = host.call("get_ticket", {"ticket_id": "T-9999"}); print(f"   unknown ticket -> isError={r['isError']}: {r['content'][0]['text']}")
r = host.call("send_email", {"to": "ops@acmedental.example"}); print(f"   missing arguments -> isError={r['isError']}: {r['content'][0]['text']}")
try: crm.send("tools/call", {"name": "delete_account", "arguments": {}})
except RuntimeError as e: print(f"   unknown tool -> {e}")
try: crm.send("resources/read", {"uri": "crm://contracts/NOPE"})
except RuntimeError as e: print(f"   unknown resource -> {e}")

print("\n5) audit log")
for tool, status in host.audit: print(f"   {tool:<12} {status}")
for c in host.clients.values(): c.close()

Output:

1) connect: the initialize handshake and discovery, on the wire (crm server)
   -> {"jsonrpc": "2.0", "method": "initialize", "params": {"protocolVersion": "2025-11-25", "capabilities": {}, "clientInfo": {"name": "demo-host", "version": "0.1"}}, "id": 1}
   <- {"jsonrpc": "2.0", "id": 1, "result": {"protocolVersion": "2025-11-25", "capabilities": {"tools": {}, "resources": {}}, "serverInfo": {"name": "crm-server", "version": "0.1.0"}}}
   -> {"jsonrpc": "2.0", "method": "notifications/initialized"}
   -> {"jsonrpc": "2.0", "method": "tools/list", "id": 2}
   <- {"jsonrpc": "2.0", "id": 2, "result": {"tools": [{"name": "get_ticket", "description": "Get a support ticket with its conversation history.", "inputSchema": {"type": "object", "properties": {"ticket_id": {"type": "string"}}, "required": ["ticket_id"]}, "annotations": {"readOnlyHint": true, "destructiveHint": false}}, {"name": "get_account", "description": "Get a customer account: plan, status, spend.", "inputSchema": {"type": "object", "properties": {"customer_id": {"type": "string"}}, "required": ["customer_id"]}, "annotations": {"readOnlyHint": true, "destructiveHint": false}, "outputSchema": {"type": "object", "properties": {"name": {"type": "string"}, "plan": {"type": "string"}, "status": {"type": "string"}, "monthly_spend": {"type": "number"}}}}]}}
   -> {"jsonrpc": "2.0", "method": "resources/list", "id": 3}
   <- {"jsonrpc": "2.0", "id": 3, "result": {"resources": [{"uri": "crm://contracts/C-77", "name": "Acme Dental contract", "mimeType": "text/plain"}]}}

2) capability discovery across servers
   crm-server: tools ['get_ticket', 'get_account'], resources ['crm://contracts/C-77'], prompts []
   email-server: tools ['send_email'], resources [], prompts ['draft_support_response']
   annotations: {'get_ticket': {'readOnlyHint': True, 'destructiveHint': False}, 'get_account': {'readOnlyHint': True, 'destructiveHint': False}, 'send_email': {'readOnlyHint': False, 'destructiveHint': True}}

3) workflow: 'Review the latest customer escalation and prepare a response'
   get_ticket -> Refund not received (high), customer C-77
   get_account -> {'name': 'Acme Dental', 'plan': 'Enterprise', 'status': 'active', 'monthly_spend': 1200}
   resources/read crm://contracts/C-77 -> 'Enterprise plan. Refunds are processed within 10 business days of approval. Escalations answered within 24 hours.'
   prompts/get draft_support_response -> 1 message(s) for the model:
      You are a support agent. Using this context, draft a professional, empathetic reply: Refund not received; history ['Mar 3: customer reports missing re...
   send_email to the customer (approved) -> sent to ops@acmedental.example
   send_email to an outside address -> blocked by host policy

4) errors
   unknown ticket -> isError=True: No such ticket
   missing arguments -> isError=True: Missing required argument(s): ['subject', 'body']
   unknown tool -> JSON-RPC error -32602: Unknown tool: delete_account
   unknown resource -> JSON-RPC error -32002: Resource not found

5) audit log
   get_ticket   ok in 0.2 ms
   get_account  ok in 0.1 ms
   send_email   ok in 0.1 ms
   send_email   blocked: user did not approve
   get_ticket   error in 0.2 ms
   send_email   error in 0.1 ms

sdk_check.py โ€” the official SDK (pip install mcp) talking to our server:

"""Conformance check: connect the official MCP Python SDK client to our hand-written server."""
import asyncio, importlib.metadata, sys
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

async def main():
    params = StdioServerParameters(command=sys.executable, args=["mcp_server.py", "crm"])
    async with stdio_client(params) as (read, write):
        async with ClientSession(read, write) as session:
            init = await session.initialize()
            print(f"official SDK {importlib.metadata.version('mcp')} connected to {init.server_info.name}; "
                  f"negotiated protocol {init.protocol_version}")
            tools = await session.list_tools()
            print("tools:", [t.name for t in tools.tools])
            r = await session.call_tool("get_account", {"customer_id": "C-77"})
            print("get_account structuredContent:", r.structured_content, "is_error:", r.is_error)
            res = await session.read_resource("crm://contracts/C-77")
            print("resource text:", res.contents[0].text[:60] + "...")
asyncio.run(main())

Output:

official SDK 2.2.0 connected to crm-server; negotiated protocol 2025-11-25
tools: ['get_ticket', 'get_account']
get_account structuredContent: {'name': 'Acme Dental', 'plan': 'Enterprise', 'status': 'active', 'monthly_spend': 1200} is_error: False
resource text: Enterprise plan. Refunds are processed within 10 business da...

โš ๏ธ Corrections to the Source Infographic

  • Field names. Its tool schema uses input_schema and output_schema, and its resource schema mime_type. The MCP specification uses camelCase: inputSchema, outputSchema, mimeType. (input_schema is the Anthropic Messages API's name for tool definitions โ€” a different interface.)
  • Prompt schema. It shows a prompt with a template string containing {{context}}. MCP prompts declare arguments; the server fills them in and prompts/get returns finished messages. There is no template field.
  • Resource schema. Its metadata.fields block isn't part of the resource definition, which has uri, name, optional description and mimeType (and a few other optional fields).
  • One client per server. The architecture shows one MCP client connected to four servers; hosts run one client per server connection.
  • Authorization. It lists "OAuth 2.0 (for SaaS applications)". MCP's HTTP authorization is based on OAuth 2.1; stdio servers use credentials from the environment.
  • MCP vs function calling. The comparison table presents them as alternatives; in practice MCP tools are usually exposed to the model through function calling.
  • MCP gateway is a deployment pattern, not a protocol component.
Checked against sources: the MCP specification (2025-11-25: stdio and Streamable HTTP transports, JSON-RPC 2.0 messages, initialize and capability negotiation, tools with inputSchema/outputSchema/structuredContent/annotations, resources, prompts, OAuth 2.1 authorization for HTTP); the MCP blog and Linux Foundation announcement of the Agentic AI Foundation (December 9, 2025); Anthropic's original MCP announcement (November 2024). All "our run" output is real, including the official SDK check.

๐Ÿ”— References