add MCP server for runtime resource lookup#72
Conversation
MCP server exposes loop-engineering patterns, skills, state, budget,
and safety docs as queryable resources via Model Context Protocol.
Agents can query what they need on-demand instead of prompt stuffing.
Resources: registry, config, budget, run-log, safety, patterns/{id},
skills/{name}, state/{file}
Tools: list_patterns, list_skills, list_state_files, get_pattern,
get_skill, get_state, recommend_pattern, estimate_cost
Includes 16 tests, CI gate integration, and MCP config example.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
feat(mcp-server): add MCP server for runtime resource lookup
cobusgreyling
left a comment
There was a problem hiding this comment.
Thanks, CI passed. This is a large addition so I need a bit more time to review the MCP server code before approving. Will follow up soon.
|
Thanks for the heads-up! Take your time with the review. |
…ation tests zod was imported in src/index.ts but only resolved transitively via @modelcontextprotocol/sdk, so the build could break if the SDK changed its zod range. Declare it explicitly in dependencies. Add 4 integration tests that spawn the real server over stdio and exercise the index.ts tool/resource handlers (tools/list, loop_list_patterns, loop_estimate_cost, pattern resource read), complementing the existing resolver-level unit tests. Suite now 20/20 passing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix(mcp-server): declare zod as direct dependency + add server ation tests
cobusgreyling
left a comment
There was a problem hiding this comment.
Strong contribution — MCP runtime lookup is exactly the right direction for reducing prompt stuffing. Not merge-ready yet; a few gaps to close first.
What's good:
zodis now independencies✓ (fixes the issue you flagged)- Committed
dist/matchesloop-audit/loop-initconvention ✓ - CI gate wired in
scripts/ci-validate-gates.sh+ roottest:mcp-server✓ - 16 tests + example config at
examples/mcp/loop-engineering.mcp.json✓ - Resource surface (registry, patterns, skills, state, budget, safety) is well-scoped
Required before merge:
-
Path traversal guard on user-supplied IDs —
loadPatternDoc(root, patternId)doespath.join(root, 'patterns', \${patternId}.md`)with no validation. ApatternIdlike../READMEcould escape. Add an allowlist check againstregistry.yamlids (you already load the registry) or reject any id containing/,\, or..`. -
Same for
get_skill/ skill name args — validate againstlistSkills()results before reading. -
README / discoverability cross-links — add
loop-mcp-serverto:- root
README.mdQuick Links table docs/primitives-matrix.md(MCP row — "reference server ships with this repo")examples/README.md
- root
-
npm publish path — other tools ship as
@cobusgreyling/loop-*on npm. Either:- add a release workflow for
@cobusgreyling/loop-mcp-server, or - document clearly as "run from repo / npx github:" only for v1 (and say so in README)
- add a release workflow for
-
Complete the PR checklist — several boxes still unchecked in the description.
Nice-to-have (can follow in a fast follow PR):
recommend_patterntool: document decision logic or add tests for each picker branchestimate_costtool: delegate toloop-costlogic or note it's approximate- Consider
LOOP_PROJECT_ROOTvalidation (resolve + ensure expected markers likepatterns/registry.yamlexist)
Rebase on latest main when ready — happy to re-review quickly once the path guards and README links land.
|
Thanks again for this — I rebased your branch onto latest What landed on top of your work:
If #87 merges, you'll get full credit in the merge commit. Happy to co-author or adjust anything — shout if you'd prefer to cherry-pick |
feat(mcp-server): runtime resource lookup + path guards (#72)
|
Superseded by #87 (merged) — path guards + docs included. Thanks @KhaiTrang1995! |
…reyling#72) - Allowlist pattern IDs via registry / patterns dir listing - Allowlist state files; reject .. / slashes in user-supplied segments - Add regression tests for traversal attempts - Cross-link from README, primitives matrix, examples README - Document repo-only v1 install in mcp-server README Builds on community PR cobusgreyling#72 by @KhaiTrang1995
Summary
Changes
MCP server exposes loop-engineering patterns, skills, state, budget,
and safety docs as queryable resources via Model Context Protocol.
Agents can query what they need on-demand instead of prompt stuffing.
Resources: registry, config, budget, run-log, safety, patterns/{id},
skills/{name}, state/{file}
Tools: list_patterns, list_skills, list_state_files, get_pattern,
get_skill, get_state, recommend_pattern, estimate_cost
Includes 16 tests, CI gate integration, and MCP config example.
Checklist (from CONTRIBUTING)
STATE.md*examples use.examplesuffixdocs/safety.mdnode tools/loop-audit/dist/cli.js .(or on the starter) and addressed findingsTesting / Dogfood
loop-auditpasses on affected starters or this repoScreenshots / Examples (if UI or command output)
This template enforces the high bar this reference is known for.