MCP (Model Context Protocol) is an open protocol that lets an AI assistant call functions in external systems. Anthropic published it in November 2024, and it is now supported by Claude, ChatGPT, Cursor, VS Code, and other clients. An MCP server for your API describes which operations the model may use and runs them through the API with the user’s permissions.
How an MCP server works.
The assistant (the MCP client) connects to the server and asks for its capabilities. The model decides what to call, the client passes the call to the server, and the server runs the operation and returns the result. Messages use JSON-RPC 2.0.
01 / PRIMITIVE
Tools
Actions the model calls on its own: find an order, create a task, change a status. Each has a name, a description, and a JSON Schema for its arguments.
02 / PRIMITIVE
Resources
Data the client reads and adds to the context: a document, a record, a file. The application or the user decides what to include.
03 / PRIMITIVE
Prompts
Templates the user starts explicitly, such as “review this ticket using the support checklist”.
The key point
For a product API, almost everything is done with tools. Resources and prompts are useful, but clients support them unevenly.
Which operations to expose as tools.
A common mistake is to generate one tool per endpoint from OpenAPI. The model gets a hundred similar functions and confuses them, and their descriptions take up context on every request. Tools are designed around the user’s tasks.
- Built around a task. One “find an order by number or phone” tool is more reliable than three calls the model has to chain correctly.
- A description for the model. The model picks a tool by its name and description. The description says when to call it, what it does not do, and what format the arguments take.
- Strict arguments. Enums instead of free text, required fields, date formats. The server still validates arguments itself: the model can send anything.
- A short response. Return the fields needed for the next step, not the full API object. A long response fills the context and costs money.
- Readable errors. The model reads the error text. “Order 1042 not found, check the number” helps it recover; “500 Internal Server Error” gives it nothing to work with.
The specification defines hints for the client: readOnlyHint, destructiveHint, idempotentHint. The client may use them to decide when to ask for confirmation. Do not build security on them: a server can put anything in a hint.
Start with read-only tools. Add tools that change data once you have seen how the model uses search.
User permissions and security.
An MCP server acts on behalf of a person, so permissions are checked the same way as in the product itself. The model must not see more than the user sees in the regular interface.
- For a remote server, the MCP specification describes authorization based on OAuth 2.1: the client obtains a user token, and the server checks it on every call.
- A token issued to the MCP server must not be passed through to your API as is; the specification explicitly forbids it. The server calls the API with its own credentials and the specific user’s permissions.
- Irreversible actions, such as deleting, paying, or sending something to a customer, run only after a person confirms them.
- The model reads emails, documents, and API responses that may contain instructions aimed at it (prompt injection). So the server code checks permissions, and nothing the model writes can change that.
- Every call is logged: who, which tool, with what arguments, and what came back. Without the log, an assistant’s mistake cannot be traced.
A simple rule
If an action cannot be undone, the model does not perform it without a person’s confirmation.
Local or remote server.
The specification defines two transports.
- stdio. The client starts the server as a process on the user’s computer and talks to it over standard input and output. This is how developer tools and internal utilities are connected to Claude Code, Cursor, or Claude Desktop.
- Streamable HTTP. The server runs as a web service at a single URL, and clients connect to it from the cloud and from any computer. This is the option for a product with users: authorization, rate limits, and monitoring work as for a regular API.
Remote servers used to run over HTTP+SSE. That transport is deprecated; new servers use Streamable HTTP.
Building an MCP server step by step.
01 /
Choose the scenarios
A few tasks the assistant should handle. For each, an example request in plain words and the expected result.
02 /
Pick an SDK
Official SDKs exist for TypeScript, Python, Go, Java, C#, and other languages. A Go server builds into a single binary that is easy to deploy next to the API.
03 /
Define the tools
Names, descriptions, argument and response schemas, errors. This is a contract, and it changes as carefully as a public API.
04 /
Test
MCP Inspector shows what the client sees and lets you call each tool by hand. Then run real requests through the assistant and check permissions as different users.
The same approach works for business systems. For example, an MCP server for 1C uses its standard OData interface or the configuration’s HTTP services and exposes only the catalogs and documents the model needs.
What to bring to the first conversation.
You do not need an architecture. Describe what users should be able to do through the assistant, what your API looks like, and how permissions work in it.
- Which tasks will users handle through the assistant, and which of them change data?
- Is there an API description (OpenAPI), and how does authorization work today?
- Which clients do you need: Claude, ChatGPT, Cursor, or your own interface?