Code Mode

v1.0.0β€’Coding Agentsβ€’stable

πŸ”Œ Plug-and-play library to enable agents to call MCP and UTCP tools via code execution.

ai-agentscodemodemcpmodel-context-protocoltoolchain
Share:
1,461
Stars
0
Downloads
0
Weekly
0/5

What is Code Mode?

Code Mode is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to πŸ”Œ plug-and-play library to enable agents to call mcp and utcp tools via code execution.

πŸ”Œ Plug-and-play library to enable agents to call MCP and UTCP tools via code execution.

This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • πŸ”Œ Plug-and-play library to enable agents to call MCP and UTC

Use Cases

Enable agents to call MCP and UTCP tools via code execution.
Plug-and-play library for tool integration in agent workflows.
LicenseMPL-2.0
Languagepython
Versionv1.0.0
UpdatedMay 21, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx code-mode

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Code Mode

Code Mode is a plug-and-play library from the Universal Tool Calling Protocol (UTCP) project that enables AI agents to call MCP and UTCP tools by executing TypeScript code in an isolated VM sandbox. Rather than routing tool calls through a fixed dispatcher, agents write actual TypeScript that chains multiple tools togetherβ€”fetching a GitHub PR, reading its comments, and summarizing them in one code block. It supports multi-protocol orchestration across MCP, HTTP, File, and CLI tool sources with full console log capture and configurable execution timeouts.

Prerequisites

  • Node.js 18 or later installed
  • npm or npx available
  • An MCP-compatible client such as Claude Desktop
  • A UTCP config file (.utcp_config.json) listing the tools/servers to expose
  • Optional: GitHub personal access token if using GitHub MCP tools
1

Install the core library

Install the @utcp/code-mode package and the MCP protocol adapter into your project.

npm install @utcp/code-mode
npm install @utcp/mcp
2

Create a UTCP configuration file

Define which MCP servers or UTCP tool providers are available to agents in a JSON config file. This file maps tool providers to their connection details.

{
  "providers": [
    {
      "name": "github",
      "call_template_type": "mcp",
      "config": {
        "command": "npx",
        "args": ["-y", "@modelcontextprotocol/server-github"],
        "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "your_token" }
      }
    }
  ]
}
3

Configure Claude Desktop to use the Code Mode MCP server

Add the Code Mode MCP server to your claude_desktop_config.json, pointing it at your UTCP config file.

{
  "mcpServers": {
    "code-mode": {
      "command": "npx",
      "args": ["@utcp/code-mode-mcp"],
      "env": {
        "UTCP_CONFIG_FILE": "/absolute/path/to/.utcp_config.json"
      }
    }
  }
}
4

Use programmatically in TypeScript

For direct integration, create a CodeModeUtcpClient, register tool providers, and call callToolChain() with TypeScript code that orchestrates tools.

import { CodeModeUtcpClient } from '@utcp/code-mode';

const client = await CodeModeUtcpClient.create();
await client.registerManual({
  name: 'github',
  call_template_type: 'mcp',
  config: {}
});

const { result, logs } = await client.callToolChain(`
  const pr = await github.get_pull_request({ owner: 'microsoft', repo: 'vscode', pull_number: 1234 });
  return { title: pr.title };
`);
5

Inspect available tools at runtime

Use the built-in introspection helpers to discover what tools are registered and examine their interfaces before writing tool-chain code.

// Inside a callToolChain() code block:
const tools = await __interfaces();
const githubTools = await __getToolInterface('github.get_pull_request');

Code Mode Examples

Client configuration

Claude Desktop configuration for the Code Mode MCP server with a UTCP config file path.

{
  "mcpServers": {
    "code-mode": {
      "command": "npx",
      "args": ["@utcp/code-mode-mcp"],
      "env": {
        "UTCP_CONFIG_FILE": "/Users/yourname/.utcp_config.json"
      }
    }
  }
}

Prompts to try

With Code Mode connected and GitHub tools configured, try these multi-step orchestration prompts.

- "Get pull request #1234 from microsoft/vscode and count its comments"
- "List all tools available in the current Code Mode session"
- "Fetch the README from a repo and summarize its installation steps"
- "Chain together a file read and a GitHub issue create in one step"

Troubleshooting Code Mode

UTCP_CONFIG_FILE is set but tools are not found

Use an absolute path for UTCP_CONFIG_FILE. Relative paths resolve differently when Claude Desktop launches the subprocess. Verify the file exists and is valid JSON with `cat /absolute/path/to/.utcp_config.json`.

Tool chain execution times out

The default execution timeout is 30 seconds. For long-running chains, configure a higher timeout when creating the CodeModeUtcpClient. Also check that the underlying MCP server (e.g. GitHub) responds within the window.

TypeScript code in callToolChain fails with syntax errors

The VM sandbox executes TypeScript but does not transpile all modern syntax. Stick to async/await patterns, avoid top-level import statements inside the chain code, and use the registered tool namespace directly (e.g., `github.tool_name()`).

Frequently Asked Questions about Code Mode

What is Code Mode?

Code Mode is a Model Context Protocol (MCP) server that πŸ”Œ plug-and-play library to enable agents to call mcp and utcp tools via code execution. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Code Mode?

Follow the installation instructions on the Code Mode GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Code Mode?

Code Mode works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Code Mode free to use?

Yes, Code Mode is open source and available under the MPL-2.0 license. You can use it freely in both personal and commercial projects.

Browse More Coding Agents MCP Servers

Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "code-mode": { "command": "npx", "args": ["-y", "code-mode"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide β†’

Ready to use Code Mode?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides