Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions src/memory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,59 @@ On Windows, use:
}
```

### Troubleshooting: WSL2 JSON parse errors

When running the server via `npx -y @modelcontextprotocol/server-memory` inside WSL2, you may encounter errors like:

```
Unexpected non-whitespace character after JSON at position 127
```

This is caused by `npx` writing package resolution output to stdout before handing off to the server. Since MCP's stdio transport uses stdout exclusively for JSON-RPC messages, those extra bytes corrupt the stream. The server code itself is not at fault.

**Fix — Option A: Global install (recommended)**

```sh
npm install -g @modelcontextprotocol/server-memory
```

Then update your `.vscode/mcp.json`:

```json
{
"servers": {
"memory": {
"command": "mcp-server-memory",
"args": []
}
}
}
```

**Fix — Option B: Run `node` directly**

```sh
# Install once to get the package into the npx cache
npx -y @modelcontextprotocol/server-memory
# Find the installed path
npm root -g
```

Then reference the entry point directly in `.vscode/mcp.json`:

```json
{
"servers": {
"memory": {
"command": "node",
"args": ["/path/to/global/node_modules/@modelcontextprotocol/server-memory/dist/index.js"]
}
}
}
```

Both options bypass `npx` at server startup, eliminating the stdout pollution.

### System Prompt

The prompt for utilizing memory depends on the use case. Changing the prompt will help the model determine the frequency and types of memories created.
Expand Down
Loading