ops-copilot-mcp
Allows an AI agent to list Docker containers, read logs, and restart containers with a human-confirmation protocol.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ops-copilot-mcplist all running containers"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Ops-Copilot MCP Server
A self-hosted MCP server (TypeScript / Node.js) that gives an AI agent (Claude Code, Claude Desktop) a governed interface to local infrastructure. MVP scope: Docker only.
The point is not "an agent can call Docker" — it's the control model.
The control model
Read freely. The agent lists containers and reads logs with no ceremony — reads have no side effects.
Mutate only with a human-confirmed token. A state-changing tool (
restart_container) uses a two-phase confirm protocol: the first call only previews and returns a single-use token; nothing changes until a second call supplies that token.Deny-by-default. Operations are explicitly classified as read or mutate. Anything not classified is refused — capability is opt-in, not opt-out.
Append-only JSONL audit log. Every invocation — read, preview, allow, deny — is written as one JSON line. This is the primary, incident-safe record, not a mirror of some other store. Each line is independently valid, so a crash mid-write can never corrupt history.
This is the portfolio story: not raw capability, but governed capability.
The confirm-token protocol
Agent ──restart_container{container}──────────────▶ Phase 1: preview
• resolve target (id-prefix or name)
• issue single-use token, TTL 120s,
bound to (operation, target)
• audit: preview
◀──"About to restart web-1 (a1b2c3)… • NO side effect
confirmToken=9f3a… within 120s"
Agent ──restart_container{container, confirmToken}─▶ Phase 2: execute
• token must exist, be unexpired,
unused, and match (op, target) exactly
• on success → restart, audit: allowed
• else → refuse, audit: deniedThe token comes from crypto.randomBytes(16), lives only in memory, is deleted on consume
(single-use), and is bound to an exact (operation, target) pair — a token issued to restart
container A can never restart container B, and a reused or expired token is refused with no
side effect.
Related MCP server: dockhand
Tools
Tool | Type | Input | Behavior |
| read | — | Health check; returns |
| read |
| Compact text table; running only, or all incl. stopped. |
| read |
| Last N log lines; resolve by id-prefix or exact name. |
| mutate |
| Two-phase confirm (see above). |
Tool outputs are short, fixed-width, and explicit about errors (prefixed Error: with
isError: true) so the LLM routes reliably on them.
Running locally
Prerequisites: Node.js LTS (>= 20) and a running Docker daemon (Docker Desktop on Windows/macOS, or the socket on Linux).
npm install
npm run dev # tsx src/index.ts — runs the server over stdio
npm run build # tsc -> dist/
npm start # node dist/index.js — runs the compiled build
npm test # vitest — unit tests for the confirm-token storeThe server speaks MCP over stdio: stdout is the JSON-RPC protocol channel, and all logs go to stderr. You normally don't run it by hand — an MCP client (Claude Code) launches it.
The audit log is written to ./audit/audit-<yyyyMMddUTC>.jsonl by default; override the
directory with the AUDIT_DIR environment variable. Files roll per UTC day.
Point Claude Code at it
A project-scoped .mcp.json at the repo root registers this server:
{
"mcpServers": {
"ops-copilot-mcp": {
"command": "npx",
"args": ["tsx", "src/index.ts"]
}
}
}Claude Code launches the command from the project directory. To use the compiled build
instead of tsx, run npm run build first and change the entry to:
{ "command": "node", "args": ["dist/index.js"] }Then:
From this project directory, start Claude Code.
Approve the project MCP server when prompted (or run
/mcpto inspect it).Confirm the tools are listed. Try: "list all containers", then "restart X" — the agent will preview and hand you a token before anything changes.
If the server won't connect, the cause is almost always stdout pollution — a stray
console.log corrupts the protocol stream. Every log line must go to stderr (console.error).
Architecture
MCP Tools src/tools/*.ts thin registerTool wrappers; shape text, write audit; no logic
│
Policy src/policy/*.ts deny-by-default classification; issues/consumes confirm tokens
│
Adapter src/adapters/*.ts the only code that talks to Docker (dockerode); plain types out
│
Audit src/audit/*.ts append-only JSONL sink; called at every decision pointDependency rule: tools know Policy/Adapter/Audit; the adapter knows only dockerode;
Policy/Audit know nothing of MCP or Docker. SDK types live only in src/index.ts and
src/tools/*. Dependencies are constructed by hand in src/index.ts and injected — no
container, no decorators. This keeps the core unit-testable with no transport and makes the
future stdio→HTTP swap a one-file change.
Security note
The stdio transport inherits the trust of the local user who launches the server. There is no network listener, no authentication layer, and no sandbox: the server runs with your OS permissions and talks to your Docker daemon over its local socket / named pipe — which on most setups is equivalent to root on the host. The confirm-token protocol is a guardrail against an agent acting without human intent; it is not a security boundary against a hostile operator or hostile code already running as you. Run it only on infrastructure you own, keep the audit log, and treat the future HTTP transport (which does cross a trust boundary) as requiring real authentication before exposure.
Roadmap (post-MVP — NOT yet built)
The following are deliberately out of scope for the MVP and are not implemented:
Streamable HTTP transport, config-switched (
TRANSPORT=stdio|http). Today: stdio only.More adapters — GitHub (PRs, workflow runs), Traefik (routers, health).
Postgres as a queryable mirror of the JSONL audit log (the JSONL file stays the primary store; Postgres would only be a read-optimized projection).
Scoped policy per operation/target patterns, and richer preview diffs.
Available Tools
4 toolsget_container_logsGet container logsA
READ-ONLY. Fetch the last N lines of a container's logs. Resolve the container by id-prefix or exact name. No side effects.
| Name | Required | Description | Default |
|---|---|---|---|
| tail | No | Number of trailing log lines to return (default 100). | |
| container | Yes | Container id-prefix or exact name. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the burden of disclosing behavioral traits. It explicitly states 'READ-ONLY' and 'No side effects', and clarifies container resolution semantics. It does not mention error behavior or return format, but these are secondary for a log-fetching tool; the safety profile is well covered.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise (three short sentences) and front-loaded with the critical 'READ-ONLY' flag. Every sentence adds value: purpose, resolution, and side-effect disclosure. No wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple two-parameter tool with no output schema, the description plus schema covers purpose, parameter semantics, and side-effect profile. The main gap is not mentioning the return format (e.g., whether logs are returned as a single string or an array of lines), but this is a minor omission given the tool's simplicity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the description adds little beyond what the schema already documents. It reinforces the container resolution method and the meaning of 'tail' as 'last N lines', but these are also present in the schema. This is a baseline 3 per the rubric.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Fetch the last N lines of a container's logs') with a specific verb and resource, and distinguishes itself from siblings like list_containers and restart_container by focusing on log retrieval. The 'READ-ONLY' and 'No side effects' qualifiers further differentiate it from mutating tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context: it is read-only, resolves containers by id-prefix or exact name, and fetches a configurable number of log lines. It does not explicitly mention when to use this instead of siblings or mention exclusions, but the context is sufficiently clear for an agent to infer appropriate use.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_containersList containersA
READ-ONLY. List Docker containers as a compact text table. By default shows only running containers; pass all=true to include stopped ones. No side effects.
| Name | Required | Description | Default |
|---|---|---|---|
| all | No | Include stopped containers (default false). |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description fully discloses the read-only nature and lack of side effects, plus the default filtering behavior. This is transparent for a simple listing tool, covering key behavioral traits beyond what the schema offers.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and front-loaded with 'READ-ONLY' and the core action. Every sentence contributes: purpose, default behavior, and side-effect declaration, with no unnecessary words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple one-parameter listing tool with no output schema and no annotations, the description covers purpose, how to use the parameter, and the safety profile. It is complete enough for an agent to select and invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already provides 100% coverage for the 'all' parameter, and the description only restates the same behavior ('pass all=true to include stopped ones'). It adds no new meaning beyond the schema, so the baseline 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'List Docker containers as a compact text table,' using a specific verb and resource. It distinguishes from siblings like get_container_logs and restart_container by focusing on the listing action and output format.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when to use the tool (listing containers) and explains the default behavior (only running) without naming alternatives. It does not explicitly exclude or compare with sibling tools, but the purpose is unambiguous.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
pingPingA
Health check. Returns 'pong'. Read-only, no side effects.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It explicitly discloses 'Read-only, no side effects' and the concrete output 'pong', giving full transparency for a tool of this simplicity.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise, using three short statements that each convey essential information. There is no redundancy or filler, making it an exemplar of efficient writing.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with no parameters and no output schema, this description is fully complete. It states the function, the return value, and the side-effect profile, covering all necessary bases for an agent to understand and invoke it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With zero parameters, the schema is trivially covered. The description adds context by explaining the tool's purpose and output, which goes beyond the empty schema and meets the baseline for parameterless tools.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Health check' and specifies the exact return value 'pong'. This distinguishes it from sibling tools that manage containers, as it is a general liveness probe.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage as a health check but does not explicitly state when to use it versus alternatives. It lacks direct comparison with sibling tools or conditions for when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
restart_containerRestart containerA
MUTATING: causes downtime. Two-phase confirm flow — call ONCE without confirmToken to preview and receive a single-use token, then call AGAIN with that confirmToken within 120s to actually restart. The token is bound to this exact container.
| Name | Required | Description | Default |
|---|---|---|---|
| container | Yes | Container id-prefix or exact name. | |
| confirmToken | No | Omit to preview; supply the token from the preview to execute. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden. It discloses the mutating nature, two-phase confirm flow, single-use token, 120-second expiry, and that the token is bound to the container. This is thorough and accurate, leaving little ambiguity about the tool's behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact (two sentences), front-loads the critical warning ('MUTATING: causes downtime'), and packs essential behavioral info without redundancy. Every word contributes meaningful guidance.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
There is no output schema or annotations, so the description must cover behavior. It explains the two-step flow, token constraints, and mutating nature. It does not detail error cases or the confirmation response format, but for a moderately complex tool, this is sufficient for an agent to invoke it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% and the schema already describes both parameters. The description adds meaningful context about the token's single-use, 120s window, and binding to the container, and clarifies the sequence (omit token to preview, then supply token to execute). This goes beyond the schema's basic descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool restarts a container, with 'MUTATING: causes downtime' highlighting its effect. It distinguishes from siblings (ping, list_containers, get_container_logs) by being the only mutating operation. The two-phase confirm flow is explicitly described.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives clear context: it is a mutating operation that causes downtime, and it details the exact two-step invocation (preview without confirmToken, then confirm with token). It does not explicitly mention alternatives or exclusions, but the warning implies it should only be used when downtime is acceptable.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Each tool has a clearly distinct purpose: ping for health, list_containers for inventory, get_container_logs for log retrieval, and restart_container for a mutating operation. There is no overlap or ambiguity between them.
Tools use lowercase snake_case with a verb_noun pattern (list_containers, get_container_logs, restart_container). The exception is 'ping', which is a single verb but is a conventional health-check name and does not detract from overall consistency.
Four tools form a well-scoped set for a Docker operations copilot, covering health, listing, logs, and restart. The count is appropriate for the narrow domain and each tool earns its place.
The core monitoring and restart workflow is covered, but there are minor gaps such as no explicit start/stop container controls. Agents can work around this given the focus on restart and diagnostics.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Control plane for autonomous software labor. Agents claim objectives over MCP with audit trail.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
MCP server for building and testing AI agents with multi-model experimentation and insights.
Cloud-hosted MCP server for durable AI memory
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceAn MCP server that enforces runtime governance on AI agent actions — file access, command execution, delegation chains, and permission escalation.MIT
- FlicenseBqualityBmaintenanceAn MCP server that gives LLMs direct control over a local Docker daemon, enabling container, image, volume, network, and Compose stack management through natural language.234
- AlicenseNot gradedqualityCmaintenanceA self-hosted MCP server that gives AI agents controlled access to a machine: filesystem, shell, background processes, git, web fetching and persistent key-value memory.GPL 3.0
- AlicenseNot gradedqualityCmaintenanceGoverns and audits AI coding agents via command gating, cryptographic logging, and multi-agent orchestration, exposed as an MCP server.494MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mariuszbyahoo/ops-copilot-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server