code-mode
🔌 Plug-and-play library to enable agents to call MCP and UTCP tools via code execution.
claude mcp add --transport stdio universal-tool-calling-protocol-code-mode npx @utcp/code-mode-mcp \ --env UTCP_CONFIG_FILE="/path/to/your/.utcp_config.json"
How to use
Code Mode is an MCP server that enables executing complex workflows by running TypeScript code that orchestrates tools from registered toolsets. The included MCP server setup lets you deploy Code Mode as an MCP endpoint so clients like Claude Desktop can invoke a single code execution that performs multiple operations across tools, instead of issuing many separate API calls. With Code Mode, you can discover tools dynamically, register them under a name, and then execute a composed TypeScript script that uses those tools to produce a final result in one go. This approach reduces latency, improves consistency, and simplifies error handling by bundling orchestration into a sandboxed code execution environment.
How to install
Prerequisites:
- Node.js (LTS version) installed on your system
- npm or yarn available
- Access to a command line with network access to fetch packages
Step-by-step:
-
Install the Code Mode MCP package globally or locally via npm: npm install -g @utcp/code-mode-mcp or npm install @utcp/code-mode-mcp
-
Prepare an MCP config file to run the Code Mode MCP server. Create a file (e.g., .utcp_config.json) if you want to customize UTCP settings: { "mcpServers": { "code-mode": { "command": "npx", "args": ["@utcp/code-mode-mcp"], "env": { "UTCP_CONFIG_FILE": "/path/to/your/.utcp_config.json" } } } }
-
Run the MCP server using the recommended live command (as shown in the README example): { "mcpServers": { "code-mode": { "command": "npx", "args": ["@utcp/code-mode-mcp"], "env": { "UTCP_CONFIG_FILE": "/path/to/your/.utcp_config.json" } } } }
-
Validate the server is reachable via your MCP client and begin registering tools, then call the tool chain as a single code execution.
Notes:
- Ensure your environment variables (e.g., API tokens) are provided securely via the env section of the MCP config.
- You can customize the config to load tools from JSON files or remote sources as supported by Code Mode.
- Refer to Code Mode documentation for advanced usage like dynamic tool discovery and sandbox configuration.
Additional notes
Tips and considerations:
- The UTCP_CONFIG_FILE should point to a valid JSON config that Code Mode can load at startup.
- For enterprise deployments, consider enabling sandboxed execution and strict timeout limits to prevent runaway code.
- When using tools that require authentication, pass tokens via environment variables rather than embedding them in code.
- If you encounter network issues when loading tools, verify DNS and proxy settings in your environment.
- The MCP server name (code-mode in the example) is arbitrary; you can rename it as needed in your MCP environment.
Related MCP Servers
mcp-agent
Build effective agents using Model Context Protocol and simple workflow patterns
mcp-checkpoint
MCP Checkpoint continuously secures and monitors Model Context Protocol operations through static and dynamic scans, revealing hidden risks in agent-to-tool communications.
litemcp
A minimal, lightweight client designed to simplify SDK adoption into MCP
zotero -lite
Zotero MCP Lite: Fast, Customizable & Light Zotero MCP server for AI research assistants
google-maps
Google Maps MCP Server: Connect AI Agents to Places, Directions, Geocoding & Roads APIs. Deployed on Kubernetes.
rancher
MCP server for Rancher - Kubernetes management and deployment platform