Pocketbook No. 2 — AI Agents in Practice

MCP in Production 2026

How to Ship Model Context Protocol Servers That Are Secure, Governed, and Reliable

By Leandro Calado Ferreira · Free reading · English · December 2026

Introduction: MCP Stopped Being a Demo

Something changed about the Model Context Protocol in 2026, and it was not a new model.

It was a change of job.

For its first two years, MCP was the easy way to connect an agent to a tool. You wrote a server, exposed a few tools, and watched an agent call them from a laptop. It worked, and it was exciting, because for the first time every agent spoke the same protocol to reach the same tools.

In 2026, MCP became infrastructure. The protocol is now governed by the Agentic AI Foundation, under the Linux Foundation, and its biggest revision since launch — specification 2026-07-28 — rebuilt the core as a stateless request/response protocol. Sessions are gone. The handshake is gone. Tasks and MCP Apps moved into a versioned extensions framework. Authorization was hardened toward deployed OAuth 2.1 practice.

That is the moment a protocol stops being a demo and starts being something a platform team has to operate: with identities, scopes, registries, audit logs, and a rollback plan.

This pocketbook is a practical introduction to that shift. It is short on purpose. You will not learn the full specification here. You will learn what changed, why it matters, and how to ship one MCP server that is secure, governed, and reliable — and then a second one, the same way.

By the end, you will have a stateless server, a task that runs in the background, a skill that travels with the server, and the three checks that decide whether a tool is allowed to run at all.

Want the full version of this story?

The protocol in depth, the patterns for n8n orchestration, and the harness that keeps agents alive in production are in the author’s full books on Amazon. This pocketbook is the taste. The books are the meal.

Browse Leandro Calado Ferreira’s books on Amazon →

Chapter 1. What Changed in MCP in 2026

A protocol becomes infrastructure the day you can no longer restart it by hand.

That day arrived for MCP in 2026. The protocol, introduced by Anthropic in November 2024, is now two years old, under neutral governance, and carrying enough ecosystem weight that every change has real adoption consequences. Anthropic reported more than 700 million monthly SDK downloads in late 2026, and more than 10,000 connectors for Claude — numbers that say, in plain language, that this is no longer an experiment.

Three changes matter most. Learn them in this order, because each one fixes a problem the previous version left open.

1. The core went stateless.

The 2026-07-28 specification — the third major revision, and the largest since launch — removes the session layer entirely. There is no initialize / initialized handshake, and no Mcp-Session-Id header. Every request carries its own protocol version and client information in _meta, and a new server/discover method lets a client fetch a server’s capabilities whenever it needs them.

That sounds like a small protocol detail. It is not. It means any server instance can answer any request. Plain round-robin load balancing works. A server can run on Lambda, on Workers, behind any load balancer, with no sticky sessions. Your MCP server finally scales like an ordinary web service.

2. Tasks and MCP Apps graduated to official extensions.

Tasks and MCP Apps left the experimental core and became versioned extensions, with reverse-DNS identifiers such as io.modelcontextprotocol/tasks, and independently versioned releases. The core can stay boring while product surfaces innovate.

Tasks are for long-running work: create the work, poll for its status, cancel it cooperatively if you need to — instead of holding a connection open for twenty minutes. MCP Apps are for interfaces: a server can send back interactive HTML that the host renders inside a sandboxed iframe, instead of dumping a wall of text into the model’s context.

3. Authorization was hardened, and the deprecation clock started.

Authorization moved toward deployed OAuth 2.1 practice across several specification proposals. Dynamic Client Registration is deprecated in favor of CIMD — client ID metadata documents — and the protocol gained a formal deprecation lifecycle. Roots, Sampling, Logging, and Dynamic Client Registration became eligible for removal no earlier than a revision released on or after July 28, 2027.

In practice, that means: if you shipped against the 2025-11-25 experimental Tasks API, you have a migration to do. If you relied on mid-request callbacks from the server back to the client — sampling the model, eliciting input, querying roots — that pattern is gone, replaced by Multi Round-Trip Requests: the server returns a result, and the client makes a follow-up call.

