cd /news/ai-agents/unlock-the-permission-layer-of-your-… · home › topics › ai-agents › article
[ARTICLE · art-179232] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Unlock the Permission Layer of Your MCP Agents with Caplock

An open-source project called Caplock released v0.1.1, a Go-based capability lockfile and policy compiler for MCP agents that turns scattered tool permissions into committable, diffable, testable and enforceable artifacts. The tool scans MCP configs, writes a deterministic caplock.lock recording tool schema hashes and capability classifications, compiles security statements into a typed Policy IR, and runs a 50-case regression corpus covering prompt injection, secret egress and privilege escalation. The same IR drives reports, Rego/Cedar/YAML exports and fail-closed stdio/HTTP MCP proxies, with the entire core pipeline running locally without an LLM.

key takeaway

Caplock v0.1.1 locks MCP tool descriptions and schemas as hashes in a deterministic caplock.lock so config diffs surface capability changes, and enforces the same compiled Policy IR across a 50-case regression corpus, SARIF reports and fail-closed MCP proxies.

read5 min views6 publishedDec 1, 2026

MCP made it trivial to give an AI agent new capabilities—read code, query a production database, send email. But it also made the permission surface invisible. A PR that adds a few lines to .mcp.json hides a critical question from reviewers: What can the agent do now that it couldn’t before? Tool descriptions and input schemas can drift silently. Security policies get stuck in documents, never reaching the code. And even when runtime guardrails exist, no one can prove where the rules came from or whether a change will regress them.

Caplock is an open-source capability lockfile and policy compiler for MCP agents that turns scattered tool permissions into committable, diffable, testable, and enforceable artifacts. Written in Go, the entire core pipeline runs locally—no LLM required for compilation, linting, evaluation, or CI.

Status: v0.1.1. The fact, intent, evidence, and execution layers are implemented—static discovery, deterministic locking, tools/list capture, Policy IR compilation/lint, a 50-case regression corpus, heuristic attack-graph search, trace-generated corpus candidates, JSONL/CSV log import, JSON/HTML/SARIF reports, Rego/Cedar/YAML/JSON/SDK export, and stdio/HTTP MCP proxies with runtime enforcement.

Caplock closes the loop from the permission surface an agent exposes to the policy a runtime actually executes. The same Policy IR drives the matrix, regression tests, reports, exports, proxy decisions, and replay—there is no second policy implementation hiding in a report or runtime adapter.

Layer What it answers Core commands
Facts What can the agent do now? scan ,lock ,diff ,matrix
Intent What should the policy be? draft ,compile ,lint
Evidence Will the policy hold? graph ,test ,report ,corpus ,import
Execution Is the policy actually enforced? export ,proxy ,replay

caplock scan discovers MCP servers from .mcp.json, mcp.json, and similar configs. caplock lock writes a deterministic caplock.lock that records the server, transport, tool name, description/schema hashes, and capability classification—secrets are stored only as key names, never values. The lockfile is deterministic: servers and key names are sorted, no timestamps or machine-specific paths are written, and rotating a secret does not create a diff.

A caplock diff surfaces exactly what changed in a PR, instead of leaving reviewers to guess from a config diff:

~ github (.mcp.json) config changed
~ tool create_issue (description, inputSchema, capabilities)

caplock draft turns a constrained set of English or Chinese security statements into caplock.yaml. It is not an LLM guessing at arbitrary prose—it is a deterministic template compiler. Unmatched or ambiguous statements fail closed. Supported patterns include:

caplock compile emits typed Policy IR with source locations. caplock lint --strict catches default-allow, broad wildcards, delegation escalation, conflicting rules, and other review failures before they reach production.

caplock test runs an embedded 50-case regression corpus covering prompt injection, secret egress, destructive actions, privilege escalation, after-hours operations, shell execution, and tool poisoning. caplock graph infers bounded source-to-sink paths from the captured lockfile and evaluates each sink request. caplock report renders attack paths, gaps, and coverage as text, json, html, or SARIF for CI integration.

Captured traces can be turned into review-required regression candidates with caplock corpus, and historical JSONL/CSV logs can be imported through an explicit mapping with caplock import.

caplock export outputs the Policy IR as Rego, Cedar, YAML, JSON, or SDK-neutral config, so you can feed your existing gateway. caplock proxy enforces the same IR at a stdio or Streamable HTTP MCP proxy. The proxy is fail-closed, supports allow, deny, and require_approval, and enforces audit/alert/redact/rate-limit obligations. Audit records contain decisions, rule IDs, capability labels, and argument hashes—not raw arguments or tool results.

Requirement: Go 1.24 or newer.

go install github.com/1124875284/caplock/cmd/caplock@latest

Scan a project and write a deterministic lockfile:

caplock scan examples/quickstart
caplock lock examples/quickstart -o examples/quickstart/caplock.lock

Try a bundled fake MCP server with no network or npm:

caplock scan examples/connected --connect
caplock lock examples/connected --connect -o /tmp/caplock-connected.lock

Draft a policy from a natural-language brief, then lint and test it:

caplock draft examples/policy/security-brief.txt \
  --name finance-draft --subject finance-analyst --parent orchestrator \
  -o caplock.yaml
caplock lint caplock.yaml --strict
caplock test caplock.yaml

Run the deterministic 50-case regression and render a SARIF report:

caplock test examples/policy/caplock.yaml
caplock report examples/policy/caplock.yaml --format sarif -o caplock.sarif

Enforce policy in front of a stdio MCP server:

caplock proxy \
  --policy examples/policy/caplock.yaml \
  --subject finance-analyst \
  --audit caplock-audit.jsonl \
  --trace /tmp/caplock-trace.jsonl \
  -- go run ./examples/fake-mcp

The repository also includes a reproducible local-only demo with 33 captured scenarios that exercises every CLI layer, a real stdio MCP handshake, proxy allow/deny/approval, runtime redaction/alert/rate-limit enforcement, trace replay, and the full verification suite. No deployment, remote server, npm package, or network call is involved.

Role What changes
Developer Adding an MCP tool becomes reviewable like changing a dependency: the PR shows the new capability and its policy impact.
Security engineer Natural-language guardrails become testable, regressible, auditable policy artifacts instead of one-off review comments.
Platform owner MCP tool permissions gain a baseline, CI gates, and a concrete runtime enforcement point.
Engineering leader Agent permissions move from invisible configuration risk to a managed engineering asset.

Caplock is not a sandbox, general-purpose gateway, or proof system. It is the artifact and policy layer those systems need upstream: a permission inventory, a testable policy, and a reference enforcement point.

The project ships a Marketplace action named CaplockGate (repository path remains 1124875284/caplock):

- uses: 1124875284/caplock@v0
  with:
    path: .
    lockfile: caplock.lock
    fail-on-change: "true"
    policy: caplock.yaml
    fail-on-policy: "true"

The action builds Caplock from source, refreshes the lockfile, and fails when the committed lockfile drifts or the policy is violated—turning permission review into a first-class CI gate.

git clone https://github.com/1124875284/caplock.git
cd caplock
make build
./bin/caplock version

If you are building MCP agents and want to stop guessing what your agent can do, star the repo, try the 10-minute local path, and wire CaplockGate into your next PR.

── more in #ai-agents 4 stories · sorted by recency
── more on @caplock 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/unlock-the-permissio…] indexed:0 read:5min 2026-12-01 · —