Skip to main content
Glama
AI Loop Library MCP
by paultaki

AI Loop Library MCP server

Version 2.1.0. A read-only, local MCP server for the AI Loop Library and its 68 bounded work loops. The calling agent uses its knowledge of the operator's project to choose a loop; the server supplies searchable specs, runnable protocols, and design checks.

One Python file, Python 3.9+, standard library only at runtime. No write tools, credentials, model calls, or hosted server to operate.

Install

Download the single file:

mkdir -p ~/.ai-loop-library
curl -fsSL https://ailooplibrary.com/mcp/server.py -o ~/.ai-loop-library/server.py
python3 ~/.ai-loop-library/server.py --self-test
claude mcp add ai-loop-library -- python3 ~/.ai-loop-library/server.py

For Cursor or another stdio client:

{
  "mcpServers": {
    "ai-loop-library": {
      "command": "python3",
      "args": ["/absolute/path/to/server.py"]
    }
  }
}

The standalone repository contains the same server. Run the following from its root, or from mcp/ in the site repository:

python3 server.py --self-test
python3 server.py --eval
pip install -e .
claude mcp add ai-loop-library -- ai-loop-library-mcp

Already installed? Download the file again or update your clone and reinstall, then restart the MCP connection. Existing installations do not update themselves.

Related MCP server: nc-tools-mcp

Tools

Tool

Result

browse_catalog(category?)

Compact catalog digest for the calling agent to judge

search_loops(query, category?, limit?)

Ranked matches with why-matched explanations

get_loop(id_or_slug)

Full spec, canonical URL, verifier classification, loop kind

pick_loop_for_goal(goal, constraints?, limit?)

Lexical shortlist and confidence signal; the calling agent chooses

render_run_protocol(id_or_slug, goal?, risk_posture?, kind?, max_rounds?, max_minutes?)

Markdown protocol and copyable prompt sharing the same stop conditions and approval boundaries

critique_loop(loop_description)

Text-based lint, per-check findings, critical missing checks, and related loops

design_loop(goal, constraints?, cadence?, context?)

New loop scaffold with a suggested domain verifier and explicit TODOs

list_categories()

Category counts and library links

catalog_stats()

Counts, catalog source, update metadata, and cache status

Session protocols honor round and minute caps. Scheduled-tick protocols use experiment logs, per-tick/total spend guidance, and a two-tick no-progress stop. max_rounds and max_minutes apply only to session protocols. Strict posture requires explicit approval for shared-surface actions, including in copied prompts.

The linter recognizes explicit gate language and flags common negations such as "without human approval" or "approval is optional". Critical missing verification, stop, budget, or approval checks prevent a positive overall grade. Text matching cannot establish safety or grant permission, regardless of the numeric score.

Resources: ailooplibrary://catalog and ailooplibrary://loop/{id}. All tools declare readOnlyHint and idempotentHint.

Catalog loading and outages

Resolution order:

  1. AI_LOOP_LIBRARY_CATALOG_PATH: an authoritative local JSON file, using either the catalog.json or data/loops.json shape. An invalid explicit path fails.

  2. AI_LOOP_LIBRARY_CATALOG_URL, defaulting to https://ailooplibrary.com/catalog.json.

  3. Local fallback: catalog.json beside the server, then ../catalog.json, then ../data/loops.json.

The server caches a validated catalog in memory for five minutes. Remote fetches have a ten-second timeout and a 4 MiB response limit. Validation and search indexing finish before a new snapshot replaces the current one.

If refresh and local fallback fail, the server retains its last validated snapshot and waits 60 seconds before retrying. Tool responses include a stale-catalog warning and _meta["ai-loop-library/catalog"] with source, age, and stale status; catalog_stats also includes catalog_status. The cache is process-local and does not survive restart. Changing the configured source invalidates the old snapshot. An initial outage without a valid local catalog returns an error, never sample data. The two-loop embedded sample is reserved for offline tests.

Client compatibility

Supported protocol revisions: 2024-11-05, 2025-03-26, 2025-06-18. Transport: newline-delimited JSON-RPC 2.0 over stdio. Diagnostics go to stderr. Malformed requests and invalid tool arguments return protocol errors without terminating the server. Execution failures return isError: true. Request params and tool arguments must be objects when supplied; omit them for no-argument calls. Explicit null for these objects is intentionally rejected, including for older clients. Nullable individual fields remain supported as declared in each input schema. This validation is a deliberate tightening from 2.0.0.

With 2025-06-18, the six JSON-returning tools advertise output schemas and return structuredContent alongside identical JSON text. Earlier revisions retain the text-only contract. Browse, design, and render tools continue to return Markdown.

Ranking uses IDF-weighted keyword overlap, light stemming, synonyms, and category hints. It is a browsing aid, not a model judgment or constraint solver.

Verification and development

From the directory containing server.py:

python3 -m venv .venv
. .venv/bin/activate
pip install -e '.[test]'
python -m unittest -v test_server
python server.py --self-test
python server.py --eval

The runtime has no third-party dependencies. The optional test dependency, jsonschema, independently validates advertised schemas and real tool results. The 43 offline self-checks and 20 golden ranking queries remain separate from the regression suite, which covers request recovery, argument validation, old-client compatibility, protocol fidelity, lint negation, domain routing, and cache outages. CI runs these gates on Python 3.9 and 3.13.

Release invariant: the site and standalone repositories must ship identical server.py, README.md, pyproject.toml, and test_server.py files. Version metadata must match SERVER_VERSION; the standalone server.json is a registry submission manifest, not proof that a PyPI or registry publication has occurred.

Available Tools

9 tools
browse_catalogA
Read-onlyIdempotent

The entire AI Loop Library as a compact digest (~2k tokens): every loop's id, category, one-line use_when, and verifier strength. This is the highest-signal single call here — you know the operator's repo, data, and recurring pain, so scan the digest against that context and make the pick yourself. Follow with get_loop for depth or render_run_protocol to run one.

Inputs: category.

catalog_statsA
Read-onlyIdempotent

Catalog overview: loop count, categories, featured loops, last_updated, and where the catalog was loaded from.

Inputs: no named parameters. Returns: loop_count, catalog_source, catalog_status, category_count

critique_loopA
Read-onlyIdempotent

Lint any loop design — the operator's own, or one you drafted — against the AI Loop Library anti-pattern rubric: verifier present and objective, stop condition, budget, one-change-per-round, durable state, same-check-every-round, micro-metric objective (MVL), human gates on risky surfaces, defined trigger. Returns a 0–10 score, per-check fixes, and related catalog loops. Deterministic text lint, not a model — 'missing' means 'not stated'.

Inputs: loop_description (required). Returns: grade, score, findings, critical_missing

design_loopA
Read-onlyIdempotent

Scaffold a NEW loop spec from a stated bottleneck when no catalog loop fits: returns a draft with every required field (trigger, scope, one-round action, suggested verifier for the domain, state files, stop conditions, budget, risk colors), an MVL sanity check on the objective, and the nearest existing loops to steal structure from. Follow with critique_loop on the completed draft.

Inputs: goal (required), cadence, context, constraints.

get_loopA
Read-onlyIdempotent

Fetch one loop's full spec by id or slug: objective, trigger, allowed actions, verification (+ verifier strength), stop condition, budget, approval boundary, copyable prompt, and canonical URL. Use after browse_catalog or search_loops.

Inputs: id_or_slug (required). Returns: id, url, title, summary, +1 more

list_categoriesB
Read-onlyIdempotent

List loop categories with live counts and library filter URLs.

Inputs: no named parameters. Returns: categories

pick_loop_for_goalA
Read-onlyIdempotent

Shortlist the best-matching loops for a stated goal (lexical ranking with an honest confidence signal) — you make the final call. Returns 5 candidates with use_when, verification, and why-matched so you can judge against operator context the server can't see. When confidence is low, trust your own read of browse_catalog over this ranking. Follow with render_run_protocol for the executable version.

Inputs: goal (required), limit, constraints. Returns: goal, shortlist, confidence

render_run_protocolA
Read-onlyIdempotent

Render a loop as an executable markdown run protocol an agent can follow directly: objective/done contract, allowed actions, one-change-per-round rule, the same verification every round, a durable state-file skeleton, stop conditions, budget, risk-colored approval boundary, proof format, and a paste-ready Claude Code prompt. Session loops get bounded rounds; scheduled-tick business loops (SEO, ads, product metrics) get experiment logs, undo-losers discipline, and notify-the-human ticks.

Inputs: id_or_slug (required), goal, kind, max_rounds, +2 more.

search_loopsA
Read-onlyIdempotent

Search AI Loop Library's bounded, verifiable work loops by job-to-be-done, keyword, or category. Each loop ships with a trigger, one-change-per-round discipline, a verification check, a stop condition, a budget, and a human approval boundary — so an agent can run it without thrashing. Returns ranked matches with a one-line why-matched.

Inputs: query (required), limit, category. Returns: results

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 9 tools

    Disambiguation4/5

    Most tools have distinct roles (get_loop vs render_run_protocol, critique_loop vs design_loop). However, browse_catalog, search_loops, and pick_loop_for_goal all help discover loops, and their boundaries—especially between search and pick—require reading descriptions to avoid misselection.

    Naming Consistency4/5

    Most names follow a clear verb_noun snake_case pattern (browse_catalog, search_loops, get_loop, critique_loop, design_loop, list_categories). Minor deviation: catalog_stats is a noun phrase rather than verb-led, inconsistent with the rest.

    Tool Count5/5

    Nine tools are well-scoped for a library browse/curate/design server. Each tool earns its place across discovery, inspection, rendering, critique, design, and metadata.

    Completeness4/5

    The surface covers discovery (browse/search/pick), depth (get_loop), execution (render_run_protocol), quality (critique_loop), creation (design_loop), and metadata (list_categories/catalog_stats). A gap remains for updating or managing existing loop entries, but that may be out of scope.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables coding agents to perform file, search, patch, git, process, test, package, network, and system operations through 60 typed MCP tools with structured inputs/outputs, structured errors, and a full event journal, replacing terminal use with a typed machine API.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides coding agents with structured planning, persistent project memory, automated verification, and safety permission controls through MCP tools, enabling better planning, context retention, self-checking, and guarded execution.
      1 npm
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables coding agents to make offline, zero-cost decisions using schema-safe Choice/Score/Noul primitives, a confidence gatekeeper, planning, adversarial red-teaming, research, and RLVR-based self-improvement via 21 MCP tools.
      24
      7
      MIT