agent-skills-standard-mcp

v0.8.5
agent-skills-standard-mcp Checked 1 hour ago Published 13 days ago

MCP server that lets any AI agent (Claude, Cursor, Antigravity, Kiro, Continue, Gemini) load and audit skills from agent-skills-standard.

MCP server that lets any AI agent — Claude Code, Cursor, Antigravity, Kiro, Continue, Gemini CLI — load and audit skills from agent-skills-standard via Model Context Protocol tool calls. Makes standards consultation explicit: AGENTS.md and _INDEX.md are passive prompt context, while this MCP returns standards through auditable tool calls. Each agent or sub-agent must perform its own applicable lookup; parent-session consultation does not prove fresh-worker delivery or enforced behavior.

Summary extracted from the README.

agent-skills-standard-mcp

MCP server that lets any AI agent — Claude Code, Cursor, Antigravity, Kiro, Continue, Gemini CLI — load and audit skills from agent-skills-standard via Model Context Protocol tool calls.

Makes standards consultation explicit: AGENTS.md and _INDEX.md are passive prompt context, while this MCP returns standards through auditable tool calls. Each agent or sub-agent must perform its own applicable lookup; parent-session consultation does not prove fresh-worker delivery or enforced behavior.

Current release: v0.8.2 — explicit consultation auditing, session accounting, retrospective tooling, package-aligned security fixes, and supported streamable HTTP request handling. Per-release detail: CHANGELOG.

High-Density Architecture (Zero-Trust)

This MCP follows the Core Architecture inspired by Rust Token Killer (RTK) to achieve a "Zero-Trust" environment:

  1. Lazy Loading: Skills are NOT pre-loaded into the AI's limited context. The MCP serves them on-demand via the load_skills_for_files tool.
  2. Tiered Resolution: Implements the same router-index model used in the CLI. Broad globs match only for "Base" skills (e.g., typescript-language), while specialized skills (e.g., nestjs-security) must match specific keywords or path substrings.
  3. Cross-Agent Compatibility: Maps to the "Integration Taxonomy" (VS Code Copilot instructions, Cursor hooks, Windsurf rule persistence, etc.) documented in ARCHITECTURE.md.

What it does

Tool What it returns
list_workflows() Returns available standard operating procedures (e.g. dev-fix, plan-feature).
get_workflow(name) Returns exact step-by-step markdown instructions for a specific workflow.
load_skills_for_files(files) Matches files against the router and returns the matched SKILL.md content. Call before editing.
load_skills_for_keywords(keywords) Matches concept words against keyword triggers. Use for tasks that don't reference a file yet.
get_skill(category, name) Direct lookup for a known skill.
list_categories() Returns categories, file extensions they handle, and skill counts.
audit_session_compliance() Returns which skills were loaded this session and the tool calls that loaded them.

The server honours the same tier model as agent-skills-standard's index generator: broad globs (**/*.dart) only match if the skill is the registered base_language_skills for that category. Everything else is demoted to keyword match.

Consultation is not enforcement

list_workflows and list_categories record catalog discovery, not fetched bodies. get_workflow records returned workflow bodies; get_category_guide records a real category-guide body separately from SKILL.md bodies, and a missing guide counts neither. Session totals deduplicate body identities. Local count-only telemetry's categories field counts actual guide returns, not catalog listings.

audit_session_compliance and get_session_cost describe observations in the current MCP process. They do not observe edits, executed checks, compliance with instructions, or delivery of full bodies into another worker's outgoing request. Host runtime evidence is required for those claims; a reset MCP process starts a new consultation ledger.

Project policy (.ags/policy.json)

When a project defines .ags/policy.json, the MCP server automatically reads it synchronously and re-reads it whenever the file's modification time changes.

  • load_skills_for_files: appends matching protected_path rules and required_check items under ## Project policy for these files.
  • audit_session_compliance: appends ## Policy-declared candidate checks for lookup paths for paths supplied to skill lookups. These paths are not observed edits, and candidate checks are neither confirmed applicable nor recorded as executed.

[!NOTE] Policy rules surfaced by the MCP are advisory and designed to prevent mistakes by cooperating agents; they are not a security boundary.

Install

The easiest path is to let the CLI wire it for you:

npx agent-skills-standard@latest init    # asks about MCP during setup
npx agent-skills-standard@latest sync    # installs MCP at the chosen scope

Or manage afterwards via the mcp subcommand:

ags mcp status              # Show current state
ags mcp enable              # Turn on
ags mcp scope project       # Project-only writes (recommended)
ags mcp install             # Apply changes

To install or run the MCP standalone:

npx -y --prefer-offline agent-skills-standard-mcp@0.8.1

# Or build from source
pnpm install && pnpm mcp:build
node mcp/dist/index.js

Native session accounting (MCP 0.7.0 source candidate)

The candidate adds ags-mcp-session-report --manifest <manifest.json> [--json] for explicitly selected Codex JSONL and OMP v3 journals. It retains OMP model-usage calls and orchestration/cache-write buckets separately from transcript and conversation counters; absent submetrics stay unknown, and oversized journals stop at the first resource limit. It reports aggregate counters and inventory coverage only; it does not discover host activity or infer prices. See SESSION_REPORT.md for the manifest, counter semantics, unknown values, and privacy limits. Real-journal use remains subject to separate Personal-journal authorization.

Session retrospectives (ags retrospective)

The package ships three stdio-only MCP tools plus a retrospective subcommand; it is inert until a human opts in with ags retrospective enable in an interactive terminal.

  • prepare_retrospective, get_retrospective_status, and prepare_retrospective_index are registered only when the transport is stdio (mcp/src/server.ts checks transport === "stdio"). They are absent on SSE and on the HTTP server, which pins transport: "sse" in createMcpHttpApp so an ambient MCP_TRANSPORT cannot widen the surface. prepare_retrospective accepts an optional title input (max 200 chars, displayed as "agent-supplied, unverified") and is for the orchestrator or an unassigned agent — a worker holding an assignment packet must not call it; get_retrospective_status reports consent state only; prepare_retrospective_index accepts optional since, until, and folder (max 120 chars) and writes <storeRoot>/index.html across stored sessions (it is a housekeeping tool and does not advance the substantive nudge counter).
  • There is no separate ags-retrospective binary. The human-facing command is ags retrospective <action> (in the agent-skills-standard CLI), which runs the pinned agent-skills-standard-mcp package (agent-skills-standard-mcp retrospective <action> is the same thing and works directly without ags). Until an ags release pins an MCP version containing this feature (0.8.0 or newer), ags retrospective refuses with a version message, and a pre-release build can be tested with AGS_MCP_PACKAGE_SPEC=file:/absolute/path/agent-skills-standard-mcp-<version>.tgz (a file: prefix is required; a bare path is run as a command by npx). The package declares an exports map (".", "./session-journal-cli", "./package.json", "./README.md", "./SESSION_REPORT.md", and "./dist/*" retained so existing deep imports keep working). None of it is in a published release: no registry version ships these tools or this binary. Locally, the fresh build, the MCP suite, and a packed-tarball consumer smoke pass on macOS; redaction, git-arg, and environment rules were mutation-checked; an earlier tsup --dts attempt had failed against the installed TypeScript compiler API and that failure is kept as history, with the temporary compatibility dev dependency removed. Host integration is still not claimed.

Opt-in is a one-time human action; an agent can never do it (no terminal, no flag, no tool). enable requires an interactive terminal, prints the fixed consent text with the store root and the exact source roots that will be read on stderr, accepts only the exact word yes, and otherwise writes nothing (TTY_REQUIRED, CONSENT_DECLINED). The default store root is ~/ags/diagnostics; default source roots are those that exist among ~/.omp/agent/sessions and ~/.codex/sessions, and --source-root (repeatable, absolute, must exist) replaces them; none left is NO_SOURCE_ROOTS. A separate, non-consented section of the prompt discloses any existing ~/.claude/projects or ~/.gemini/tmp folder by presence only — one lstat, no enumeration, no read, nothing added to the consent record, and no claim that the provider is running. Separately, the overlap refusal canonicalizes the candidate root and store paths (symlinks resolved through existing ancestors, path metadata only) before the prompt, and the consent text states that. stdout stays one JSON line.

