MCX MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/schizoidcock/mcx
cd mcx

Then follow the repository README for any remaining dependency or build steps before continuing.

2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "API_CREDENTIALS=${API_CREDENTIALS}" mcx -- node "<FULL_PATH_TO_MCX>/dist/index.js"

Replace <FULL_PATH_TO_MCX>/dist/index.js with the actual folder you prepared in step 1.

Required:API_CREDENTIALS
README.md

MCP server that lets AI agents execute code instead of calling tools directly.

MCX - Modular Code Execution

███╗   ███╗ ██████╗██╗  ██╗
████╗ ████║██╔════╝╚██╗██╔╝
██╔████╔██║██║      ╚███╔╝
██║╚██╔╝██║██║      ██╔██╗
██║ ╚═╝ ██║╚██████╗██╔╝ ██╗
╚═╝     ╚═╝ ╚═════╝╚═╝  ╚═╝

MCP server that lets AI agents execute code instead of calling tools directly.

Based on Anthropic's code execution article.

The Problem

Traditional MCP has two inefficiencies:

  1. Tool definition overload - Loading all tool definitions floods context
  2. Intermediate result bloat - Every API response passes through the model

The Solution

Instead of calling tools directly, the agent writes code that runs in a sandbox:

const invoices = await api.getInvoices({ limit: 100 });
return {
  count: invoices.length,
  total: sum(invoices, 'amount'),
  byStatus: count(invoices, 'status')
};
// Returns ~50 tokens instead of 50,000

Result: 98% token reduction by filtering data inside the execution environment.

Installation

# Install globally with bun
bun add -g @papicandela/mcx-cli

# Initialize global directory (~/.mcx/)
mcx init

Requires Bun: MCX uses Bun for runtime. Install Bun if you haven't already.

Quick Start

# 1. Initialize global MCX directory
mcx init

# 2. Generate adapters from API docs
mcx gen ./api-docs.md -n myapi

# 3. Add credentials to ~/.mcx/.env

# 4. Start server
mcx serve

Directory Structure

~/.mcx/
├── adapters/           # Your adapters
│   ├── supabase.ts     # Supabase Management API
│   ├── chrome-devtools.ts  # Chrome DevTools Protocol
│   └── myapi.ts        # Generated from OpenAPI
├── skills/             # Reusable skills
├── mcx.config.ts       # Auto-loads all adapters
├── .env                # API credentials
└── package.json        # Dependencies

# Runtime (created automatically)
~/.mcx/
├── logs/               # Server logs (mcx logs to view)
└── .cache/             # FTS5 search index

Claude Code Integration

Add to your Claude Code settings (~/.claude.json or project's .mcp.json):

{
  "mcpServers": {
    "mcx": {
      "command": "mcx",
      "args": ["serve"]
    }
  }
}

That's it! MCX automatically uses ~/.mcx/ for config and adapters.

Key Features

Feature Description
Lazy Loading Adapters from ~/.mcx/adapters/ metadata-scanned at startup, fully loaded on first use
Domain Hints Adapters grouped by domain (payments, database, email, etc.) for better discoverability
Context Efficiency Filtering happens in sandbox, model sees results only
Variable Persistence Store results as $invoices, $customers for later use
FTS5 Search Auto-index large outputs, search with intent parameter
Batch Operations mcx_batch for multiple operations in one call
File Processing mcx_file to process local files with $file injection
URL Fetching mcx_fetch with HTML-to-markdown conversion
Control Flow Loops, conditionals, retries run as native code
Privacy Intermediate data stays in sandbox
Security Network isolation, path traversal protection, env injection prevention

MCP Tools

Tool Description
mcx_execute Execute code with adapter access, auto-stores as $result
mcx_search 3 modes: spec exploration, FTS5 search, adapter/method search
mcx_batch Multiple executions/searches in one call (bypasses throttling)
mcx_file Process local files with $file variable injection
mcx_fetch Fetch URLs with HTML-to-markdown and auto-indexing
mcx_list List available adapters and skills
mcx_stats Session statistics (indexed content, variables)
mcx_run_skill Run a registered skill

CLI Commands

Command Description
mcx serve Start MCP server (default)
mcx gen Generate adapters from OpenAPI specs (with TUI)
mcx init Initialize global ~/.mcx/ directory
mcx update Update CLI and global installation
mcx list List available adapters and skills
mcx run Run a skill directly
mcx logs View server logs

See CLI documentation for details.

Included Adapters

Adapter Methods Description
supabase 24 Supabase Management API (projects, tables, functions, secrets)
chrome-devtools 25 Chrome DevTools Protocol (screenshots, navigation, DOM)

Generate your own adapters from OpenAPI docs:

mcx gen ./api-docs.md -n myapi

Built-in Helpers

Functions available in the sandbox:

pick(data, ['id', 'name'])     // Extract fields
first(data, 5)                  // First N items
sum(data, 'amount')             // Sum numeric field
count(data, 'status')           // Count by field
table(data, 1

Tools (8)

mcx_executeExecute code with adapter access, auto-stores as $result
mcx_search3 modes: spec exploration, FTS5 search, adapter/method search
mcx_batchMultiple executions/searches in one call
mcx_fileProcess local files with $file variable injection
mcx_fetchFetch URLs with HTML-to-markdown and auto-indexing
mcx_listList available adapters and skills
mcx_statsSession statistics (indexed content, variables)
mcx_run_skillRun a registered skill

Environment Variables

API_CREDENTIALSrequiredAPI keys and credentials stored in ~/.mcx/.env

Configuration

claude_desktop_config.json
{"mcpServers": {"mcx": {"command": "mcx", "args": ["serve"]}}}

Try it

Use mcx_execute to fetch the last 50 invoices and return only the total sum of amounts.
Search for the Supabase adapter methods using mcx_search.
Fetch the content of https://example.com and convert it to markdown using mcx_fetch.
Process the local file data.json using mcx_file to extract specific fields.

Frequently Asked Questions

What are the key features of MCX?

Sandboxed JavaScript and TypeScript code execution. Significant token reduction by filtering data locally. FTS5 search indexing for large outputs. Variable persistence for storing intermediate results. Automatic adapter generation from OpenAPI specs.

What can I use MCX for?

Aggregating and filtering large API responses before sending them to the LLM. Performing complex data transformations on local files. Automating multi-step workflows using custom skills. Managing Supabase or Chrome DevTools interactions via code.

How do I install MCX?

Install MCX by running: bun add -g @papicandela/mcx-cli && mcx init

What MCP clients work with MCX?

MCX works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep MCX docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare