mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-10-28 07:41:27 +00:00
feat(mcp): stdio MCP server exposing the full API as tools
Add containr-mcp so MCP-compatible agents (Claude, Cursor, Devin)
operate the platform directly — ROADMAP2 phase A3. Reuses the CLI's
thin client and PAT auth; zero duplicated resource logic.
- ~60 containr_* tools across projects, services, deployments, logs,
exec, variables, databases, cron, templates, nodes, scaling, ha,
security, gateway, admin, notifications, tokens
- declarative tool specs → {param} path substitution, GET extras become
query params, remaining args form the request body
- destructive tools require confirm:true and return isError without it
- results are pretty JSON; API error envelopes surface as isError
- configured via CONTAINR_API_URL + CONTAINR_TOKEN env; official
modelcontextprotocol/go-sdk over StdioTransport
Verified over stdio: initialize + tools/list, auth_status returns the
token owner's identity, projects list, destructive refusal, token
creation through MCP.
Authored By: TDvorak <[email protected]>
This commit is contained in:
1 parent
e51b20b2d4
commit
485e41a817
5 files changed
+368
-7
No files matched your search
@@ -69,3 +69,29 @@ containr up --project <id> --image ghcr.io/example/app:latest # image, no buil
|
||||
|
||||
Set `project_id` on the active profile to omit `--project` (stored in
|
||||
`~/.containr.yaml` under `profiles.<name>.project_id`).
|
||||
|
||||
## MCP server
|
||||
|
||||
`containr-mcp` (`go build ./cmd/mcp`) exposes the same API as MCP tools
|
||||
over stdio — every command group above maps to a `containr_*` tool
|
||||
(~60 tools). Destructive tools require the caller to pass
|
||||
`confirm: true`; results are pretty JSON with `isError` on failures.
|
||||
|
||||
Client configuration (Claude Code, Cursor, Devin, any stdio MCP host):
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"containr": {
|
||||
"command": "containr-mcp",
|
||||
"env": {
|
||||
"CONTAINR_API_URL": "https://containr.example.com",
|
||||
"CONTAINR_TOKEN": "cnp_..."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Scope the token deliberately: `read` is enough for inspection agents,
|
||||
`write` for deploy automation, `admin` only for platform operations.
|
||||
Reference in new issue
Block a user