By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
Three teams built three ticket-system clients last year. Each has its own argument names, its own retry policy and its own bug. The fourth team solved the same problem in an afternoon by adding a server to a config file.
The Model Context Protocol (MCP) is an open standard for connecting a model client to external tools and data. A server publishes what it can do. A client, such as Claude Code or your Agent SDK app, connects to the server and lists what is available.
The split is why the config file is enough. The server owns the integration, the client owns the model loop, and the contract between them is a protocol instead of a bespoke SDK.
Connect the server when one exists and fits. Write your own when no server can express the operation, or when you cannot accept its permission or authentication model.
Two capabilities matter for this exam. Tools are actions the model can call, each with a name, a description and an input schema, exactly like the tools in step 26. Resources are readable data addressed by a URI, such as a file, a record or a document.
Tools do; resources are. A tool changes something or computes something. A resource is there to be read into context. A server can also publish prompts, which are templates a person invokes, but tools and resources are the parts that change agent behaviour.
| Capability | Who invokes it | Example | Design question |
|---|---|---|---|
| Tool | The model | create_ticket | Does the description route and bound the call? |
| Resource | The client, for context | a support macro | Is it small, current and safe to read? |
| Prompt | The user | a summarise-ticket template | Is it a shortcut, not a hidden loop? |
In Claude Code, a project declares its servers in .mcp.json at the repository root. Each entry needs a command, a list of arguments, and optional environment variables.
{
"mcpServers": {
"orders": {
"command": "python",
"args": ["-m", "orders_mcp"],
"env": {
"ORDERS_BASE_URL": "${ORDERS_BASE_URL}",
"ORDERS_TOKEN": "${ORDERS_TOKEN}"
}
},
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"${WORKSPACE_ROOT:-.}"
]
}
}
}Do not commit tokens. Reference an environment variable in the file and set it per machine. Claude Code expands ${VAR} inside .mcp.json, and ${VAR:-default} supplies a fallback, so one checked-in file works on a laptop, in CI and on a colleague's machine.
If a token ever lands in the file, rotate it. Deleting the line does not remove it from history, and the history is what an attacker reads.
The transport is how the client talks to the server. With stdio, the client starts the server as a child process and exchanges JSON over standard input and output. With a socket or HTTP transport, the client connects to a server that is already listening.
| Transport | Where the server runs | Good for | Watch out for |
|---|---|---|---|
| stdio | A child process on the same machine | Repo-scoped servers, local tools | A failed start looks like a missing tool |
| socket or HTTP | A service you connect to | Shared servers, central auth | Auth, latency and network failure |
Choose stdio when the server ships with the repository and needs the developer's own credentials. Choose a network transport when a team shares one server and you want one audit point. Never assume a network call succeeded.
A call passes through two processes and one protocol. Here is the path, including the branch where the server never starts.
Both failure points need a message a human can act on. A server that fails to start is usually a missing binary, a wrong working directory or an unset variable. A call that fails inside a running server uses the error contract from step 27, so the model can respond instead of stalling.
Before you write an integration, look for a server that already does it. An existing server has a stable schema, a changelog and an owner. Your bespoke client has you, and you are busy.
Write your own when the operation does not exist, when you need a permission the server does not expose, or when the auth model is unacceptable. Wanting it in your favourite language is not a reason: the client does not care how the server is written.
.mcp.json entry with ${VAR} references for every credential and a pinned version.Key takeaways
MCP is an open protocol: a server exposes tools and resources, and a client such as Claude Code connects to it.
Declare servers in .mcp.json with a command, args and env, and expand secrets with ${VAR} so one file works everywhere.
stdio runs a local child process; a socket or HTTP transport connects to a shared server.
Handle both failure points: a server that will not start, and a call that fails inside a running server.
Prefer a maintained server over a bespoke integration when it fits, and pin the version you run.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.