MCP Protocol
How the Model Context Protocol works and how Ink uses it to give AI agents full control over infrastructure
What is MCP?
Model Context Protocol (MCP) is an open standard for connecting AI agents to external tools and data sources. Instead of building custom integrations for each AI client, a service exposes MCP tools once and every compatible client can use them.
MCP defines a simple contract: the server advertises a list of tools with typed parameters, and the client (your AI agent) calls those tools during conversation. The agent decides when to call which tool based on your instructions and the tool descriptions.
Deploy a React app to production
Agent thinks: I need to create a service on Ink
create_service(
"name": "my-app",
"repo": "ink/my-app"
)Agent thinks: Let me check if the build succeeded
get_service(
"name": "my-app",
"deploy_log_lines": "50"
)Agent: "Your app is live at my-app.ml.ink"How Ink uses MCP
Ink exposes 22+ MCP tools through a single endpoint:
https://mcp.ml.ink/mcpWhen your agent connects, it receives the full tool catalog — deploy services, provision databases, manage DNS, read logs, check metrics. The agent treats these tools the same way it treats file system operations or web searches: as capabilities it can invoke when needed.
Transport
Ink uses Streamable HTTP transport. The agent sends JSON-RPC requests over HTTP and receives responses (or streams) back. Most MCP clients handle this automatically — you just provide the endpoint URL.
Authentication
Two methods are supported:
- OAuth — the agent authenticates through a browser flow. The MCP client handles the OAuth handshake automatically. This is the default for Claude Code, Cursor, and most desktop clients.
- API Key — pass a
dk_live_token in the Authorization header. Designed for headless agents and programmatic access.
Tool discovery
On connection, the agent calls tools/list and receives every available tool with:
- Name — the tool identifier (e.g.,
create_service) - Description — what the tool does, written for AI agents to understand
- Input schema — typed parameters with descriptions and defaults
- Required fields — which parameters are mandatory
The agent uses these descriptions to decide when and how to call each tool. Good tool descriptions are critical — they're the agent's documentation.
MCP vs REST APIs
| MCP | REST API | |
|---|---|---|
| Consumer | AI agents | Human developers writing code |
| Discovery | Automatic — agent reads tool list | Manual — developer reads docs |
| Invocation | Agent decides based on context | Developer writes explicit calls |
| Auth | OAuth or token, handled by client | Developer manages tokens |
| Error handling | Agent reads error, adapts approach | Developer writes error handling code |
MCP doesn't replace REST APIs — it's a layer designed for AI agent interaction. Ink's MCP tools call the same underlying API, but the interface is optimized for how agents think and operate.
Supported clients
Any MCP-compatible client works with Ink. Currently supported:
- Claude Code — full OAuth support
- Cursor — OAuth or token
- VS Code (Copilot) — OAuth or token
- Windsurf — token-based
- OpenAI Codex — OAuth support
- Gemini CLI — token-based
- And 10+ more clients
See Agent Setup for detailed connection instructions for each client.