The rule for this book: treat MCP like a public API you operate, not like a plugin you installed. Version it, scope it, log it, and be able to turn one tool off without turning the whole server off.

Chapter 2. Stateless by Design: Architecture That Scales Like a Web Service

You do not need a new platform to ship a stateless MCP server. You need to stop keeping state where the protocol used to keep it for you.

Here is the mental model, in one request.

POST /mcp HTTP/1.1
MCP-Protocol-Version: 2026-07-28
Mcp-Method: tools/call
Mcp-Name: search
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "req-42",
  "method": "tools/call",
  "params": {
    "name": "search",
    "arguments": {"query": "failed Databricks jobs today"},
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientInfo": {"name": "data-agent", "version": "1.4.0"}
    }
  }
}

Three things to notice, because each one changes how you deploy:

No handshake, no session. There is no initialize call before this request, and no session ID to store, expire, or lose when a container restarts. Each request is self-describing. That is what makes the server serverless-ready: any instance can answer, and a load balancer does not need to remember anything.

Routing by header. Requests route on Mcp-Method and Mcp-Name headers. List and resource-read results now carry cache hints — ttlMs and cacheScope — so a client can cache a tool list or a resource without asking again. Use them. A tool list that changes once a week should not be fetched on every call.

State, when you need it, is explicit. Applications that need state across calls can mint an explicit handle — a basket_id, a ticket_id — returned by a tool and passed back as an ordinary argument. The maintainers recommend this over transport-hidden state, because the model can see the handle and thread it between tools. If you cannot see the state, you cannot audit it.

Here is the shape of a stateless server, in Python with FastMCP. It is not a production system. It is the shape of one.

# mcp_server.py — the shape, not the whole system
from fastmcp import FastMCP

mcp = FastMCP("sales-tools")

@mcp.tool
def sales_summary(start_date: str, end_date: str) -> dict:
    # The server, not the agent, owns the connection and the permissions.
    # No session is kept between calls. Every call is self-contained.
    rows = query_governed_table(table="sales_curated",
                                start=start_date, end=end_date)
    return {"rows": len(rows),
            "total_amount": sum(r.amount for r in rows)}

if __name__ == "__main__":
    # StreamableHTTP is the default transport in the 2026 revision.
    mcp.run(transport="streamable-http", host="0.0.0.0", port=8000)

Deploy that behind a load balancer, with no sticky sessions, and it works. Deploy the old, session-based version the same way, and the second request lands on a different instance that has never heard of the first one.

A practical rule: if your server needs a session to answer a tool call, the state belongs in a database, a queue, or an explicit handle the client passes back — not in memory. Memory is where state goes to die, usually at 3 a.m., during a deploy.

Try it: kill the session, keep the server

Take one MCP server you already run. Remove any session storage from it. Make every tool call self-contained, with its inputs in the arguments and its state in an explicit handle.

Then restart the server mid-run, and send the next request to a different instance. If it answers correctly, you have a stateless server. If it does not, you have just found the state you were hiding.

Chapter 3. Tasks: Long Work Without Holding the Connection Open

Some jobs do not fit in a single request. A data refresh, a model evaluation, a report that takes twenty minutes — holding a connection open for that long is not a design, it is a hope.

Tasks are the 2026 answer. A Task is a unit of long-running work that a client creates, polls, and cancels cooperatively, instead of waiting on an open stream.

The lifecycle is deliberately boring:

  1. Create. The client asks the server to start a Task, and gets a task ID back immediately.
  2. Poll. The client checks tasks/get / tasks/update for status, on its own schedule.
  3. Listen. Notifications arrive via subscriptions/listen, so the client does not have to poll forever.
  4. Cancel. Either side can cancel cooperatively with tasks/cancel, and the server stops cleanly.

That pattern maps cleanly onto queue workers and cron jobs — the infrastructure teams already run — instead of onto a bidirectional stream that has to stay alive for the whole job.

