Skip to content

Connecting tools with MCP

Customizing agents · topic customizing-agents/mcp

The Model Context Protocol is a standard way to expose tools and data to an agent through a server the agent's client connects to. This topic covers the server and client roles, the transports that connect them, the primitives a server can offer beyond tools, when a plain command-line tool is the better choice, what a tool costs in tokens, and the security consequences of connecting one.

Concepts

Server
The process that exposes tools, resources and prompts over the protocol. A server wraps something, a database, an API, a file system, a browser, and describes each tool with a name, a purpose and a parameter schema the model can read. Write or install a server once and any compliant agent can use it, which is the protocol's point. glossary
Client
The side inside the agent application that connects to servers, lists the tools they offer, passes those descriptions to the model, executes the model's tool calls against the right server and returns results. The client is where connection configuration, approval prompts and permission checks live, so it is where a user controls what a server may do. glossary
Transport
How client and server exchange messages. A local server usually runs as a child process talking over standard input and output; a remote one is reached over HTTP, often with streaming. The transport decides where the server's code runs and what credentials it holds, which makes it a security decision as much as a plumbing one. glossary
MCP primitives
The kinds of things a server can offer besides tools. Resources are data the client can read into context, such as files or records, each with a URI. Prompts are reusable templates the user picks by name. Sampling lets a server ask the client's model to complete text, so the server needs no model access of its own. Roots tell a server which directories it may work in. Most servers only use tools, and the others matter only when your client supports them. glossary
MCP vs CLI
An agent can often reach the same system through a protocol server or by running a command-line tool it already knows. A server gives typed tools, discoverability and a stable interface across agents. A CLI is already installed, costs no tool descriptions in context and is easy to audit. Prefer the CLI when it exists and is good; add a server when the interface needs shaping. glossary
Tool cost
Every connected tool adds its description to the context on every turn, and every call adds its result. A server with dozens of tools can consume a large share of the window before the task starts, and verbose results crowd out the conversation. Connect only the servers a project needs, prefer servers with few well-described tools, and watch result sizes. glossary
MCP security
Connecting a server extends the agent's blast radius to everything the server can reach. Risks include servers from untrusted sources, tool descriptions that carry injected instructions, tools that return attacker-controlled content, and tools that can send data outward. Vet the source, run with least privilege, approve risky tools per call and review what leaves. Connect a server with your own identity, never with a shared service account, so it can do only what you may do and its actions trace back to you. glossary

Lessons

Your reference

Each lesson above adds its takeaways and its example here once you finish it. Your reference lists every lesson you have finished.

Connecting an agent to your systems with MCP

Unlocks when you finish Connecting an agent to your systems with MCP.

Connecting your first tool server

Unlocks when you finish Connecting your first tool server.

Hardening a tool connection

Unlocks when you finish Hardening a tool connection.

Measuring what a tool server costs

Unlocks when you finish Measuring what a tool server costs.

Sources