Separate read-only Resources from side-effecting Tools
A common mistake when exposing internal APIs to an AI agent is giving every endpoint blanket write access. MCP cleanly separates read-only context (Resources) from state-changing actions (Tools).
In production, pair every Tool with strict JSON Schema validation, per-tenant rate limits, and a read-only database role for analytical queries so prompt injection can never escalate privileges.
- Use stdio transport for local CLI/IDE integrations and Streamable HTTP + SSE for cloud SaaS MCP servers.
- Bind every tool invocation to a verified workspace identity and log structured audit trails.
- Return concise, token-efficient error messages so the agent can self-correct without burning context.