ags retrospective enable [--store-root <absolute>] [--source-root <absolute>]...
ags retrospective disable
ags retrospective status
ags retrospective index [--since YYYY-MM-DD] [--until YYYY-MM-DD] [--folder NAME]

enable prints {"schemaVersion":1,"enabled":true}. disable needs no terminal and prints {"schemaVersion":1,"enabled":false,"removed":<boolean>}. status (forwarded as consent-status in the package) prints {"schemaVersion":1,"state":"enabled","storeRoot":<path>,"allowedSourceRoots":[...]} or {"schemaVersion":1,"state":"disabled","reason":"<missing|invalid|permissive|symlink|version>"}; a missing record is an ordinary disabled result, not an error; pre-existing version 1, 2 and 3 consent records fail closed as disabled with reason version until enable is re-run. The consent file is owner-only and read fail-closed — missing, empty, malformed, unknown keys, relative paths, wrong version, group/other readable, symlink or non-regular each count as disabled:

  • POSIX: $XDG_CONFIG_HOME/agent-skills-standard/retrospective-consent.json when XDG_CONFIG_HOME is set and absolute, else ~/.config/agent-skills-standard/retrospective-consent.json.
  • Windows: %APPDATA%\agent-skills-standard\retrospective-consent.json.

Contract constraints to preserve when the binary ships:

  • stdout is exactly one JSON line. index prints {"schemaVersion":1,"state":"written","path":<path>,"sessions":<number>,"omitted":<number>,"unreadable":<number>,"since":<string|null>,"until":<string|null>}.
  • Refusals print {"schemaVersion":1,"error":{"code":"<STABLE_CODE>"}} to stderr — code only, never a manifest path, fs/runtime message, stack trace or file content. Codes include TTY_REQUIRED, CONSENT_DECLINED, NO_SOURCE_ROOTS, SOURCE_ROOT_UNSUPPORTED_STORE, SOURCE_ROOT_CANONICALIZATION_FAILED, ROOT_PERMISSIVE, ROOT_SYMLINK, ROOT_OWNER_MISMATCH, PRIVATE_MODE, STORE_ROOT_INSIDE_PROJECT, STORE_ROOT_UNRESOLVED, INVALID_DATE, INVALID_RANGE, INVALID_FOLDER, FAILED. An existing root with group/other permissions is ROOT_PERMISSIVE; remediate with mkdir -m 700 or chmod 700 on a dedicated directory, never a shared/synced folder.
  • Exit codes: usage 2, refusal or failure 1, successful index publication 0.
  • Three tools are exposed on stdio: prepare_retrospective, get_retrospective_status, and prepare_retrospective_index. They never return transcript text or report bodies — only state, numbers, an artifact id, or paths (summary.md, ledger.json, report.html, or <storeRoot>/index.html); file contents stay on local disk.

Full behaviour, privacy model and host versions: ../docs/session-retrospective.md, with the privacy boundary in ../docs/session-retrospective-privacy.md and provider coverage in ../docs/session-retrospective-hosts.md. Status: published in 0.8.0 and inert until consent; fresh build, passing MCP test suite and packed-tarball consumer smoke pass locally on macOS. No host-integration, Windows/Linux or process-level egress claim is made; no CI job runs on Windows. Skill, workflow and rule text that would trigger prepare_retrospective is not part of this change; it arrives later, after a value pilot.

Faster startup: one global install

Every MCP client spawns the server as a fresh process, and an npx launch pays npm package resolution each time. On a warm npm cache, measured locally on macOS: ≈0.6s per npx spawn versus ≈0.17s for the direct global binary (npx --offline was ≈0.49s). Those are local warm-cache numbers, not a universal benchmark — but the relative ordering is why a global install exists.

npm i -g agent-skills-standard-mcp@0.8.1   # must match the CLI pin
ags-mcp --version                          # prints the semver it reports
ags mcp via auto                           # use it only when the version matches

Selecting global mode (ags mcp via global) and running ags mcp enable makes the CLI run the pinned global install for you and verify the reported version, exiting 1 without saving enabled state or writing configs if it does not match the pin. ags mcp enable --install-global remains available as an explicit trigger for the same install. With via: auto (the default), a global binary is used only when ags-mcp --version exactly equals the CLI pin; otherwise the client falls back to the pinned npx line, so a stale global can never serve a mismatched tool surface. On Windows, auto always stays on npx.

