🏆 Built for Anthropic MCP Hackathon

Agents Write Code.
Orchestrate Everything.

One prompt. One code block. Multiple MCP servers working together. CodeMesh lets agents write TypeScript code to orchestrate ANY MCP server - automatically.

Inspired by Cloudflare's Code Mode pattern, reimagined for the MCP ecosystem.

Built with Claude Sonnet 4.5

The Problem

  • Traditional MCP: Expose 50+ tools, flood agent context
  • Agents can't coordinate tools from different servers
  • Trial-and-error on unclear tool outputs wastes tokens
  • Every agent repeats the same mistakes

The CodeMesh Way

  • Just 3 tools: discover, get APIs, execute code
  • Agents write TypeScript calling multiple servers at once
  • Auto-augmentation forces documentation of outputs
  • Knowledge compounds: Agent A helps Agent B

Why CodeMesh?

The only MCP server that gets smarter with every use

🧠

Self-Improving

Agents document unclear outputs. Future agents benefit. Proven: Agent B one-shots what Agent A struggled with!

🔗

Multi-Server Orchestration

Coordinate tools from different MCP servers in a single code block. HTTP, stdio, websocket all supported.

🎯

Context Efficient

Load only the tools you need. Tiered discovery prevents context pollution. 3 tools vs 50+.

🚀

Zero Configuration

Point to your MCP servers and go. No complex setup, no schema definitions, no boilerplate code.

Production Ready

Authentication, error handling, multi-transport support. Battle-tested and ready to deploy.

🔒

Secure by Default

Environment variable substitution. Principle of least privilege. Safe to commit configs.

How It Works

Three automatic steps from prompt to result

Watch the complete workflow: discover → get APIs → execute code (with auto-augmentation in action!)

Example: Real-World Usage

You ask Claude:

"Use CodeMesh to give me the top 3 weather alerts for San Francisco, CA"

Behind the scenes, CodeMesh automatically:

1

Discovers Tools

Context-efficient discovery - only tool names and descriptions

CodeMesh sees available tools:
  • geocodeServer.geocode - Convert "San Francisco, CA" to coordinates
  • weatherServer.getAlerts - Fetch weather alerts by state
2

Loads Type-Safe APIs

Generates TypeScript functions with augmentation docs

// CodeMesh generates these APIs for the agent:
geocodeServer.geocode({ location: string })
weatherServer.getAlerts({ state: string })
3

Writes & Executes Code

Agent writes TypeScript, CodeMesh executes in secure sandbox

// Agent writes this code automatically:
const coords = await geocodeServer.geocode({
  location: "San Francisco, CA"
});

const alerts = await weatherServer.getAlerts({
  state: coords.state
});

const alertsData = JSON.parse(alerts.content[0].text);

// Filter to top 3 by severity
const top3 = alertsData.features
  .sort((a, b) => severityRank(a) - severityRank(b))
  .slice(0, 3);

return top3;
✓ Executes in VM2 sandbox with 30s timeout
✓ Returns formatted results to Claude

You get intelligent results - no manual tool calls, no trial-and-error, just results! 🎯

🎉 The Innovation That Changes Everything

Auto-Augmentation

The world's first self-improving MCP server

When agents encounter unclear tool outputs, they're forced to document what they learned. This knowledge becomes part of the system, helping all future agents succeed faster.

1. Agent Explores

Agent needs to get file size but isn't sure what format filesystemServer.getFileInfo returns.

TypeScript
// EXPLORING: What format does this return?
const result = await filesystemServer.getFileInfo({ path: 'package.json' });
console.log(result.content[0].text);

// Output (bespoke format!):
// size: 38075
// created: Tue Sep 30 2025 10:52:47 GMT-0400
// modified: Tue Sep 30 2025 10:52:47 GMT-0400
// isDirectory: false
// isFile: true
// permissions: 644

2. Agent Writes Augmentation

CodeMesh forces agent to document the output format with parsing examples.

Markdown (saved to .codemesh/)
## Output Format
Returns newline-delimited key-value pairs: `key: value`

### Fields
- size: File size in bytes (number)
- isDirectory: Boolean (true/false)
- isFile: Boolean (true/false)
- permissions: Unix permissions (e.g., "644")

### Parsing Example
const text = result.content[0].text;
const info = Object.fromEntries(
  text.split('\n').map(line => line.split(': '))
);
console.log(info.size); // "38075"

3. Agent and ALL Future Agents Succeed

Now every agent knows how to parse file info. No more trial-and-error!

TypeScript (with enhanced docs)
// Agent gets augmented JSDoc with parsing example!
const result = await filesystemServer.getFileInfo({ path: 'data.json' });

// Agent knows exact format and how to parse
const text = result.content[0].text;
const info = Object.fromEntries(text.split('\n').map(line => line.split(': ')));
const fileSizeBytes = parseInt(info.size);

console.log(`File size: ${fileSizeBytes} bytes`);
// ✅ Success on first try!

Validated: Agent A explored and documented. Agent B one-shot the same task. This is compound intelligence in action! 🎉

Ready to Get Started?

Four simple steps to orchestrate ANY MCP server with agents.

1

Add CodeMesh MCP Server

Add CodeMesh to your Claude desktop config or MCP client

2

Copy Your MCP Servers

Copy your existing MCP server configs to .codemesh/config.json

3

Write a Prompt

Tell your agent what to do:

"Use codemesh to get the current weather for San Francisco"
4

Watch the Magic! ✨

Agent writes TypeScript, coordinates multiple servers, returns results

Full installation guide in the README