# Imperal MCP server

> Provides an exoskeleton for AI coding agents with persistent memory, code impact analysis, and hallucination checks against real execution facts.

- Repository: https://github.com/imperalcloud/imperal-mcp
- Page: https://hostedmcp.org/servers/imperalcloud/imperal-mcp
- Transport: stdio
- Stars: 4
- License: GPL-3.0
- Latest version: 0.9.19

## Install

### Claude Code

```sh
claude mcp add --env 'IMPERAL_TOKEN=<YOUR_IMPERAL_TOKEN>' imperal-mcp -- uvx imperal-mcp
```

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

```json
{
  "mcpServers": {
    "imperal-mcp": {
      "command": "uvx",
      "args": [
        "imperal-mcp"
      ],
      "env": {
        "IMPERAL_TOKEN": "<YOUR_IMPERAL_TOKEN>"
      }
    }
  }
}
```

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

```json
{
  "servers": {
    "imperal-mcp": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "imperal-mcp"
      ],
      "env": {
        "IMPERAL_TOKEN": "<YOUR_IMPERAL_TOKEN>"
      }
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"imperal-mcp","type":"stdio","command":"uvx","args":["imperal-mcp"],"env":{"IMPERAL_TOKEN":"<YOUR_IMPERAL_TOKEN>"}}'
```

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

```json
{
  "mcpServers": {
    "imperal-mcp": {
      "command": "uvx",
      "args": [
        "imperal-mcp"
      ],
      "env": {
        "IMPERAL_TOKEN": "<YOUR_IMPERAL_TOKEN>"
      }
    }
  }
}
```

### Codex

```sh
codex mcp add imperal-mcp --env 'IMPERAL_TOKEN=<YOUR_IMPERAL_TOKEN>' -- uvx imperal-mcp
```

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

```toml
[mcp_servers.imperal-mcp]
command = "uvx"
args = ["imperal-mcp"]

[mcp_servers.imperal-mcp.env]
IMPERAL_TOKEN = "<YOUR_IMPERAL_TOKEN>"
```

### Gemini CLI

```sh
gemini mcp add -s user -e 'IMPERAL_TOKEN=<YOUR_IMPERAL_TOKEN>' imperal-mcp uvx -- imperal-mcp
```

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

```json
{
  "mcpServers": {
    "imperal-mcp": {
      "command": "uvx",
      "args": [
        "imperal-mcp"
      ],
      "env": {
        "IMPERAL_TOKEN": "<YOUR_IMPERAL_TOKEN>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `IMPERAL_TOKEN` | no | yes | Optional service token for CI or headless environments. When set, skips browser login. Obtain from panel.imperal.io → Developer → Access tokens. |
| `IMPERAL_API_URL` | no | no | Override the Imperal API base URL (default: https://auth.imperal.io). Leave unset for production. |
| `IMPERAL_WORKSPACE` | no | no |  |

## FAQ

### How does it prevent AI hallucinations?

The server matches every function, file, and result the agent mentions against the actual record of what was read and executed during the task.

### Can I undo changes made by the AI?

Yes, you can use checkpoints to undo any change in one call without affecting your git working tree.

### Does it work with my existing IDE or CLI?

Yes, it is compatible with Claude Code, Cursor, OpenAI Codex, Gemini CLI, Windsurf, Claude Desktop, Cline, and Goose.

### Do the code tools require an internet connection?

The code tools function offline and do not require an account, though memory and hallucination checks require an Imperal Cloud account.