Here is the shape, as a client would use it. The exact method names follow the io.modelcontextprotocol/tasks extension.

# tasks_client.py — the shape, not the whole system
task = client.create_task(
    tool="refresh_sales_mart",
    arguments={"date": "2026-12-03"},
)
# The call returns immediately. The work runs in the background.
while True:
    status = client.tasks_get(task_id=task.id)
    if status.state in ("completed", "failed", "cancelled"):
        break
    sleep(10)  # poll on your schedule, not the server's
result = client.tasks_get(task_id=task.id, include_result=True)

Three details make Tasks safe, and all three are easy to skip when you are excited:

A Task needs an owner and a budget. Who started it, how long it may run, and what it may cost. A Task without a budget is a job that can run until your cloud bill notices. Set the timeout and the cost limit when you create it, not when you notice the bill.

A Task needs a visible state. Not just “running” or “done,” but what step it is on, what it has produced so far, and what it will do next. If a Task has been “running” for an hour with no update, that is not a long job. That is a stuck job, and your client should be able to say so.

A Task needs cooperative cancellation. The server must actually stop when asked — release its resources, mark its partial work, and report what it did and did not finish. A cancel that is ignored is not a cancel. It is a lie your system tells your users.

A practical rule: if a tool takes longer than a few seconds, it should probably be a Task, not a tool call. If it takes longer than a few minutes, it should definitely be one. Your agent, your client, and your load balancer will all thank you.

Try it: turn one slow tool into a Task

Pick the slowest tool on your server. The one that times out, or the one everyone avoids calling because it holds the connection open.

Convert it to a Task: create, poll, cancel. Run it three times. Measure how long the client waited, how long the server worked, and whether a cancel actually stopped it. That measurement — not the code — is your first production lesson about long work.

Chapter 4. MCP Apps and Skills: When the Server Ships the Interface and the Instructions

Tools return JSON. Humans do not read JSON for fun.

That is the problem MCP Apps solve. An MCP App is a server-rendered interactive interface — HTML, shipped by the server, rendered by the host inside a sandboxed iframe — instead of a wall of text dumped into the model’s context. A dashboard, a form, a calculator, a table the user can sort: whatever the server needs to show, rendered inline, not described in text.

Claude and Claude Desktop were among the first hosts rendering MCP Apps, and the pattern is easy to reason about once you see the boundary:

Treat an MCP App as a privileged capability, with its own review bar. An App that can invoke a destructive tool is not a nicer UI. It is a new way to invoke a destructive tool, and it needs the same approval gate as the tool itself.

Skills are the other half of the same shift, and they change where expertise lives.

A Skill is a reusable, versioned file — or a set of files — that a server ships alongside its tools: step-by-step guidance, domain knowledge, checklists, and the order in which to use the tools. In late 2026, Anthropic shipped Skills over MCP as a public beta, alongside Tasks and Elicitation. The idea is simple: instead of every agent carrying the same instructions in its prompt, the server ships the instructions with the tools they describe.

That is useful, and it is also a governance problem, because workflow logic now rides with the server. A server update can change how an agent behaves, without any change to the agent itself.

Three rules for Apps and Skills in production:

  1. Version them like code. A Skill is an executable instruction asset, not an informal prompt. Pin the version an agent uses in production, so it cannot silently drift to a new instruction set. When a Skill changes, that is a release, with a review and a changelog.
  2. Review them at a separate bar. An App needs a UI review — what it shows, what it can invoke, what it can exfiltrate. A Skill needs a semantic review — what it tells the agent to do, and whether that instruction is safe when combined with the tools it can reach. A safe tool can still be used unsafely when the instruction layer is unmanaged.
  3. Log which version did what. Log which Skill version triggered which MCP call, and retain that mapping for incident response. When something goes wrong, “which Skill was loaded?” is the first question, and “we don’t know” is not an answer.

Here is the shape of a Skill, as a file the server ships. It is not a full Skill. It is the shape of one.

# skill.md — sales-triage, v1.2.0
# Owner: data-platform. Review: required for write actions.

## When to use this skill
When a Databricks job fails and the user asks what broke.

## Steps
1. Call `job_status` to get the failing step. Do not guess.
2. Call `log_tail` for that step only. Do not read other jobs.
3. Summarize in two sentences: what failed, and what to check first.
4. If the fix is a schema change, stop and escalate to a human.
   Do not propose a production write.

## Never do
- Never call a write tool from this skill.
- Never read a table outside `sales_curated`.

A practical rule: start with one Skill, for one job, with read-only tools. If you cannot name the owner, the version, and the review that approved it, you do not have a Skill in production. You have a prompt someone pasted into a server.

Chapter 5. Authorization and Governance: OAuth 2.1, Scopes, and One Identity per Agent

If there is one chapter in this book that decides whether your server survives a security review, it is this one.

MCP in production is not an authentication problem. It is an authorization problem: not “who is this agent?” but “what is this agent allowed to do, right now, with this tool, on this data?”

The 2026 specification hardens authorization toward deployed OAuth 2.1 practice. Dynamic Client Registration is deprecated in favor of CIMD — client ID metadata documents — and the protocol’s authorization work is spread across several specification proposals, all pointing the same way: tokens with narrow scopes, checked at call time, not just at session start.

Here is the shape that works in 2026, and it is the same shape that works for any public API:

One identity per agent. An agent that reads sales should not also be able to delete users. Give it one identity, with the smallest permissions that let it do its job, and log everything it does under that identity. When an agent is compromised, or misconfigured, the blast radius is the identity — so make the identity small.

Scopes per tool, checked at call time. A token carries scopes such as jira:read, s3:list, postgres:query:readonly. The MCP server checks those scopes on every tools/call, not just once at the start. For high-risk tools, the server rejects any call whose scope has not been elevated to an approved state within the last few minutes — and that elevation comes from a human, through a review card, not from the agent asking nicely.

// authz.ts — the shape, not the whole system
type ToolCall = { tool: string; scopes: string[]; actor: string };

function authorize(call: ToolCall): "allow" | "deny" {
  const required = REQUIRED_SCOPES[call.tool]; // e.g. ["postgres:query:readonly"]
  if (!required.every((s) => call.scopes.includes(s))) return "deny";
  if (DESTRUCTIVE_TOOLS.has(call.tool) && !recentHumanApproval(call.actor)) {
    return "deny"; // write tools need a fresh human approval, every time
  }
  return "allow";
}

The server owns the secret. The agent never sees a password, a token, or a connection string. The MCP server holds the credential, and the agent only sees the tool. That is the same rule from the first pocketbook, and it matters more here, because an MCP server is the place where secrets concentrate.

A registry, so you can see what exists. In 2026, the production shape is a registry that lets platform teams discover, validate, and enable servers. Every server exposes a capability document — tools, transport URL, auth requirements — at a well-known location, and the registry polls, validates, and indexes it. Pinterest published its internal MCP ecosystem the same way, and the AAIF Registry formalized capability metadata. If you cannot list your servers, you cannot govern them.

Separate owners for the two layers. Assign one owner for MCP server approval and a different owner for Skill approval, with shared change records. Require version pinning for every Skill used in production. Apply request-time policy checks before the agent loads a Skill or invokes a tool. Revoke or quarantine both the Skill and the MCP integration if either layer shows unsafe behavior.

Cloud platforms have moved the same way. AWS moved its managed MCP server to general availability in 2026, exposing its service catalog through a single governed endpoint, with IAM-based governance, CloudTrail auditing, and a Skills model. The pattern is the same everywhere: the agent is a first-class principal, with narrower permissions than a human, and a full audit trail.

A practical rule: start with three tools, read-only, one identity, and a registry entry. That is enough to be useful, and small enough to be safe. Add a write tool only when you can name the exact check that runs before the write, the exact human who approves it, and the exact rollback if it goes wrong.

Try it: audit one server in an hour

List every tool on one MCP server. For each tool, write down: who can call it, what scope it needs, what data it can reach, and whether it writes, deletes, or exports anything.

If you cannot answer one of those questions for one tool, that tool is not ready for production. Fix that answer before you add another tool.

Chapter 6. Evaluation and Observability: Prove the Server Is Still Good

A server that worked on Monday can be broken on Tuesday by a prompt change, a model change, a tool change, or a Skill update — and nothing in the protocol will tell you.

Evaluation and observability are how you find out before your users do.

Evals: is the server still good at this?

Keep a small evaluation set — ten to twenty real examples, with the right answer attached. Run it every day, or every time you change a prompt, a model, a tool, or a Skill. If the score drops, stop and look. Do not ship a change because it “felt better in the demo.”

A useful eval for an MCP server is not “did it sound smart?” It is: did it call the right tool, with the right arguments, did it cite the source it used, and did it stay in scope? If it cannot cite its source, it is guessing. If it called a write tool when a read tool would do, it is not just wrong — it is dangerous.

Observability: what did the server actually do?

Log three things for every call, and keep them together:

If you cannot trace a bad answer back to a bad tool call, a bad Skill version, or a bad retrieval, you will fix the wrong thing. And if you cannot trace a bad tool call back to the identity and scopes that allowed it, you cannot answer the only question a security review will ask: “Who did this, and why were they allowed to?”

Cost and lineage, again — because they are the same problem.

Log tokens, time, and cost per call. An agent that calls a large model five times per request, with no cache and no short-circuit, becomes a bill before it becomes a product. Use the cache hints from the 2026-07-28 spec on list and resource-read results. Use a smaller model for classification and routing. Only call the large model when the decision actually needs it.

And keep lineage: which server version, which Skill version, which tool, which call produced this answer? That mapping — Skill version to MCP call — is the audit trail that lets you revoke or quarantine a Skill without guessing.

The checklist before any server goes to production:

If you cannot tick all six, you do not have a production server. You have a very good demo. That is fine — as long as you know which one it is.

Chapter 7. From One Server to Production: The 30-Day Playbook

You do not need a platform team to start. You need thirty days, one server, and the discipline to stop at each gate.

Days 1–7: Pick one server, and watch it. Choose the server your team already uses most, or the one with the scariest tools. Do not build a new server yet. Just log it: which tools are called, by whom, how often they fail, and how long they take. That log is your business case — and your risk register.

Days 8–14: Make it stateless, read-only. Remove session storage. Make every tool call self-contained. Add the cache hints from the spec. Keep the tools read-only. Add the registry entry, the scopes, and the audit log. Measure: how many calls were right? How many were denied, and why?

Days 15–21: Add one Task, and one Skill. Convert the slowest tool into a Task, with polling and cooperative cancellation. Ship one Skill, versioned, reviewed, for one job, with read-only tools. Run both for a week. If the eval score holds and the cost is sane, keep them. If not, roll them back and write down why.

Days 22–30: Decide what to scale. Now you have evidence, not enthusiasm. Either scale the pattern to a second server, or fix the one thing that kept breaking — the authorization, the eval, the cost. Do not add a second server until the first one is boring. Boring is the goal. Boring means reliable.

At the end of thirty days you will have one of two honest outcomes, and both are wins: a small MCP server that works, with the evidence to prove it — or a clear, written reason why this particular server is not ready yet, and what would make it ready. Both beat a server that impressed a room and died the following Monday.

This pocketbook was the taste. The full books go deeper, with the protocol in full, the patterns for n8n orchestration, and the harness that keeps agents alive in production.

Start here, in the author’s catalogue on Amazon:

If you made one server stateless, converted one slow tool into a Task, or shipped one versioned Skill, you already did the hard part. The next step is not a bigger server. It is a smaller, better-governed one — run every day, logged, evaluated, and boring enough to trust.

Build that. Then build the next one.

More free pocketbooks in this series:

Keep reading — the full books are on Amazon.

Browse all books by Leandro Calado Ferreira on Amazon →

Also free on this site: Harness Engineering for AI Coding Agents