Skip to main content
Glama
README.md
# maxx: code mode for Claude

[![tests](https://github.com/ironsidemugisha/Efficiency-Maxxing/actions/workflows/test.yml/badge.svg)](https://github.com/ironsidemugisha/Efficiency-Maxxing/actions/workflows/test.yml)

**Say "maxx it" and Claude does the whole job in one shot.** maxx is one MCP server that wraps all your other MCP servers (Gmail, Calendar, Drive, GitHub, anything). Instead of making dozens of slow tool calls one at a time, Claude writes **one Python script** that calls them all, runs it in a sandbox, and gets back only the result.

In a [30-run benchmark](benchmark/results/report.md) on Claude Sonnet 5.5, code mode was **4.5× faster** (median 1.9 s vs 8.6 s), **7× cheaper**, used **10× fewer tokens**, and scored 100% accuracy vs 87% for the normal tool loop. The gap grows with the number of tool calls.

- Works with **Claude Code** and **Claude Desktop** (any MCP client).
- **No Anthropic API key needed.** Your own Claude writes the code.
- **Your accounts, your keys.** Each person configures their own servers; nothing is shared.
- **Keys never enter the sandbox.** Scripts get an empty environment; only tool calls reach your accounts.
- **Save a workflow once, rerun it forever**, from Claude or from the command line (cron-friendly, no model needed).

## Why it's faster

Normal tool use: Claude calls a tool → waits → reads the full result → calls the next tool → ... Every step is a model round trip, and every raw result goes through Claude's context.

Code mode: Claude reads typed stubs for your tools, writes one script with loops, filters, and `parallel()` calls, and only the printed summary comes back.

```python
ids = re.findall(r"Message ID:\s*(\S+)", google__search_gmail_messages(query="is:unread", user_google_email=ME))
mail, events = parallel([(google__get_gmail_messages_content_batch, {"message_ids": ids, "user_google_email": ME}),
                         (google__get_events, {"user_google_email": ME})])
print(compact_digest(mail, events))
```

## Install (2 minutes)

You need [uv](https://docs.astral.sh/uv/getting-started/installation/): `curl -LsSf https://astral.sh/uv/install.sh | sh`

**Claude Code:**
```bash
claude mcp add maxx -s user -- uvx --from git+https://github.com/ironsidemugisha/Efficiency-Maxxing maxx
```

**Claude Desktop:** Settings → Developer → Edit Config, then add this inside `mcpServers` and restart Desktop:
```json
"maxx": {
  "command": "/Users/YOU/.local/bin/uvx",
  "args": ["--from", "git+https://github.com/ironsidemugisha/Efficiency-Maxxing", "maxx"]
}
```
(Use the full path from `which uvx`, because Desktop doesn't load your shell PATH.)

## Configure your tools

maxx reads `~/.config/maxx/servers.json`. It uses the same format as Claude Desktop's `mcpServers`, so you can copy servers over. Start from [`examples/servers.example.json`](examples/servers.example.json):

```bash
mkdir -p ~/.config/maxx
curl -o ~/.config/maxx/servers.json https://raw.githubusercontent.com/ironsidemugisha/Efficiency-Maxxing/main/examples/servers.example.json
chmod 600 ~/.config/maxx/servers.json
```

- **Local servers:** `"command"` + `"args"` + optional `"env"`.
- **Remote servers:** `"url"` + optional `"headers"` (streamable HTTP).
- **Secrets:** write `"${VAR}"` and it's filled from maxx's environment, so keys can stay out of the file. Downstream servers only get the env you list for them.
- `"disabled": true` skips a server.

Check that everything connects:
```bash
uvx --from git+https://github.com/ironsidemugisha/Efficiency-Maxxing maxx check
```

### Gmail + Calendar + Drive + Sheets (Google)

The example config uses [workspace-mcp](https://github.com/taylorwilsdon/google_workspace_mcp). One-time setup with your own Google account:

1. In [Google Cloud Console](https://console.cloud.google.com/), create a project, then enable the **Gmail API**, **Google Calendar API**, **Drive API** and **Sheets API**.
2. Under **APIs & Services → OAuth consent screen**, choose External and add yourself as a test user.
3. Under **Credentials → Create credentials → OAuth client ID**, choose **Desktop app**.
4. Give maxx the values as environment variables, not in chat:
   ```bash
   claude mcp remove maxx -s user
   claude mcp add maxx -s user \
     -e GOOGLE_OAUTH_CLIENT_ID=... -e GOOGLE_OAUTH_CLIENT_SECRET=... -e USER_GOOGLE_EMAIL=you@gmail.com \
     -- uvx --from git+https://github.com/ironsidemugisha/Efficiency-Maxxing maxx
   ```
   (For Desktop, put them in an `"env": {...}` block next to `"args"`.)
5. On the first Google call, the result includes a Google sign-in link. Open it, approve, and ask Claude to run it again. The token is stored locally by workspace-mcp.

## Use it: say "maxx it"

Ask Claude for the task and add **"maxx it"** (or "use maxx"). Claude also picks maxx on its own for tasks that clearly need many tool calls, because the tool's description tells it to.

To make it the default every time, add this line to `~/.claude/CLAUDE.md` (Claude Code) or to your Project instructions (Desktop):

```
When I say "maxx it", or for any task needing 3+ tool calls, use the maxx tool.
```

Example prompts:
- "Summarize my unread inbox from today and add any meetings to my calendar. Maxx it."
- "Maxx it: for every spreadsheet in my 'Invoices' Drive folder, total column D and give me one table."

Claude sees three tools:

| Tool | What it does |
|---|---|
| `maxx(code, save_as=)` | Runs one script. Tools are functions named `<server>__<tool>` with keyword args. `parallel([(fn, {kwargs}), ...])` runs calls concurrently. Only `print()` output comes back. |
| `maxx_tools(query)` | Returns typed Python stubs for matching tools. With no query, it lists every server and tool. |
| `maxx_rerun(name)` | Reruns a saved script. With no name, it lists the saved scripts. |

### Example workflow: inbox → calendar

[`examples/workflows/inbox_digest.py`](examples/workflows/inbox_digest.py) pulls unread mail plus your next 7 days of calendar in **3 tool calls in one round trip**, and prints a compact digest. Claude summarizes it and picks out events. [`examples/workflows/add_events.py`](examples/workflows/add_events.py) then creates them all at once and skips any that are already on the calendar.

Save it and rerun it any time:
```
You: run that again and save it as "inbox"
Claude: maxx(..., save_as="inbox")          → ~/.config/maxx/workflows/inbox.py
Later:  maxx_rerun("inbox")                 → no script writing, one call
Cron:   maxx run inbox                      → no Claude at all
```

### Try it without a Google account

```bash
git clone https://github.com/ironsidemugisha/Efficiency-Maxxing && cd Efficiency-Maxxing
uv venv && uv pip install -e .
python tests/test_e2e.py     # launches the server against a fake Gmail/Calendar and checks everything
```

## Security

- **Scripts never see your keys.** The sandbox process starts with an empty environment and a temporary home directory, so secrets stay in the parent process and in the downstream servers.
- **Limits:** CPU time, memory (Linux), file size, no child processes (POSIX), and a wall-clock timeout (default 120 s, max 900 s).
- **Default (`local`) mode doesn't block network or file reads.** A script could still read files your user account can read. That's fine for code your own Claude writes for you. For stronger isolation, install Docker and set:
  ```bash
  claude mcp add maxx -s user -e CODE_MODE_SANDBOX=docker -- uvx --from git+https://github.com/ironsidemugisha/Efficiency-Maxxing maxx
  ```
  Scripts then run in `docker run --network none --read-only --cap-drop ALL` with no access to your files, network or keys. Tool calls still work because they go through the host.
- Tool arguments and results are never logged. Only call counts and timings go to stderr.
- Write tools (send email, delete events) are as dangerous here as anywhere else. Claude Code still shows you the script before `maxx` runs, unless you've allowed the tool.

## Can it break? How you'd know, and how to fix it

Yes. It depends on things that change: the MCP SDK, Python, Google's APIs, and your sign-ins. Here's how each one shows up:

| What breaks | How you'd know | Fix |
|---|---|---|
| **Your Google sign-in expires** (most common, every few weeks or months) | Output says **`[auth] 'google' needs you to sign in again`** and usually includes a link | Open the link, approve, and say "maxx it" again. About 1 minute. |
| **A server is misconfigured or won't start** | **`[server down] 'google' is not connected (...)`** | Run `maxx check` to see the exact error, then fix `servers.json` or the missing env var. |
| **A server crashes mid-run** | **`[server crashed] ... was restarted`**. maxx restarts it automatically. | Usually nothing. Check whether that one call happened, then rerun. |
| **Rate limits** | **`[rate limit] ...`** | Wait a minute, or ask Claude to make fewer calls. |
| **The script itself has a bug** | `[error]` with a Python traceback. Claude normally fixes and reruns it without asking. | Nothing. |
| **A new MCP SDK or Python release breaks maxx** | The **tests badge** at the top turns red. CI runs every Monday and on every push, on macOS and Linux. | Update the code (usually a small change), then reinstall with `uv cache clean` and restart Claude. |

Every failure lists which tool failed and why under `[N failed tool call(s)]`, so you never get a silent wrong answer from a failed call.

## Troubleshooting

- **Claude doesn't show the maxx tools:** run `claude mcp list`. It should say `maxx ... ✓ Connected`. If not, check `which uvx` and that uv is installed. In Desktop, use the full path to uvx.
- **"No servers configured":** create `~/.config/maxx/servers.json` (see above), then restart Claude.
- **A server shows `error: missing environment variables: X`:** the config uses `${X}` but X isn't set. Pass it with `claude mcp add ... -e X=...` or put it in Desktop's `"env"` block.
- **`maxx check` hangs on Google:** the first run of workspace-mcp downloads packages, which can take about a minute.
- **Getting an older version:** uvx caches installs. Run `uv cache clean` and restart Claude to pull the latest.
- **Docker mode fails:** make sure Docker Desktop is running (`docker info`).

## Settings

| Env var | Default | Meaning |
|---|---|---|
| `CODE_MODE_CONFIG` | `~/.config/maxx/servers.json` | Server list |
| `CODE_MODE_HOME` | `~/.config/maxx` | Base dir for config and workflows |
| `CODE_MODE_WORKFLOWS` | `$CODE_MODE_HOME/workflows` | Saved scripts |
| `CODE_MODE_SANDBOX` | `local` | `local` or `docker` |
| `CODE_MODE_DOCKER_IMAGE` | `python:3.12-slim` | Image for docker mode |

## CLI

Install the command once with `uv tool install git+https://github.com/ironsidemugisha/Efficiency-Maxxing`, then:
```
maxx                 # MCP server over stdio (what Claude launches)
maxx check           # connect to every server and show status
maxx tools gmail     # print the stubs Claude sees
maxx run inbox       # run a saved workflow or a .py file directly
```

## License

MIT

TDQS

A3.9/5.0

Scored across 3 tools

Disambiguation4/5

Each tool has a distinct role: maxx_tools is discovery/stub lookup, maxx executes an ad-hoc script, maxx_rerun replays a saved one. The only mild overlap is maxx (with save_as) versus maxx_rerun, since both deal with saved workflows, but the descriptions make the boundary clear enough.

Naming Consistency4/5

All three names share the 'maxx' namespace prefix with predictable suffixes (_tools, bare, _rerun), which is readable and cohesive. The bare 'maxx' as the primary execution verb is slightly less descriptive than a verb_noun form, a minor deviation.

Tool Count5/5

Three tools is exactly right for a script-execution meta-server: discovery, run, and replay. Nothing appears padded or missing at the surface level.

Completeness4/5

The lifecycle of discover-tools -> write/run script -> save -> rerun is covered, and empty-name listing handles workflow enumeration. Minor gaps exist around inspecting or deleting a saved workflow without rerunning it, but agents can work around this.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues