Searching for mcp server best practices usually means you already shipped a hello-world tool and now need durable contracts: schemas that survive prompt drift, secrets that never leak into stdout, and operations that survive retries. This page is a design / security / ops checklist. For first-time setup, use the MCP server tutorial instead of rereading an intro here.

01

Scope: checklist, not a second tutorial

02

Tool naming and schema design

Models learn from names and descriptions. Treat them as a public API for a non-deterministic client.

  • Verb_noun names: search_notes, create_issue—not vague run or helper.
  • Descriptions as contracts: say when to call, what succeeds looks like, and what the tool will not do.
  • Stable argument names: renaming query to q silently breaks prompts that memorized the old field.
  • Tight JSON Schema / Zod: enums over free strings when the set is small; max lengths on every string the model can invent.
  • Return shape discipline: prefer compact structured fields over dumping upstream JSON into context.
// Illustrative shape — pin your SDK; names are the contract
server.tool(
    "create_ticket",
    {
        title: z.string().min(3).max(120),
        project_id: z.string().regex(/^[a-z0-9-]{2,32}$/),
        idempotency_key: z.string().uuid(),
    },
    async (args) => { /* validate → authorize → execute */ },
);

03

Least privilege and secrets

  • Scoped credentials: the process identity should only reach the resources the tools need—not a god token for the whole company API.
  • Secrets via env / secret store: never commit tokens; never put them in argv that shows up in process lists or crash dumps.
  • Authorize every call: treat tool arguments as untrusted. Re-check tenant, user, and resource ownership server-side even if the host “should” filter.
  • No secret echo: scrub tokens from tool results, error messages, and logs. A helpful stack trace that includes Authorization is a breach.
  • Read vs write tools: split dangerous mutations into separate tools so the host can enable browse-only modes.

04

Input validation and timeouts

Unbounded tools are the fastest way to burn context, money, and host patience. Fail closed and fail fast.

  • Cap string lengths, array sizes, page sizes, and recursion depth in schema and in handler code.
  • Set hard timeouts on every outbound call; return a structured timeout error instead of hanging the session.
  • Reject unknown fields when practical so prompt typos do not silently no-op.
  • Rate-limit per host identity if the server is shared across users.

05

Idempotency and side-effect honesty

Hosts and models retry. Tools that create tickets, send mail, or charge money need an explicit story for “same request twice.”

  • Document side effects in the tool description (“creates a GitHub issue”).
  • Accept an idempotency_key (or derive one from stable natural keys) for create/update tools.
  • Make reads obviously read-only; do not hide mutations behind a “get_” name.
  • Prefer returning the existing resource on replay instead of inventing a second one.

06

Logging and observability

  • stdio rule: never write diagnostic logs to stdout—they corrupt the protocol. Use stderr or a file / collector.
  • Log tool name, latency, outcome, and a correlation id—not full argument dumps when they may contain PII.
  • Emit metrics the ops team can alert on: error rate, p95 latency, timeout count, authz denials.
  • Keep a small golden fixture set you re-run after SDK upgrades (list tools → happy path → invalid args).

07

Versioning and breaking changes

Pin MCP SDK and protocol versions. Treat tool schema changes like API releases: additive fields are usually safe; renames and semantic flips are breaks. Prefer adding search_notes_v2 (or a versioned server name) over silently changing required fields. Document deprecations in the tool description for at least one release cycle.

08

stdio vs HTTP operations

  • stdio: local hosts spawn your process. Keep startup fast, env-based secrets, and zero stdout noise. Good default for single-user IDE agents.
  • HTTP / Streamable HTTP: remote or multi-user. Put authn/authz in front, terminate TLS, set request size limits, and plan process lifecycle (idle timeout, rolling deploys).
  • Do not mix “debug println” culture with either transport—especially stdio.
  • For selection (stdio vs legacy SSE vs Streamable HTTP), see MCP stdio vs Streamable HTTP; host wiring in mcp.json example.
  • Health: expose a way to prove the process is alive without invoking a mutating tool.

09

Do not treat MCP as your full product API

10

Progressive disclosure vs full tool schemas

Searching for mcp progressive disclosure usually means your catalog grew past what fits comfortably in context. Dumping every tool’s full JSON schema every turn burns tokens and raises wrong-tool rates. Prefer progressive disclosure:

  1. List / search first. Expose a short name + one-line description catalog (or a search tool) so the model can pick candidates.
  2. Fetch schemas on demand. Load full inputSchema only for tools about to be called.
  3. Still curate. Progressive disclosure is not an excuse for a 200-tool kitchen sink—see “Do not treat MCP as your full product API” above and tool annotations for honest risk labels.

11

MCP error handling: tool isError vs protocol errors

Searching for mcp error handling usually mixes two layers. Official SDK error pages remain authoritative—this is an unofficial decision note (no new thin URL).

  • Tool-level isError / structured tool errors:the call completed as a protocol message, but the businessaction failed in a way the model should see and possibly recover from (not found, validation failed, upstream 409). Keep messages actionable; never echo secrets or raw auth headers.
  • Protocol / transport failures: the session never got a well-formed tool result—timeouts, auth failures at the gateway, malformed JSON-RPC, crashed stdio process. These are ops and client-retry concerns, not “tell the model to try a different argument.”

12

MCP tool naming conventions

Searching for mcp tool naming conventions usually means collisions and vague verbs are already hurting tool choice. This section deepens naming & schema—it is not a restatement of the protocol character table.

  • verb_resource: create_ticket, list_repos, get_invoice—action first, object second.
  • Stable prefixes for multi-server hosts: when several servers share a host, prefer a short domain prefix (billing_create_invoice) or rely on host namespacing—avoid five tools all named search.
  • Avoid generic names: run, helper, do, query without a resource invite wrong-tool calls.
  • One verb family per mutation class: do not mix create_ and add_ for the same noun without a reason.
  • Descriptions carry the contract: say when to call, what success looks like, and what the tool will not do—pair with annotations and progressive disclosure.

13

MCP pagination: when list cursors matter

Searching for mcp pagination usually means a list tools / resources response grew past what fits in one result. Prefer pagination when catalogs or result sets are large—not as a premature abstraction for three-item lists.

  • When to paginate: resource directories, tool catalogs under progressive disclosure, search hits, and any list the model should skim in pages.
  • Opaque cursors: treat cursors as server-owned tokens—do not encourage clients to invent offsets if your API is cursor-based.
  • Pitfalls: cursors that embed PII; cursors that never expire on mutating lists; returning unbounded arrays “because the model asked for everything.”
  • Pair with size caps in validation and short summaries in structured content.

Official pagination pages remain authoritative for wire shapes. This section is the decision note: when you need it and which footguns to avoid—not a spec mirror.

14

MCP notifications & progress

Searching for mcp notifications progress (or tools/list_changed) usually mixes two notification jobs. Official notifications docs remain authoritative—this is selection judgment.

  • Progress notifications: long-running tools should emit progress so hosts can show status without pretending the call finished. Prefer coarse, honest percentages or stage labels over spammy ticks.
  • list_changed / catalog invalidation: when tools or resources appear/disappear, notify so hosts invalidate caches instead of serving a stale catalog.
  • Session reality: meaningful mid-call progress and many subscription shapes lean stateful sessions; do not expect every serverless shape to behave the same.
  • Related primitives: mid-session host prompts live nearer to sampling vs elicitation than to progress ticks—keep the layers separate.

15

Ship checklist

  1. Stable verb_noun tools with max lengths and enums where possible.
  2. Least-privilege credentials; authz on every mutating path.
  3. Timeouts, size caps, structured errors; no secret echo.
  4. Idempotency keys (or natural keys) for creates/updates.
  5. stderr-only diagnostics for stdio; metrics + fixtures for upgrades.
  6. Pinned SDK; documented breaking-schema policy.

Related reading: MCP server tutorial · MCP server testing · MCP stateful vs stateless · FastMCP vs MCP SDK · mcp.json example · MCP vs function calling · When to use MCP · MCP stdio vs Streamable HTTP · MCP resources vs tools · MCP structured content · MCP tool annotations · MCP sampling vs elicitation · Playwright MCP vs Chrome DevTools MCP · How to write a good agent prompt · Cursor agent tips · Agent engineering series

16

FAQ

What are MCP server best practices in one sentence?

Treat tools as a versioned, least-privilege adapter API: strict schemas, server-side authz, timeouts, honest side effects, and observability that never corrupts the transport.

Should I read the tutorial or this checklist first?

If you have never connected a host to a server, start with the MCP server tutorial. If you already list tools successfully, stay on this best-practices page. For choosing readable context versus callable actions, see MCP resources vs tools. For browser automation versus DevTools inspection, see Playwright MCP vs Chrome DevTools MCP.

Is stdio or HTTP “best practice”?

Neither universally. stdio fits local single-user hosts; HTTP fits remote multi-user deployments with auth in front. The shared practices are validation, secrets handling, and not logging onto the protocol stream.

Why not expose my entire REST API as MCP tools?

Models select from descriptions under context pressure. A huge surface increases wrong-tool calls, auth mistakes, and token cost. Curate a small workflow-oriented set instead.

How should MCP tool errors differ from protocol errors?

Use tool-level errors (isError / structured results) for recoverable business failures the model should see. Treat transport / JSON-RPC / auth gateway failures as protocol/ops issues—not as chatty model-facing essays. See error handling and never put secrets in model-visible errors.

What are good MCP tool naming conventions?

Prefer verb_resource names, stable prefixes when hosts multiplex servers, and avoid generic run/helper. See tool naming. This is not a spec character table.

When should MCP list results use pagination?

When catalogs or hits are large enough to blow context or timeouts. Prefer opaque cursors and size caps—see pagination.

When should I send MCP progress or list_changed notifications?

Progress for long tasks the host should surface; list_changed when the catalog mutates and caches must invalidate. Pair with stateful vs stateless and sampling vs elicitation. See notifications.

What is MCP progressive disclosure for tools?

When the catalog is large, prefer progressive disclosure—short list/search first, then fetch full schemas for the tools you need—over dumping every tool schema into context every turn. Pair with a curated surface.