Skip to main content
Glama
mariuszbyahoo

ops-copilot-mcp

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: denied

The 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

ping

read

Health check; returns pong.

list_containers

read

{ all?: boolean = false }

Compact text table; running only, or all incl. stopped.

get_container_logs

read

{ container: string, tail?: number = 100 }

Last N log lines; resolve by id-prefix or exact name.

restart_container

mutate

{ container: string, confirmToken?: string }

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 store

The 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:

  1. From this project directory, start Claude Code.

  2. Approve the project MCP server when prompted (or run /mcp to inspect it).

  3. 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 point

Dependency 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 tools
get_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.

ParametersJSON Schema
NameRequiredDescriptionDefault
tailNoNumber of trailing log lines to return (default 100).
containerYesContainer id-prefix or exact name.

TDQS

A4.2/5.0
Behavior4/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters3/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
allNoInclude stopped containers (default false).

TDQS

A4.5/5.0
Behavior5/5

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.

Conciseness5/5

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.

Completeness5/5

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.

Parameters3/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.5/5.0
Behavior5/5

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.

Conciseness5/5

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.

Completeness5/5

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.

Parameters4/5

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.

Purpose5/5

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.

Usage Guidelines3/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
containerYesContainer id-prefix or exact name.
confirmTokenNoOmit to preview; supply the token from the preview to execute.

TDQS

A4.6/5.0
Behavior5/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters4/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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

A4.4/5.0
Disambiguation5/5

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.

Naming Consistency4/5

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.

Tool Count5/5

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.

Completeness4/5

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

ActivityStale
ResponsivenessSyncing

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

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    An MCP server that enforces runtime governance on AI agent actions — file access, command execution, delegation chains, and permission escalation.
    MIT
  • F
    license
    B
    quality
    B
    maintenance
    An MCP server that gives LLMs direct control over a local Docker daemon, enabling container, image, volume, network, and Compose stack management through natural language.
    23
    4
  • A
    license
    Not graded
    quality
    C
    maintenance
    A 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

Latest Blog Posts

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