# Agent configuration

> Every mmw-agent setting, with ready configs for Claude Code, Claude Desktop, Cursor and Codex.

By the end of this page you will be able to:

1. add mmw-agent to your client's config;
2. change the hint language, state directory and sync frequency;
3. check that the agent sees the same settings as your client.

Running example: you use Claude Code and Codex on one laptop, your key is bound to the "backend" project, and you want your session history kept in MMW.

## All settings

The agent is configured only through environment variables. It has no config file of its own.

| Variable | Type | Default | Description |
| --- | --- | --- | --- |
| `MMW_API_KEY` | string | — | API key from your account, starts with `mmw_`. Required. |
| `MMW_CREDENTIAL` | string | — | Fallback name for the key, read only without `MMW_API_KEY`. |
| `MMW_ENDPOINT` | URL | regional default | Server address. Set `https://mcp.mmwhub.tech`; `/mcp` at the end is optional. |
| `MMW_LANG` | `en` or `ru` | by server address | Language of hints, errors and the `mmw_sync_status` description. |
| `MMW_AGENT_HOME` | path | `~/.mmw` | Where `agent.json` lives: device ID and consent receipt. |
| `MMW_SESSIONS_HOME` | path | home directory | Where to look for `.claude/projects` and `.codex/sessions`. The default `MMW_AGENT_HOME` is also derived from it. |
| `MMW_SYNC_INTERVAL` | seconds | `15` | Pause between sync cycles. |

Keys are bound to a project. If you want Claude Code and Codex to share the same memory, use the same key (or keys of the same project) in both. More in [Workspaces and projects](/memory/workspaces-and-projects/).

## Client configs

In every case the agent is started with `uvx --from <wheel> mmw-agent`. Wheel URL: `https://app.mmwhub.tech/downloads/mmw-agent/mmw_agent-0.1.4-py3-none-any.whl`.

With a command:

```bash
claude mcp add mmw \
  -e MMW_API_KEY=mmw_your_key \
  -e MMW_ENDPOINT=https://mcp.mmwhub.tech \
  -- uvx --from https://app.mmwhub.tech/downloads/mmw-agent/mmw_agent-0.1.4-py3-none-any.whl mmw-agent
```

Add more variables with extra `-e` flags, for example `-e MMW_SYNC_INTERVAL=60`.

By hand — the `mcpServers.mmw` block in `~/.claude.json`:

```json title="~/.claude.json"
{
  "mcpServers": {
    "mmw": {
      "command": "uvx",
      "args": ["--from", "https://app.mmwhub.tech/downloads/mmw-agent/mmw_agent-0.1.4-py3-none-any.whl", "mmw-agent"],
      "env": {
        "MMW_API_KEY": "mmw_your_key",
        "MMW_ENDPOINT": "https://mcp.mmwhub.tech"
      }
    }
  }
}
```

Settings → Developer → Edit Config opens `claude_desktop_config.json`.

```json title="claude_desktop_config.json"
{
  "mcpServers": {
    "mmw": {
      "command": "uvx",
      "args": ["--from", "https://app.mmwhub.tech/downloads/mmw-agent/mmw_agent-0.1.4-py3-none-any.whl", "mmw-agent"],
      "env": {
        "MMW_API_KEY": "mmw_your_key",
        "MMW_ENDPOINT": "https://mcp.mmwhub.tech"
      }
    }
  }
}
```

Save the file and fully restart Claude Desktop.

```json title="~/.cursor/mcp.json"
{
  "mcpServers": {
    "mmw": {
      "command": "uvx",
      "args": ["--from", "https://app.mmwhub.tech/downloads/mmw-agent/mmw_agent-0.1.4-py3-none-any.whl", "mmw-agent"],
      "env": {
        "MMW_API_KEY": "mmw_your_key",
        "MMW_ENDPOINT": "https://mcp.mmwhub.tech"
      }
    }
  }
}
```

```toml title="~/.codex/config.toml"
[mcp_servers.mmw]
command = "uvx"
args = ["--from", "https://app.mmwhub.tech/downloads/mmw-agent/mmw_agent-0.1.4-py3-none-any.whl", "mmw-agent"]
env = { MMW_API_KEY = "mmw_your_key", MMW_ENDPOINT = "https://mcp.mmwhub.tech" }
```

Restart the client after editing its config: it fetches the tool list when it launches the agent.

## Examples

### Force the hint language

```json title="env fragment"
"env": {
  "MMW_API_KEY": "mmw_your_key",
  "MMW_ENDPOINT": "https://mcp.mmwhub.tech",
  "MMW_LANG": "en"
}
```

### Sync less often

By default the agent checks for new session lines every 15 seconds. To check once a minute instead:

```toml title="~/.codex/config.toml"
[mcp_servers.mmw]
command = "uvx"
args = ["--from", "https://app.mmwhub.tech/downloads/mmw-agent/mmw_agent-0.1.4-py3-none-any.whl", "mmw-agent"]
env = { MMW_API_KEY = "mmw_your_key", MMW_ENDPOINT = "https://mcp.mmwhub.tech", MMW_SYNC_INTERVAL = "60" }
```

### A custom state directory

If you set `MMW_AGENT_HOME` in the client config, set **the same** variable in your terminal when you run `consent`, `revoke` and `status`. Otherwise the terminal writes consent to `~/.mmw` while the agent launched by the client looks elsewhere and never sees it.

```bash
export MMW_AGENT_HOME="$HOME/.config/mmw"
export MMW_API_KEY=mmw_your_key
export MMW_ENDPOINT=https://mcp.mmwhub.tech
uvx --from https://app.mmwhub.tech/downloads/mmw-agent/mmw_agent-0.1.4-py3-none-any.whl mmw-agent consent
```

Do not commit config files containing your key to Git or paste them into chats. If a key ends up in a repository, revoke it in your account and issue a new one — see [API keys and OAuth](/account/api-keys-and-oauth/).

## Direct connection without the agent

If you do not need session history and your client supports remote MCP servers over HTTP, you can skip the agent:

```json title="mcpServers"
{
  "mcpServers": {
    "mmw": {
      "url": "https://mcp.mmwhub.tech/mcp",
      "headers": { "Authorization": "Bearer mmw_your_key" }
    }
  }
}
```

In this mode there is no `mmw_sync_status` and no session sync. The server is stateless: every request stands on its own, so there is nothing to reconnect after a pause.

## Verify

Run `status` in a terminal with the same variables as in your config:

```bash
MMW_API_KEY=mmw_your_key MMW_ENDPOINT=https://mcp.mmwhub.tech \
  uvx --from https://app.mmwhub.tech/downloads/mmw-agent/mmw_agent-0.1.4-py3-none-any.whl mmw-agent status
```

If the output contains `"server": { "registered": …, "sources": … }`, the key and address are correct. If it shows `"server": { "error": "Offline: …" }`, the agent could not reach the server; see [Agent troubleshooting](/agent/troubleshooting/).

## Where next
