The Model Context Protocol is how org-approved AI assistants (Claude, Copilot-class tools, internal agents) operate your platform without screen-scraping dashboards or holding kubeconfigs.
Tier: Advanced · Workflow area: Agent operations & guardrails
This playbook wraps your IDP's capabilities — service catalog, deployments, logs, golden-path scaffolding — as an MCP server with read/write tiering, per-agent identity, quotas, and an audit trail, so the platform's paved road extends to AI callers under the same governance as human ones. Pulumi's MCP server is the public reference for the pattern; here you build it for your own platform APIs.
Skip a custom server where a mature vendor MCP server already covers the tool (GitHub, Pulumi, your cloud) — wrap only what's yours: the platform's own APIs.
mcp package, stable v1.x — examples below; note the v2 beta line renames FastMCP to MCPServer, so pin v1 or adjust) or TypeScript.Choose the first tools by tier: three reads, one gated write.
| Tool | Tier | Backing API |
|---|---|---|
get_service(name) | read | catalog API |
list_deployments(service, env) | read | CD API |
fetch_logs(service, env, minutes) | read | log API (result-size capped) |
create_service(name, template, owner) | write, approval-gated | scaffolder API |
Reads make the server immediately useful; the single write proves the governance path end-to-end.
Build the server with tools as typed functions.
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("platform")
@mcp.tool()
def get_service(name: str) -> dict:
"""Fetch a service's catalog entry: owner, tier, on-call, links."""
return catalog.get(name) # calls the real platform API
@mcp.tool()
def create_service(name: str, template: str, owner: str) -> dict:
"""Scaffold a new service via the golden path. Requires approval."""
return scaffolder.request(name, template, owner, requested_by=current_caller())
mcp.run(transport="streamable-http")
Docstrings and type hints become the tool schema the model sees — write them prescriptively ("call this when...") since they steer tool selection. Keep results small and structured; a tool that returns 50k log lines blows the caller's context and your egress.
Authenticate callers, then tier them. Front the server with OAuth (spec-standard for HTTP transport): every caller — a human's assistant or a headless agent — presents a token tied to an identity. Map scopes to tiers: platform.read unlocks the read tools; platform.write additionally unlocks gated writes. Enforce in the server (check scope per tool call), not in documentation. Headless agents get their own service identities — never a borrowed human token — so RBAC, quota, and audit distinguish "Priya's assistant" from "the nightly triage agent."
Gate the write with a human approval. create_service does not scaffold directly: it files an approval (platform ticket or Slack flow) carrying the caller identity and full arguments; a platform engineer approves; the scaffolder runs; the tool returns the request status either way. This is pb-49's approval tier implemented at the tool boundary — the agent experiences it as an async tool, not a denial.
Quota and rate-limit per identity. Agents retry enthusiastically; a misconfigured one is a DoS with a personality. Apply per-identity rate limits at your API gateway in front of the MCP server, plus per-tool budgets for expensive calls (fetch_logs). Return structured "quota exceeded, retry after" errors — models handle them well when they're explicit.
Audit every call, then run the acceptance drill. Log caller identity, tool, arguments, decision (allowed/denied/approval-pending), and result size — to the same SIEM/dashboards as pb-49/pb-50 (join on identity). Drill: connect an approved assistant, exercise all four tools; verify a read-scoped identity is denied the write; verify the write pauses for approval and the audit log reconstructs the whole session; verify a token with no scopes gets nothing.
Write tool descriptions like on-call docs, not marketing — "use fetch_logs for the last N minutes of one service's logs; for cross-service search, tell the user to use the log console" prevents the misuse you'd otherwise guard against downstream.
mcp SDK v1 / FastMCP (this playbook): fastest path; TypeScript SDK equivalent if your platform tooling is Node.MCP with authz tiers turns "agents might do things to our platform" into "agents are tenants with scopes, quotas, and an audit trail" — governance as API design, not policy documents.