Skip to main content
Glama

@statewavedev/mcp-server

Statewave MCP server — exposes Statewave memory to MCP-compatible clients (coding assistants, agent frameworks, IDE extensions).

Part of the Statewave Connectors ecosystem. Vendor-neutral by design — no IDE, model provider, or hosted dependency assumptions.

What's here

  • STATEWAVE_MCP_TOOLS — the canonical tool surface (5 tools, JSON Schema input)

  • StatewaveClient — thin HTTP client for the Statewave v1 API (auth, tenant, typed errors)

  • dispatchTool — input-validating dispatcher that maps a tool call to a StatewaveClient method

  • startMcpServer — minimal stdio JSON-RPC 2.0 transport, plus a --list-tools mode

Related MCP server: MemHeaven

Tools

Tool

Purpose

statewave_ingest_episode

Ingest a single normalized episode (deduped on idempotency_key).

statewave_search_memories

Search compiled memories by free-text query within a subject.

statewave_get_context

Retrieve compact, ranked context for a subject — the default tool to use inside a prompt.

statewave_get_timeline

Chronological episodes for a subject; filterable by kinds, since, until.

statewave_compile_subject

Trigger compilation of a subject so newly ingested episodes become recallable.

Usage

# As a CLI subcommand (via @statewavedev/connectors-cli)
statewave-connectors mcp start --list-tools     # print the JSON Schema surface and exit
statewave-connectors mcp start                  # stdio JSON-RPC 2.0 server (requires STATEWAVE_URL)

# Or programmatically inside an existing MCP runtime
import { StatewaveClient, dispatchTool } from "@statewavedev/mcp-server";
const client = new StatewaveClient({ url: process.env.STATEWAVE_URL!, apiKey: process.env.STATEWAVE_API_KEY });
const { result } = await dispatchTool(client, "statewave_get_context", {
  subject: "repo:owner/name",
  query: "repo conventions and recent changes",
});

Status

v0.1.0 preview — minimal stdio transport included. See RELEASE_NOTES.md.

Available Tools

6 tools
statewave_compile_subjectA

Compile a subject's accumulated raw episodes into durable, retrievable memories. This is the step that makes ingested episodes searchable: statewave_ingest_episode stores raw episodes, and this distils them into the compiled memory that statewave_get_context and statewave_search_memories read. Triggers a compile job on the server and returns its summary (subject and status). By default it is a no-op when there are no new episodes since the last compile; set force to recompile anyway. Call it right after ingesting episodes you want to become retrievable.

Inputs: subject (required), force.

statewave_get_contextA

Assemble a compact, ranked context bundle for a subject, tailored to the task described in query. Read-only. Designed to be injected into an agent/LLM prompt in place of stuffing raw chat history or whole files: it returns only the most relevant distilled facts and procedures, fit to a token budget. Returns a context bundle with assembled_context (ready-to-prompt text), structured facts and procedures arrays, and a token estimate. Prefer this over statewave_search_memories when you want prompt-ready context rather than a raw ranked list of memories.

Inputs: query (required), subject (required), max_tokens.

statewave_get_timelineA

Retrieve a subject's raw episodes in chronological order (oldest to newest). Read-only. Unlike statewave_search_memories (ranked, compiled memories), this returns the underlying event log unmodified — use it for audit trails, change-logs, debugging what was ingested, or replaying history. Optionally bound the window with since/until and filter to specific event kinds. Returns an array of episode records (id, kind, text, occurred_at, source), capped by limit; an empty array means no episodes matched the filters.

Inputs: subject (required), kinds, limit, since, +1 more.

statewave_ingest_episodeA

Write a single normalized event ('episode') into Statewave's raw memory log for a subject. This is a write: the episode is stored immediately but is NOT yet retrievable as durable memory — call statewave_compile_subject afterward to distil episodes into the compiled memories that statewave_get_context and statewave_search_memories read. Idempotent: re-ingesting an idempotency_key already seen for the subject does not create a duplicate. Returns the stored episode id, its idempotency_key, and a duplicate boolean indicating whether an existing episode was matched. Use it to capture a durable fact, decision, message, or system event you want remembered.

Inputs: kind (required), text (required), source (required), subject (required), +3 more.

statewave_list_subjectsA

List the memory subjects this Statewave instance knows about, with per-subject episode and memory counts. Read-only. Use it to discover which subject id to pass to the other tools (e.g. repo:owner.name) — especially in chat clients that have no repository context. Returns a paginated array of subjects (subject id, episode_count, memory_count) plus a total count; page through larger instances with limit/offset.

Inputs: limit, offset.

statewave_search_memoriesA

Search a subject's compiled, durable memories by free-text query and return the most relevant ones, ranked by relevance. Read-only. This searches distilled memories, NOT raw episodes — newly ingested episodes only appear here after statewave_compile_subject has run. Returns an array of memory records (id, subject, kind, content) ordered most-relevant first; an empty array means nothing matched. Use it to look up specific remembered facts; prefer statewave_get_context when you instead want prompt-ready context assembled to a token budget.

Inputs: query (required), subject (required), limit.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.6/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool targets a unique operation: ingestion, compilation, context retrieval, timeline viewing, memory search, and subject listing. Descriptions explicitly distinguish when to use each, leaving no ambiguity.

    Naming Consistency5/5

    All tools follow the consistent pattern `statewave_verb_noun` (e.g., `statewave_ingest_episode`, `statewave_get_context`), making the set predictable and easy to navigate.

    Tool Count5/5

    Six tools cover the essential operations for a memory management system—ingest, compile, retrieve, search, and list—without redundancy or bloat.

    Completeness4/5

    The tools provide a complete workflow: write, compile, read (context/timeline/search), and discover. Minor gaps such as missing update/delete operations exist, but the core lifecycle is well-supported.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers