universal-tool-calling-protocol/code-mode
๐ Plug-and-play library to enable agents to call MCP and UTCP tools via code execution.
1,519 โ
100 forksTypeScriptUpdated 1mo ago
What you need to know
The first library for tool calls via code execution โ instead of exposing hundreds of MCP/UTCP tools directly, it gives an AI agent one tool that executes TypeScript code with sandboxed access to the whole toolkit, replacing many round trips with a single execution.
Install
npm install @utcp/code-mode
For shell agents (preferred): npx -y @utcp/code-mode-cli prompt (self-configuring CLI, no server needed)
For MCP-only clients: {"mcpServers":{"code-mode":{"command":"npx","args":["@utcp/code-mode-mcp"],"env":{"UTCP_CONFIG_FILE":"/path/to/.utcp_config.json"}}}
Transport plugins: npm install @utcp/mcp (or @utcp/http, @utcp/text, etc.)Usage
- โขconst client = await CodeModeUtcpClient.create(); await client.registerManual({name:"github", call_template_type:"mcp", config:{...}});
- โขconst { result, logs } = await client.callToolChain(`...code...`, timeoutMs);
- โขDiscover tools instead of loading 500 definitions: await client.searchTools("github pull request")
- โขCLI: npx -y @utcp/code-mode-cli search "<task>" / run / login (interactive OAuth)
Key features
- โCode-mode execution: single TypeScript code block replaces 15+ traditional tool calls (67-88% faster per independent benchmark)
- โProgressive tool discovery and auto-generated TypeScript interfaces for IDE IntelliSense
- โMulti-protocol tool chains mixing MCP, HTTP/REST (with auto-discovery), File (JSON/YAML), and CLI tools in one execution
- โEnterprise-ready: Node.js VM sandboxing, no filesystem/network access by default, configurable timeouts, full console log capture
- โShips AGENT_PROMPT_TEMPLATE for any AI framework plus a ready-to-use MCP server and a self-configuring utcp CLI
Best for
Coding agents (Claude Code, Cursor, Codex, Claude Cowork) that want fewer, larger tool executions with lower token cost and context bloat.
Caveats
- โ Cost-savings claims ($9,536/year at 1,000 scenarios/day) come from an independent Python benchmark study, not first-party
- โ Prefer the CLI when the agent has shell access; the MCP server is for MCP-only clients like Claude Desktop
- โ License: MPL-2.0
Clients: Claude Code ยท Cursor ยท Codex ยท Claude Cowork ยท Claude Desktop (via MCP server)
Documentation โReviewed 2026-08-07
Topics
ai-agentscodemodemcpmodel-context-protocoltoolchainutcp
- Stars
- 1,519โ
- Forks
- 100
- Language
- TypeScript
- License
- MPL-2.0
- Created
- 2025-11-11
- Last push
- 2026-06-18