Skip to main content
Glama
README.md
# memorybank-mcp

MemoryBank MCP server for Cursor clients. It proxies the MemoryBank rules endpoint (`GET /api/external/rules`) over MCP stdio via the `memorybank_get_rules` tool and returns the complete rules document as plain text.

## Requirements
- Node.js 18+
- `MEMORYBANK_BASE_URL` and `MEMORYBANK_API_KEY` environment variables must be set before start. `MEMORYBANK_PROJECT_ID` is optional but recommended when your API key is scoped to a project.

## Environment variables
During development you can store secrets in a local `.env` file and run the provided npm scripts (`npm run dev`, `npm run debug`) – they already pass `--env-file=.env` to `tsx`. For production runs (`node dist/index.js` or the published binary) export the variables in your shell.

| Name | Required | Description |
| --- | --- | --- |
| `MEMORYBANK_BASE_URL` | yes | MemoryBank backend origin, e.g. `https://example.com`. The server will call `${BASE_URL}/api/external/rules`. |
| `MEMORYBANK_API_KEY` | yes | Workspace API key used for the Authorization header. |
| `MEMORYBANK_PROJECT_ID` | no | Project/workspace identifier passed as the `projectId` query parameter. Provide it when the API key is scoped to a project. |
| `MEMORYBANK_TIMEOUT_MS` | no | Override request timeout in milliseconds (default `15000`). |
| `MEMORYBANK_CACHE_TTL_MS` | no | Cache lifetime for fetched rules (default `600000`, set to `0` to disable caching). |
| `MEMORYBANK_USER_AGENT` | no | Custom User-Agent header (defaults to `memorybank-mcp/<package version>`). |
| `DEBUG_MEMORYBANK_MCP` | no | Set to `true` to log raw backend responses when JSON parsing fails (useful for debugging only). |

## Scripts
- `npm run build` – compile TypeScript into `dist/`.
- `npm start` – run the compiled stdio server (`node dist/index.js`).
- `npm run dev` – launch the stdio server in watch mode via `tsx`, loading variables from `.env`.
- `npm run watch` – run the TypeScript compiler in watch mode (`tsc -w`) to keep `dist/` updated without launching the server.
- `npm run debug` – start the debug client to call the `memorybank_get_rules` tool via stdio.

The MCP server instructs agents to call `memorybank_get_rules` exactly once at the start of a session. The tool caches the Markdown response for `MEMORYBANK_CACHE_TTL_MS` milliseconds and accepts an optional `{ "force": true }` argument to bypass the cache.

## Resources
- `memorybank://context/active_context` – exposes the cached MemoryBank ruleset as Markdown (identical to the `memorybank_get_rules` tool output).
- `memorybank://rules` – alias resource that returns the same Markdown document.

## Development workflow
```bash
npm install
npm run build
node dist/index.js
```
For CLI-based testing without Cursor, ensure `dist/` is current and run:

```bash
npm run debug
```

## Cursor configuration
Add the server to `~/.cursor/mcp.json` (or workspace `mcp.json`) under the `mcpServers` key.

### Option 1: Environment variables in mcp.json

Using `npx`:

```json
{
  "mcpServers": {
    "memorybank-mcp": {
      "command": "npx",
      "args": ["--yes", "@morsa/memorybank-mcp"],
      "env": {
        "MEMORYBANK_BASE_URL": "https://example.com",
        "MEMORYBANK_API_KEY": "mbk_...",
        "MEMORYBANK_PROJECT_ID": "proj_123"
      }
    }
  }
}
```

Using a locally built binary:

```json
{
  "mcpServers": {
    "memorybank-mcp-local": {
      "command": "node",
      "args": ["/path/to/memorybank-mcp/dist/index.js"],
      "env": {
        "MEMORYBANK_BASE_URL": "https://example.com",
        "MEMORYBANK_API_KEY": "mbk_...",
        "MEMORYBANK_PROJECT_ID": "proj_123"
      }
    }
  }
}
```

### Option 2: Using .env file

Create a `.env` file in your project root or the directory where Cursor runs:

```
MEMORYBANK_BASE_URL=https://example.com
MEMORYBANK_API_KEY=mbk_...
MEMORYBANK_PROJECT_ID=proj_123
```

Then configure mcp.json without `env` variables:

```json
{
  "mcpServers": {
    "memorybank-mcp": {
      "command": "npx",
      "args": ["--yes", "@morsa/memorybank-mcp"]
    }
  }
}
```

TDQS

A3.5/5.0

Scored across 1 tool

Disambiguation5/5

There is only one tool, so an agent cannot misselect or confuse it with anything else. Its purpose (retrieving the rules document) is stated explicitly and unambiguously.

Naming Consistency4/5

The single name follows a clean server-prefixed verb_noun pattern (memorybank_get_rules). There is no set of names to check against, so consistency can only be inferred rather than demonstrated.

Tool Count2/5

A single tool that only fetches a static rules document is very thin coverage for a server named memorybank-mcp. It offers no way to actually store, query, or manage memories, so the surface feels trivial for the implied scope.

Completeness2/5

Only a read operation exists; there is no create, update, delete, list, or search for memory entries, leaving the memory-management lifecycle entirely uncovered. The one tool serves its narrow purpose, but the overall surface has significant gaps that would block real memory workflows.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues