npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ctx-mcp

v0.1.0

Published

Decision Trace MCP Server

Readme

ctx-mcp

npm version

Local MCP server for decision trace capture and deterministic explanations.

Requirements

  • Node.js 18+

Install

npm install

Run (stdio MCP server)

npm run dev

Architecture (high level)

flowchart LR
  Client[MCP client] -->|stdio| Server[ctx MCP server]
  Server --> Tools[Trace tools]
  Tools --> Store[(Trace store)]
  Server --> Resources[trace:// resources]
  Store --> Resources

Usage contract (agents)

  • You MUST call trace.start when a user-requested task begins (once intent is clear).
  • You MUST call trace.finish when that task is completed, even if the conversation continues, to mark outcome/status for downstream analysis.
  • Treat a "task" as a single user goal; if the user pivots to a new goal, start a new trace.
  • If a task is completed and the user continues with a new goal, start a new trace (optionally link the prior trace in metadata).

Core tools

  • trace.start
  • trace.add_node
  • trace.add_edge
  • trace.attach_artifact
  • trace.finish
  • trace.query
  • trace.get_subgraph
  • trace.find_paths
  • trace.explain_decision
  • trace.similarity
  • trace.risk_check

Example tool calls

{
  "tool": "trace.start",
  "input": {
    "intent": "Investigate alert",
    "tags": ["incident", "p1"],
    "metadata": { "ticket": "INC-123" }
  }
}
{
  "tool": "trace.add_node",
  "input": {
    "trace_id": "trace-uuid",
    "type": "Decision",
    "summary": "Roll back release",
    "data": { "reason": "error rate spike" },
    "confidence": 0.8
  }
}
{
  "tool": "trace.add_edge",
  "input": {
    "trace_id": "trace-uuid",
    "from_node_id": "decision-node-id",
    "to_node_id": "action-node-id",
    "relation_type": "causes"
  }
}
{
  "tool": "trace.explain_decision",
  "input": {
    "trace_id": "trace-uuid",
    "decision_node_id": "decision-node-id",
    "depth": 4
  }
}
{
  "tool": "trace.similarity",
  "input": {
    "decision_node_id": "decision-node-id",
    "scope": "all",
    "limit": 5
  }
}
{
  "tool": "trace.risk_check",
  "input": {
    "decision_node_id": "decision-node-id",
    "threshold": 0.6
  }
}

Resources

  • trace://{trace_id}
  • trace://{trace_id}/timeline
  • trace://{trace_id}/graph
  • trace://{trace_id}/subgraph?center=...&depth=...&dir=...
  • trace://{trace_id}/explain?decision=...&depth=...
  • trace://search?text=...&trace_id=...&type=...
  • trace://{trace_id}/similarity?decision=...&scope=...&limit=...&depth=...&max_traces=...
  • trace://{trace_id}/risk?decision=...&scope=...&limit=...&depth=...&threshold=...&max_traces=...

MCP config example

{
  "mcpServers": {
    "ctx": {
      "command": "npx",
      "args": ["ctx-mcp"]
    }
  }
}

Testing

npm test

Seed a sample trace

npm run seed

CLI examples

npm run risk-check -- decision-node-id
npm run similarity -- decision-node-id