# smaramwbc/statewave-connectors [Health: Active]

**Category:** 🧠 Knowledge & Memory  
**Repository:** https://github.com/smaramwbc/statewave-connectors/tree/main/packages/mcp-server  
**GitHub Stars:** 4  
**npm Downloads (last month):** 65  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/smaramwbc-statewave-connectors

## Description
Query and ingest Statewave's agent memory: ranked context per subject, chronological timelines, episode ingestion and on-demand compilation.

## Tools
Capabilities this server exposes over MCP:

- **statewave_ingest_episode** — 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.
- **statewave_search_memories** — 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.
- **statewave_get_context** — 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.
- **statewave_get_timeline** — 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.
- **statewave_compile_subject** — 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.
- **statewave_list_subjects** — 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.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "statewave-connectors": {
    "command": "npx",
    "args": ["-y","@statewavedev/mcp-server"],
    "env": {
      "STATEWAVE_URL": "",
      "STATEWAVE_API_KEY": ""
    }
  }
}
```

**Requires environment variables:** `STATEWAVE_URL`, `STATEWAVE_API_KEY` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What smaramwbc/statewave-connectors does

smaramwbc/statewave-connectors connects MCP-compatible clients to Statewave's memory API. Its tool surface covers both sides of a memory workflow: adding normalized episodes and recalling information that has been compiled for a subject.

The main retrieval tool is `statewave_get_context`, which returns compact, ranked context for a subject and is intended for use inside a prompt. `statewave_search_memories` searches compiled memories with a free-text query scoped to that subject. For event-level inspection, `statewave_get_timeline` returns episodes in chronological order and supports filters for kinds and time bounds.

Writing and maintenance are handled by `statewave_ingest_episode` and `statewave_compile_subject`. Ingestion deduplicates episodes using an `idempotency_key`; compilation makes newly ingested episodes recallable.

## How it works

The package includes a thin `StatewaveClient` for the Statewave v1 API. The client handles authentication, tenant information, and typed errors. Tool calls pass through `dispatchTool`, which validates inputs and maps each recognized MCP tool to a corresponding client method.

For standalone use, `startMcpServer` provides a stdio JSON-RPC 2.0 transport. The server can also print its complete JSON Schema tool surface and exit by using the `--list-tools` mode. This makes the available input shapes inspectable before connecting it to an MCP client.

Statewave memory is organized around subjects. A typical retrieval call supplies a subject such as `repo:owner/name` and a query describing the context an agent needs. Episodes must be normalized before they are sent for ingestion.

## Setup and configuration

The command-line entry point is exposed through `@statewavedev/connectors-cli`:

```bash
statewave-connectors mcp start --list-tools
statewave-connectors mcp start
```

The normal server command uses stdio JSON-RPC 2.0 and requires `STATEWAVE_URL`. Authentication is configured with `STATEWAVE_API_KEY`. The package can also be embedded in an existing MCP runtime by importing `StatewaveClient` and `dispatchTool` from `@statewavedev/mcp-server`:

```js
const client = new StatewaveClient({
  url: process.env.STATEWAVE_URL,
  apiKey: process.env.STATEWAVE_API_KEY
});
```

Use the first command to inspect the schemas without starting a long-running server. Use the second when an MCP client should communicate with the server over standard input and output.

## Tools and capabilities

- `statewave_ingest_episode`: Adds one normalized episode and avoids duplicate ingestion through its `idempotency_key`.
- `statewave_search_memories`: Searches compiled memories by free-text query within a subject.
- `statewave_get_context`: Returns compact, ranked subject context for inclusion in an agent prompt.
- `statewave_get_timeline`: Retrieves chronological episodes, with optional `kinds`, `since`, and `until` filters.
- `statewave_compile_subject`: Starts compilation for a subject so recently ingested episodes can be recalled.

## Limitations and notes

The included transport is stdio JSON-RPC 2.0. The server is designed to be vendor-neutral and does not assume a particular IDE, model provider, or hosted dependency. Newly ingested episodes may require an explicit subject compilation step before they are available through memory recall tools.

_Full upstream README: https://allmcps.com/mcp/smaramwbc-statewave-connectors/readme_