~/.npm/_npx is machine-global and keyed by package spec, so several worktrees pointed at the same pin share one cached download — they do not re-download, though each client spawn still pays the resolution cost.

Configure your AI agent

The server uses stdio transport — every MCP-capable runtime supports it.

Claude Code

Add to .mcp.json (project-local) or ~/.claude/.mcp.json (global):

{
  "mcpServers": {
    "agent-skills-standard": {
      "command": "npx",
      "args": ["-y", "--prefer-offline", "agent-skills-standard-mcp@0.8.1"]
    }
  }
}

If you installed the server globally (see Faster startup), the same entry is just:

{
  "mcpServers": {
    "agent-skills-standard": {
      "command": "ags-mcp"
    }
  }
}

Every runtime below accepts either shape; only the command/args pair changes.

Cursor

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "agent-skills-standard": {
      "command": "npx",
      "args": ["-y", "--prefer-offline", "agent-skills-standard-mcp@0.8.1"]
    }
  }
}

Continue

Add to ~/.continue/config.json under experimental.modelContextProtocolServers:

{
  "experimental": {
    "modelContextProtocolServers": [
      {
        "transport": {
          "type": "stdio",
          "command": "npx",
          "args": ["-y", "--prefer-offline", "agent-skills-standard-mcp@0.8.1"]
        }
      }
    ]
  }
}

Gemini CLI

Add to ~/.gemini/settings.json:

{
  "mcpServers": {
    "agent-skills-standard": {
      "command": "npx",
      "args": ["-y", "--prefer-offline", "agent-skills-standard-mcp@0.8.1"]
    }
  }
}

Antigravity / Kiro / Windsurf / Trae

All accept the same stdio config. Consult each runtime's MCP docs for the exact file path; the command/args shape is identical.

Transport Modes

The server supports two transport modes: stdio (default) and sse (HTTP).

Mode Transport Use Case
stdio Standard I/O Desktop AI agents (Claude Code, Cursor, Antigravity, etc.) where the agent spawns the server as a subprocess.
sse HTTP (SSE) Remote or containerized agents (GoClaw, Cloud Run) that connect over the network.

Stdio Mode (Default)

Used by most IDE-based agents. No extra configuration required. The agent manages the process lifecycle.

HTTP Mode (SSE)

To run the MCP as a standalone HTTP service (e.g., for GoClaw agents):

export MCP_TRANSPORT=sse
export PORT=8768
npx -y --prefer-offline agent-skills-standard-mcp@0.8.1

HTTP mode is stateless. Each request uses a fresh MCP server and transport, so clients can initialize and then make subsequent tool calls without a server-side session.

Usage Telemetry (Opt-In)

Off by default. Set these to write a local, counts-only JSONL usage log (see docs/FRESHNESS.md):

export AGS_TELEMETRY=1
export AGS_TELEMETRY_PATH=~/.agent-skills-standard/telemetry.jsonl

GoClaw Configuration

Add to your config.json:

{
  "tools": {
    "mcp_servers": {
      "skills": {
        "transport": "streamable-http",
        "url": "http://agent-skills-mcp:8768/sse",
        "tool_prefix": "ags_",
        "timeout_sec": 15
      }
    }
  }
}

Note: GoClaw's streamable-http expects the SSE endpoint. Use the /sse path.

How an agent uses it

Recommended sub-agent prompt addition (works in every runtime):

Before editing any file, you MUST call load_skills_for_files(files=[...])
on the MCP server "agent-skills-standard". Use the returned SKILL.md content as
authoritative project rules — they override your pre-training patterns.

Before claiming a task complete, call audit_session_compliance() and
verify the relevant skills were loaded.

Walkthrough — NestJS backend feature

Picture a developer in Cursor or Claude Code asking:

"Add a POST /orders endpoint that validates the body and returns 201."

Here's what happens with the MCP, step by step.

1. Agent identifies the file it will touch

src/orders/orders.controller.ts

