Skip to main content
Glama

mcp-cage

A hand-rolled Model Context Protocol server. No SDK: the JSON-RPC handshake, framing, and dispatch are implemented directly from the protocol spec, with zero runtime dependencies. The eventual goal is a server that exposes sandboxed shell/file tools behind a declarative policy file — scoping paths, rate-limiting calls, and redacting secrets from tool results — with every request, policy decision, and response logged to a replayable JSONL audit trail.

Status

This project is built autonomously, one milestone at a time, and gated on a passing test suite — no change ships unless npm test is green.

Current milestone: protocol core. The server implements the MCP stdio handshake (initialize, notifications/initialized, tools/list, tools/call) with one demo tool. Sandboxed shell/file tools, the policy engine, secret redaction, and the audit trail are not implemented yet and will land in later milestones.

Related MCP server: MPC-PoC-1-EchoServerToolsbasicas

Install

Requires Node.js 18 or later. No external packages are installed.

npm install

Usage

Run the server directly; it speaks newline-delimited JSON-RPC 2.0 over stdin/stdout, per the MCP stdio transport:

npm start

Or point any MCP-compatible client at the binary:

node ./bin/mcp-cage.js

Example session (one JSON object per line on stdin, one back on stdout):

// -> initialize
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"example"}}}
// <- result with serverInfo and the protocol version the server supports
{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2024-11-05","capabilities":{"tools":{}},"serverInfo":{"name":"mcp-cage","version":"0.1.0"}}}

// -> tell the server the client is ready (no response expected)
{"jsonrpc":"2.0","method":"notifications/initialized"}

// -> list tools
{"jsonrpc":"2.0","id":2,"method":"tools/list"}
{"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"echo","description":"Returns the given text back unchanged.","inputSchema":{"type":"object","properties":{"text":{"type":"string"}},"required":["text"],"additionalProperties":false}}]}}

// -> call a tool
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"echo","arguments":{"text":"hello"}}}
{"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"hello"}]}}

Run the test suite:

npm test

Dependencies

None. Node's built-in node:test, node:assert, and node:child_process modules cover everything this milestone needs — a line-delimited JSON codec and a JSON-RPC dispatcher are both small enough to not justify pulling in a package.

What this demonstrates

  • Model Context Protocol — a server that speaks MCP's JSON-RPC handshake and exposes a tool over it, built directly from the spec rather than an SDK. The line-framed JSON-RPC codec is in src/jsonrpc.js; the initialize / notifications/initialized / tools/list / tools/call method dispatch and the handshake state machine are in createDispatcher in src/protocol.js; the stdio wiring that turns stdin lines into dispatcher calls and writes responses back to stdout is startServer in src/server.js.

  • Safety and guardrails — not yet implemented. This milestone only builds the protocol core; the policy engine, path scoping, rate limiting, secret redaction, and audit trail described above are planned for upcoming milestones and will be documented here once they land.

Available Tools

1 tool
echoA

Returns the given text back unchanged.

Inputs: text (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 1 tool

    Disambiguation4/5

    With only one tool, there is no possibility of confusing it with another tool. However, the lack of any other tools means there is no meaningful set to disambiguate.

    Naming Consistency4/5

    The single tool name 'echo' is clear and verb-like, with no inconsistent conventions to violate. There is no broader pattern to evaluate, so consistency is trivially satisfied but not demonstrated.

    Tool Count2/5

    A single tool is far too thin for a general-purpose MCP server; it feels like a placeholder rather than a usable tool surface. The count is well below the typical 3-15 range for a coherent server.

    Completeness1/5

    The surface consists solely of an echo utility, with no create/read/update/delete or lifecycle operations for any identifiable domain. It is severely incomplete for any practical purpose.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      A model-agnostic MCP server exposing example tools (add1, multiply2, greet) for learning purposes, working with any LLM through stdio transport.
      -
    • F
      license
      A
      quality
      D
      maintenance
      A learning-oriented MCP server that exposes basic tools (echo, add, reverse) over stdio transport to validate MCP handshake and tool calls.
      3
      -
    • A
      license
      A
      quality
      C
      maintenance
      Exposes a verified tool registry (calculator, sandboxed file read, web fetch) over MCP stdio, enabling any MCP-capable client to reuse the same tools from the inspectable ReAct loop.
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides a runnable local stdio Python server scaffold that coding agents extend into custom tool integrations by describing an idea and letting the agent investigate, build, test, and install it. Ships with no prebuilt tools, so it enables guided, agent-assisted creation of MCP tools connected to external APIs, databases, or websites while writes stay disabled until explicitly agreed.
      1
      MIT