# code-memory MCP server

> Indexes a local codebase and lets an AI client run semantic code, docs, and Git history searches offline.

- Repository: https://github.com/kapillamba4/code-memory
- Page: https://hostedmcp.org/servers/kapillamba4/code-memory
- Transport: stdio
- Stars: 50
- License: MIT
- Latest version: 1.0.33

## Install

### Claude Code

```sh
claude mcp add code-memory -- uvx code-memory
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "code-memory": {
      "command": "uvx",
      "args": [
        "code-memory"
      ]
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "code-memory": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "code-memory"
      ]
    }
  }
}
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "code-memory": {
      "command": "uvx",
      "args": [
        "code-memory"
      ]
    }
  }
}
```

### Codex (`~/.codex/config.toml`)

```toml
[mcp_servers.code-memory]
command = "uvx"
args = ["code-memory"]
```

### Gemini CLI (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "code-memory": {
      "command": "uvx",
      "args": [
        "code-memory"
      ]
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `CODE_MEMORY_LOG_LEVEL` | no | no |  |
| `CODE_MEMORY_LOG_LEVEL` | no | no | Logging verbosity (DEBUG, INFO, WARNING, ERROR) |
| `EMBEDDING_MODEL` | no | no |  |
| `EMBEDDING_MODEL` | no | no | HuggingFace model ID for embeddings |

## FAQ

### What does code-memory do?

It is an MCP server that indexes your codebase locally and provides semantic code, documentation, and Git history search to AI clients. Everything runs offline with no telemetry.

### Does code-memory require an API key or internet connection?

No. It runs entirely locally with sentence-transformers, so no API key is needed and your code stays on your machine.

### Which languages does code-memory support?

It has full AST support for Python, JavaScript/TypeScript, Java, Go, Rust, C/C++, Ruby, and Kotlin, with whole-file fallback indexing for many others like C#, Swift, SQL, and Markdown.

### How do I install and run code-memory?

Install from PyPI with pip or run it directly with uvx. Python 3.13 or higher is required.

### Can I reduce memory usage by sharing one code-memory instance?

Yes, you can run a single shared instance over SSE and point all MCP hosts at it instead of loading the embedding model per project.
