Skip to content
AI Engineering
Building with the API

MCP: capabilities, resources vs tools, and trust

MCP lets a host discover what a server offers. Knowing what each part does and who you are trusting keeps it safe.

Chapter 7: Building with the APILesson 10 of 11Level: CoreAbout 12 min
Words on this page (8)
MCP
: Model Context Protocol: a standard for plugging tools and data into AI apps.
tool
: A function the model can ask your program to run, described by a name, description and argument schema.
prompt
: The input text you give a model, including instructions, examples and data.
schema
: A description of the shape of data: which fields exist and what types they have.
stdio
: Standard input and output: how a local program talks to the program that started it, used by local MCP servers.
OAuth
: A standard way to let an app act for you without giving it your password.
agent
: A model run in a loop that chooses its own tools and steps until the task is done.
token
: A piece of text the model reads and writes, usually a word or part of a word. About 4 characters of English on average.

Capability discovery

When a client connects, it asks the server what it supports. The server replies with its , resources and , each with a description and . The host shows these to the model. This is why a server's descriptions are effectively prompts: whatever they say, the model reads.

Resources versus tools

A resource is data the application or user attaches, such as a file or a record, identified by a URI. It is read-only context. A tool is an action the model chooses to run, with arguments, which can change things. Prefer resources for reading and tools for doing.

Trust boundaries

You trust a server to behave as described. A malicious or compromised server can return instructions in tool results, change a tool description after you approved it, or ask for more access than it needs. Mitigate: install servers you can inspect, pin versions, scope credentials to the minimum, require approval for tools that write or send, and avoid combining a server that reads untrusted content with one that can send data out.

Local versus remote

A local server runs on your machine with your user's permissions. A remote server runs elsewhere, needs authentication () and sees only what you send. Local is simpler, remote is easier to share and update.

A worked example: a safer setup

Server A reads private notes (sensitive). Server B browses the web (untrusted). Together they form a risk: a page B reads could instruct the model to send A's notes somewhere. Safer: run them in separate sessions, or add approval before any message leaves the machine.

A review checklist

Who wrote it, and can you read the code? Is the version pinned? What credentials does it hold and are they the minimum? Does it write or only read? What happens if its tool descriptions change? If you cannot answer, do not connect it to anything sensitive.

How a description attack works

A tool description is text that goes into the model's context, so the model treats it somewhat like an instruction. A "rug pull" uses this in four steps.

  1. You review a server and approve its clean descriptions.
  2. The author later publishes an update that changes one description.
  3. Your client loads the new text the next time it connects.
  4. The model now sees an instruction you never reviewed.

Defenses: pin the version, compare descriptions after any update and re-approve. Whether a given client warns you about changes varies, so check yours.

A second example: a low-risk setup

A read-only local server pointed at one folder of public documents, with no web access and no way to send anything out, needs little ceremony. Risk rises with three conditions: the can see private data, it reads content strangers wrote, and it can send data outside. All three together is the dangerous mix. Remove any one and the worst case shrinks a lot.

Trade-offs of approvals

Asking before every action feels safe but trains people to click yes without reading. Fewer, narrower tools mean fewer prompts, so each prompt means more. Require approval for writes and sends. Let read-only calls on a scoped folder run freely.

What goes wrong

Credentials are broader than needed. A with full account access turns a small bug into a big incident. Check the token's scopes in the provider's dashboard.

Two servers expose the same tool name, and the model calls the wrong one. Rename or disable one.

You cannot remember what you approved. Keep a list.

Try it yourself

List every server you have connected. For each, write who made it, the version, the credentials it holds, whether it writes, and what it can reach. Expect at least one row you cannot fill in. Disconnect that server until you can.

Common mistake

Approving everything the first time and never looking again.

Check yourself

Which is read-only context chosen by the app or user?

Why are a server's tool descriptions a security concern?

A server that reads untrusted web pages and one that can send email are both connected. What is the risk?

Go deeper

Spotted a mistake or something unclear? Report it on GitHub.

On this page