MCX (Modular Code Execution)
Allows executing sandboxed code to interact with Slack's API, enabling capabilities such as fetching channel history and polling for specific messages while optimizing token usage through local data processing.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCX (Modular Code Execution)fetch the last 50 orders and calculate the total revenue by category"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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:
Tool definition overload - Loading all tool definitions floods context
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,000Result: 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 initRequires 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 serveDirectory 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 indexClaude 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.
Claude Code Hooks (Optional)
Redirect native tools to MCX alternatives for better performance:
~/.claude/settings.json:
{
"hooks": {
"PreToolUse": [
{ "matcher": "Grep", "hooks": [{ "type": "command", "command": "bun ~/.claude/hooks/mcx-redirect.js" }] },
{ "matcher": "Glob", "hooks": [{ "type": "command", "command": "bun ~/.claude/hooks/mcx-redirect.js" }] },
{ "matcher": "Edit", "hooks": [{ "type": "command", "command": "bun ~/.claude/hooks/mcx-redirect.js" }] },
{ "matcher": "Write", "hooks": [{ "type": "command", "command": "bun ~/.claude/hooks/mcx-redirect.js" }] },
{ "matcher": "Read", "hooks": [{ "type": "command", "command": "bun ~/.claude/hooks/mcx-read-check.js" }] },
{ "matcher": "Bash", "hooks": [{ "type": "command", "command": "bun ~/.claude/hooks/mcx-bash-check.js" }] }
]
}
}Native Tool | MCX Alternative | Advantage |
|
| Frecency ranking, git status, proximity boost |
|
| SIMD-accelerated, fuzzy search |
|
| No "read first" requirement, CRLF normalization |
|
| No "read first" requirement |
|
| File stays in sandbox, 99% token savings |
|
| Redirects shell commands to MCX |
See Hooks Integration for hook scripts.
Key Features
Feature | Description |
Lazy Loading | Adapters from |
Domain Hints | Adapters grouped by domain (payments, database, email, etc.) for better discoverability |
Silent Auto-Correction |
|
Context Efficiency | Filtering happens in sandbox, model sees results only |
Variable Persistence | Store results as |
Auto-Compress | Stale variables (>5min, >1KB) auto-compressed to save context |
FTS5 Search | Auto-index large outputs, search with |
FFF Integration | Fast File Finder - SIMD-accelerated fuzzy search, content grep |
Background Tasks |
|
Batch Operations |
|
File Processing |
|
Large File Handling | Files >50KB stay in sandbox via |
File Editing |
|
File Query Helpers |
|
URL Fetching |
|
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 |
| Execute code with adapter access, auto-stores as |
| 3 modes: spec exploration, FTS5 search, adapter/method search |
| Multiple executions/searches in one call (bypasses throttling) |
| Process local files with |
| Edit files (string mode or line mode) - bypasses native Edit's read requirement |
| Create/overwrite files - bypasses native Write's read requirement |
| Fetch URLs with HTML-to-markdown and auto-indexing (24h cache) |
| Fast fuzzy file search with frecency + proximity ranking |
| SIMD-accelerated content search across files |
| Find related files by imports/exports analysis |
| Navigate large JSON results without loading full content |
| Run code in background, returns task ID immediately |
| List/check background tasks and their results |
| List available adapters and skills |
| Session statistics (indexed content, variables, network) |
| Run diagnostics (Bun, SQLite, adapters, sandbox, FFF) |
| Get self-upgrade command for latest version |
| Run a registered skill |
CLI Commands
Command | Description |
| Start MCP server (default) |
| Generate adapters from OpenAPI specs (with TUI) |
| Initialize global |
| Update CLI and global installation |
| List available adapters and skills |
| Run a skill directly |
| View server logs |
See CLI documentation for details.
Included Adapters
Adapter | Methods | Description |
| 24 | Supabase Management API (projects, tables, functions, secrets) |
| 25 | Chrome DevTools Protocol (screenshots, navigation, DOM) |
Generate your own adapters from OpenAPI docs:
mcx gen ./api-docs.md -n myapiBuilt-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, 10) // Markdown table
// Async helpers
await poll(fn, { interval: 2000, maxIterations: 5 }) // Poll until done
await waitFor(fn, { timeout: 30000 }) // Wait for conditionFile Query Helpers
When using mcx_file({ path, storeAs }) to load files into sandbox:
// Load file without returning content to context (99% token savings)
mcx_file({ path: "src/large-file.ts", storeAs: "src" })
// Then query with helpers:
around($src, 150, 10) // 10 lines around line 150
lines($src, 100, 120) // Get lines 100-120 (1-indexed, inclusive)
block($src, 150) // Extract code block by indentation
grep($src, "TODO", 3) // Search with 3 lines context
outline($src) // Extract function/class signaturesDocumentation
CLI Commands - Detailed command reference
Adapters - Creating and generating adapters
Skills - Reusable operations
Configuration - Config file reference
Programmatic API - Using MCX in code
Security - Sandbox security layers
Development
git clone https://github.com/schizoidcock/mcx
cd mcx
bun install
bun run buildLicense
MIT
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/schizoidcock/mcx'
If you have feedback or need assistance with the MCP directory API, please join our Discord server