Chapter 04
Model Context Protocol
One flat tool namespace, config that decides who gets the server, and errors an agent can act on.
4.1
Three primitives
An open protocol for plugging external systems into Claude. Everything it exposes is one of three things.
Functions the agent calls — CRUD, API requests, command execution. Side effects live here.
Data the agent reads for context — docs, database schemas, content catalogues. No action taken.
Predefined prompt templates for recurring tasks.
4.2
Every server's tools land in one namespace
Connect a server and its tools are discovered automatically. All connected servers are live at once.
4.3
Project config or user config
Where the file lives decides who gets the server. That is the whole question.
.mcp.json | ~/.claude.json | |
|---|---|---|
| location | project root | your home directory |
| version control | committed | never shared |
| who gets it | every contributor, on clone | you only |
| use for | the team's shared integrations | personal and experimental servers |
| secrets | "env": {"GITHUB_TOKEN": "$${GITHUB_TOKEN}"} | same — the value never enters the file |
4.4
isError is a signal, not a message
The flag says it failed. The content has to say what the coordinator should do next.
{
"isError": true,
"content": "Operation failed"
}Retry? Re-query? Escalate? No basis for any of them.
{
"isError": true,
"content": {
"errorCategory": "transient",
"isRetryable": true,
"message": "Timeout calling the
orders API.",
"attempted_query": "order_id=12345",
"partial_results": null
}
}Category and isRetryable pick the strategy; the query and partials stop the work being redone.
4.5
A resource is a map
Without one, the agent burns calls discovering what data even exists.
Recall in 60 seconds
- MCP exposes three things: tools (act), resources (read), prompts (templates).
- Connected servers are discovered automatically and all their tools are available at once, in one flat list.
- Selection is still by description — overlap between servers is your problem to fix.
.mcp.jsonat the project root, in VCS = the team's servers.~/.claude.json= yours alone.- Secrets go in as
$${ENV_VAR}. The token itself is never committed. - Standard integration → community server. Build your own only for team-specific workflows.
isError: trueplus"Operation failed"is a dead end — return category,isRetryable, the attempted query and any partials.- A resource replaces a chain of exploratory calls with one read.