2. Agent calls the MCP — BEFORE writing any code

// Tool call from the agent
{
  "name": "load_skills_for_files",
  "arguments": { "files": ["src/orders/orders.controller.ts"] },
}

3. The MCP returns 11 skills — direct + composite

matched-by                                   skill
──────────────────────────────────────────  ─────────────────────────────────────
file:**/*.ts                                 typescript/typescript-language
file:**/*.controller.ts                      nestjs/nestjs-api-standards
file:**/*.controller.ts                      nestjs/nestjs-controllers-services
file:**/*.controller.ts                      nestjs/nestjs-file-uploads
file:**/*.controller.ts                      nestjs/nestjs-real-time
file:**/*.controller.ts                      nestjs/nestjs-transport
composite via typescript/typescript-language common/common-best-practices
composite via nestjs/nestjs-api-standards    common/common-api-design
composite via nestjs/nestjs-file-uploads     common/common-security-standards
composite via nestjs/nestjs-real-time        common/common-performance-engineering
composite via nestjs/nestjs-transport        system-design/system-design-principles

4. The agent now has these team rules in context

From skill Rule the agent now follows
typescript-language Strict typing, unknown over any, satisfies operator
nestjs-controllers-services Controllers stay thin; logic lives in services
nestjs-api-standards DTOs with class-validator, consistent error envelopes
nestjs-transport @HttpCode(201), ParseUUIDPipe, response shape
common-best-practices Functions < 30 lines, guard clauses, intention-revealing names
common-api-design Status codes, pagination, idempotency, OpenAPI conventions
common-security-standards Authn/authz, input sanitization, secret handling
system-design-principles Module boundaries, coupling rules
common-performance-engineering Async patterns, N+1 query checks

5. The agent writes the code AND calls the audit before claiming done

{ "name": "audit_session_compliance" }
# Session compliance
Skills loaded: 11
- common/common-api-design
- common/common-best-practices
- common/common-performance-engineering
- common/common-security-standards
- system-design/system-design-principles
- nestjs/nestjs-api-standards
- nestjs/nestjs-controllers-services
- nestjs/nestjs-file-uploads
- nestjs/nestjs-real-time
- nestjs/nestjs-transport
- typescript/typescript-language

What the same scenario looks like WITHOUT the MCP

The agent reads AGENTS.md (maybe), walks the router (maybe), reads the matched _INDEX.md (maybe), and reads matched SKILL.md files (often skipped — especially in sub-agents that don't inherit CLAUDE.md). Result:

With MCP Without MCP
typescript-language rules ✅ Loaded ⚠️ Sometimes
nestjs-* framework rules ✅ All 5 loaded ⚠️ One or two if lucky
common-best-practices (function size, naming, guard clauses) ✅ Loaded via composite ❌ Almost never
common-api-design (status codes, pagination) ✅ Loaded via composite ❌ Almost never
common-security-standards (input validation, auth) ✅ Loaded via composite ❌ Almost never
Session-local record of standards body returns ✅ audit_session_compliance ❌ No MCP consultation record
Sub-agent standards delivery Each child must load its own standards Depends on the host's context setup

The MCP makes applicable standards available through explicit lookups. Whether a runtime invokes those lookups, delivers full bodies, and follows them requires separate host and behavioral evidence.

Project resolution

The server looks for skills in this order:

  1. SKILLS_PROJECT_ROOT environment variable
  2. The current working directory (must contain AGENTS.md)
  3. Walks up from cwd until it finds AGENTS.md

Within that root, it auto-detects the skills directory by checking: skills/, .claude/skills/, .cursor/skills/, .gemini/skills/, .kiro/skills/, .windsurf/skills/, .continue/skills/, .antigravity/skills/, .trae/skills/, .roo/skills/.

Development

pnpm mcp:dev    # tsx watch mode
pnpm mcp:test   # vitest
pnpm mcp:build  # tsup + tsc declarations → mcp/dist/

Workflow Telemetry Integration

common-telemetry defines the reporting contract, but the host runtime is what actually decides when a workflow starts and when it reaches a terminal state.

The reusable helper lives in mcp/src/services/WorkflowTelemetry.ts. It gives host runtimes a small adapter surface to:

  • merge provider usage as it becomes available
  • merge model pricing, cache discounts, reasoning rates, and other billed cost
  • trigger get_session_cost() only when the active workflow ends in completed, failed, or blocked

For a concrete wiring example, see mcp/examples/workflow-telemetry-adapter.ts. That sample is intended for Codex wrappers, OpenClaw, GoClaw, or any orchestration layer that already receives usage metadata from API responses, billing hooks, or runtime logs.

The MCP itself tracks only MCP-observed session telemetry. Exact workflow-end token cost becomes available when the host passes:

  • promptTokens
  • cachedPromptTokens
  • completionTokens
  • reasoningTokens
  • inputCostPer1M
  • cachedInputCostPer1M
  • outputCostPer1M
  • reasoningCostPer1M
  • optional otherCost

This MCP stays focused on serving skills, workflows, compliance checks, and session telemetry. Review conclusions should remain workflow- and skill-driven, usually as markdown artifacts or direct handoff messages, rather than a separate MCP-owned review artifact subsystem.

Smoke test the built binary:

(printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"smoke","version":"0"}}}' \
  '{"jsonrpc":"2.0","method":"notifications/initialized"}' \
  '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'; sleep 1) \
  | node mcp/dist/index.js

