Skip to main content

MCP Server

Cohestra ships an MCP (Model Context Protocol) server so AI coding assistants — Claude, Cursor, VS Code Copilot, or any MCP-compatible client — can query and operate Flink deployments directly.

Install

pip install "mcp[cli]" cohestra-sdk

The server lives in mcp/server.py in this repository. No separate package needed if you're already working inside the repo.

Start

# Stdio transport (default — for Claude Code / Claude Desktop)
COHESTRA_BASE_URL=http://localhost:8080 python3 mcp/server.py

# With bearer token
COHESTRA_BASE_URL=https://cohestra.yourcluster:8080 \
COHESTRA_TOKEN=your-bearer-token \
python3 mcp/server.py

# Interactive inspector (development)
mcp dev mcp/server.py

Wire into Claude Code

Add to .claude/settings.json in your project root:

{
"mcpServers": {
"cohestra": {
"command": "python3",
"args": ["mcp/server.py"],
"env": {
"COHESTRA_BASE_URL": "http://localhost:8080"
}
}
}
}

Set COHESTRA_TOKEN in env if your API requires authentication.

Wire into Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
"mcpServers": {
"cohestra": {
"command": "python3",
"args": ["/path/to/cohestra/mcp/server.py"],
"env": {
"COHESTRA_BASE_URL": "http://localhost:8080"
}
}
}
}

Available Tools

Read Operations

ToolDescription
list_deploymentsList active deployment actors, optionally filtered by environment and namespace
deployment_summaryAll deployments with status, parallelism, health, and last error
describe_deploymentFull actor state for one deployment
list_deployment_versionsVersion history (spec, savepoint URI, health)
describe_clusterCluster actor state for an env/namespace pair (freeze status)

Lifecycle Operations

ToolDescription
register_deploymentStart a deployment actor (idempotent)
deploySubmit a controlled rollout to a new image and spec
savepointTrigger a savepoint
suspendSuspend a running deployment (savepoints first)
resumeResume a suspended deployment
rollbackRoll back to a recorded version
scaleChange deployment parallelism

Cluster Operations

ToolDescription
freeze_clusterBlock all runtime mutations in a namespace
unfreeze_clusterRemove a namespace freeze

Example Prompts

Once the server is connected, you can ask your AI assistant:

Show me the status of every deployment in prod/streaming.
The orders job is lagging. Scale it to parallelism 16, approved, reason "traffic spike".
Take a savepoint of prod/streaming/orders before the maintenance window.
Something went wrong with the latest orders deploy. Roll it back.
Freeze the prod/streaming namespace — we have a P0 incident.

Idempotency Keys

Write operations (deploy, scale, rollback, suspend, resume, savepoint) require an Idempotency-Key. The server auto-generates one for each call. Pass an explicit idempotency_key argument when you need to retry safely:

Deploy orders with idempotency_key="release-v2.3.1-attempt-1"

Environment Variables

VariableDefaultPurpose
COHESTRA_BASE_URLhttp://localhost:8080Control plane base URL
COHESTRA_TOKEN(none)Bearer token for authenticated deployments