Files
modelcontextprotocol--pytho…/docs/servers/index.md
T
wehub-resource-sync 49b9bb6724
Deploy Docs / deploy-docs (push) Failing after 1s
Conformance Tests / client-conformance (push) Failing after 3s
Conformance Tests / server-conformance (push) Failing after 1s
GitHub Actions Security Analysis / zizmor (push) Failing after 1s
CI / checks (push) Failing after 59m20s
CI / all-green (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 12:10:27 +08:00

1.5 KiB

Servers

An MCPServer exposes three primitives to a connected client. They differ by who decides to use them:

  • A tool is an action the model picks and calls. This is the page most people want first, and Structured Output is its reference companion: everything about the shape of what a tool returns.
  • A resource is read-only data the application chooses to read. URI templates is its reference companion: the full addressing syntax and the path-safety rules.
  • A prompt is a message template a person invokes by name, from a menu or a slash command.

Around the three primitives, the rest of what a server declares:

  • Completions is server-side autocomplete for prompt and resource-template arguments.
  • Images, audio & icons covers everything a tool can return besides text, and the icons a client shows next to your server.
  • Handling errors explains the difference between an error the model can recover from and one it must never see.

Every page here stands on its own; jump straight to the one you need. If you haven't built a server yet, start with First steps instead.

What happens inside the functions you register (the Context, dependency injection, asking the user for more input mid-call) is the next section, Inside your handler.