Token economics

  • Tool schemas: ~800 tokens per session (8 tools, terse descriptions). Negligible vs typical multi-tool MCP baselines.
  • Per-load cost: equivalent to the agent reading the matched SKILL.md or workflow files itself — the MCP saves round-trips by batching matches into one call.
  • Tier-model demotion: prevents broad-glob skills from ballooning the response. A typical .dart file edit returns 2-3 skills (~3-5 KB), not the whole flutter category.

Architecture

mcp/
├── src/
│   ├── index.ts                    # bin entry, stdio transport
│   ├── server.ts                   # MCP server + tool registration
│   ├── config.ts                   # project-root resolution
│   ├── services/
│   │   ├── SkillIndex.ts           # in-memory index + matcher (tier model)
│   │   ├── SkillParser.ts          # SKILL.md frontmatter parser
│   │   ├── WorkflowIndex.ts        # workflow discovery & markdown extraction
│   │   ├── SessionTracker.ts       # session telemetry + audit log
│   │   └── WorkflowTelemetry.ts    # host-side workflow cost helpers
│   └── tools/
│       └── index.ts                # 8 tool handlers
├── examples/
│   └── workflow-telemetry-adapter.ts # example host runtime integration
└── test/
    ├── SkillIndex.spec.ts          # 19 unit tests
    ├── Tools.spec.ts               # tool + telemetry unit tests
    ├── WorkflowTelemetry.spec.ts   # workflow-end telemetry helper tests
    └── WorkflowIndex.spec.ts       # 5 unit tests

Best-practices alignment

This server is designed against the published MCP best-practices guides:

Practice Source Implementation
Server Instructions field awesome-mcp-best-practices §2.1 SERVER_INSTRUCTIONS block delivered to every connecting client via McpServer({...}, { instructions })
Avoid "not found" responses awesome §1.4 No-match responses list available categories + suggest next call; get_skill misses suggest closest matches
Tool descriptions with <use_case> / <aliases> / <important_notes> awesome §1.3 All tool descriptions structured
Don't 1:1 map APIs to tools awesome §3.2 8 high-level use-case tools, no raw filesystem primitives
Single Responsibility modelcontextprotocol.info Skills only — no auth/files/DB concerns mixed in
Inversion of control / transport-agnostic awesome §3.1 buildServer() returns server abstracted from transport; index.ts wires stdio
Configuration externalization mcp.info SKILLS_PROJECT_ROOT env var + auto-detect across 10 candidate paths
Cache costly operations mcp.info SkillIndex loaded once at startup, in-memory after
Stderr logging only (stdout = JSON-RPC) MCP transport spec All logs use process.stderr.write
Graceful degradation when skills absent mcp.info §Fail-Safe Server starts even with no skills; tools return setup guidance instead of crashing
Sanitized error messages awesome security Error responses describe the gap functionally without leaking absolute paths

License

MIT