Skip to content

About

Read-only MCP endpoint for the Context Stack: discover the framework, route a problem to the right layer, and read canonical sources.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

context-stack-mcp

Cloudflare Worker MCP endpoint for the Context Stack. It serves the stack's canonical resources and doctrine to AI clients.

Probabilistic intelligence must operate inside deterministic governance boundaries.

This read-only server lets AI clients discover the stack, read canonical resources, choose the correct project entry point, and generate first-pass governance guidance.

The optional /advisor endpoint is an explanation layer over a route selected by the existing deterministic assessment. It uses Workers AI only to explain the selected public documents; it does not select or enforce a route.

Status

v0.1 is live at:

https://mcp.context-stack.org/mcp

Health endpoint:

https://mcp.context-stack.org/health

What It Exposes

Resources

  • context-stack://overview
  • context-stack://glossary
  • context-stack://decisions
  • context-stack://contextops/framework
  • context-stack://contextops/manifest
  • context-stack://contextboundary/framework
  • context-stack://contextboundary/rationale
  • context-stack://sthala/spec
  • context-stack://griha/readme

Tools

  • get_stack_overview
  • get_project
  • recommend_project
  • get_glossary_term
  • list_stack_resources

Prompts

  • choose_stack_entry_point
  • run_contextops_assessment
  • classify_contextboundary_egress
  • map_sthala_deployment
  • build_ai_governance_adoption_plan

Explanation advisor

Send a JSON POST to /advisor with a deterministic routeKey (context, egress, runtime, delivery, or unsure) and a question. Successful responses include the fixed route, model-generated explanation, selected public source identifiers, and model/application/Worker provenance. The endpoint returns no prose when the budget, rate limit, source retrieval, model call, or output validation fails.

Local Run

Requires Node.js 20 or later and Wrangler.

npm test
npm start

Health check:

curl http://127.0.0.1:8787/health

MCP 2026-07-28 discovery call:

curl -X POST http://127.0.0.1:8787/mcp \
  -H "content-type: application/json" \
  -H "MCP-Protocol-Version: 2026-07-28" \
  -H "Mcp-Method: server/discover" \
  -d '{"jsonrpc":"2.0","id":"discover-1","method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{"name":"curl","version":"1.0.0"},"io.modelcontextprotocol/clientCapabilities":{}}}}'

Versioning note

For interoperability, this server accepts a Streamable HTTP request carrying only the MCP-Protocol-Version header, without a protocol-version declaration in body _meta. MCP 2026-07-28 expects both values, with the header mirroring the body value. This is a deliberate interoperability allowance. When both are present and differ, the server rejects the request with HeaderMismatch (-32020) and HTTP 400.

Legacy MCP initialize call remains supported during client cutover:

curl -X POST http://127.0.0.1:8787/mcp \
  -H "content-type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18"}}'

Tool call:

curl -X POST http://127.0.0.1:8787/mcp \
  -H "content-type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"recommend_project","arguments":{"question":"We need to govern data egress from an AI agent."}}}'

Live tool list:

curl -X POST https://mcp.context-stack.org/mcp \
  -H "content-type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

Live project recommendation:

curl -X POST https://mcp.context-stack.org/mcp \
  -H "content-type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"recommend_project","arguments":{"question":"We need to assess stale context after AMS handover."}}}'

Design Choices

  • Read tools are source-routed through the canonical stack catalog.
  • No content database; the advisor budget Durable Object stores numeric counters only.
  • No stored user prompts, assessment answers, or organization data.
  • Resources point to canonical GitHub project files.
  • No GitHub token or other write credential is required.
  • The server does not replace any stack repo. It routes agents to the correct source.
  • The server is for discovery and decision support, not policy enforcement.
  • The advisor question is sent to Cloudflare Workers AI for processing; it is not stored, logged, or used to train a model.

Privacy-Safe Logging

The server logs method-level operational metadata only:

mcp method=POST path=/mcp status=200 duration_ms=8 rpc=tools/list outcome=ok
mcp method=POST path=/mcp status=200 duration_ms=14 rpc=tools/call tool=recommend_project outcome=ok
mcp method=POST path=/mcp status=200 duration_ms=42 rpc=resources/read resource=context-stack://glossary outcome=ok
http method=POST path=/advisor status=200 duration_ms=80 route=advisor

It does not log prompts, tool arguments, assessment answers, or organization-specific content.

Part of the Stack

ContextOps and ContextBoundary are the specification layer. contextboundary-gw, Sthala and Griha are reference implementations that apply it. The composition is defined once, in COMPOSITION.md.

context-stack-mcp is not part of the composition. It is the stack's access path: an assistant-facing MCP endpoint that routes agents to each repository's own files.

Deployment

See docs/DEPLOYMENT.md.

Privacy

See docs/PRIVACY.md.

License

Apache 2.0.

About

Read-only MCP endpoint for the Context Stack: discover the framework, route a problem to the right layer, and read canonical sources.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages