Code Mode CLI
Lets an agent call MCP and UTCP tools by running code: discover tools, get typed code and run chains instead of dozens of separate calls
- 1,666 ★ on the repository
- Last commit
- MPL-2.0
Broad access
Why this level
- Runs code that calls external tools
- Works with the network and OAuth tokens
Install
- Works in
Manual install
npx -y @utcp/code-mode-cli promptPrints an instruction for the agent on how to use Code Mode.
Access and checks
How we reviewBroad accessThe tool can change data, run commands or handle secrets.
- Runs code that calls external tools
- Works with the network and OAuth tokens
This is third-party code. Review the repository files before installing.
What it does
Code Mode turns a set of MCP and UTCP tools into code that the agent writes and runs itself. The agent searches for the tools it needs, gets their signatures as typed functions and calls them in a single program instead of many separate round trips. For agents that can run shell commands, the authors recommend the utcp CLI: it discovers tools, runs chains and handles OAuth login. There is also an MCP variant and TypeScript and Python libraries for embedding in your own code.
Who it is for. For developers and advanced agent users who want to save tool calls and combine them in code.
Good fit when
- The agent makes many separate tool calls in a row
- You need to combine several tools into one chain
- You need one way to call both MCP and UTCP tools
Not a fit when
- A single simple tool call is enough
- You cannot allow the agent to run arbitrary code
Example request
Using Code Mode, find GitHub tools and build one chain: find an issue and add a labelLimitations
The approach runs code that calls tools, so use it only in a trusted environment with clear permissions. OAuth login writes a token to a .env file, whose storage you must watch.
How to disable. With npx no separate install is needed. Remove the MCP variant from your MCP config, and uninstall the libraries via your package manager.
FAQ
Do I need MCP?
No. For agents that can run commands the utcp CLI is preferred and needs no MCP server. An MCP variant also exists.
Which languages can I embed it in?
TypeScript and Python, with separate libraries.
Discussion
No questions or reviews yet.
Related
CLI toolsA CLI that turns any MCP server, OpenAPI spec or GraphQL endpoint into commands at runtime, with no codegen
A universal MCP CLI client from Apify: persistent sessions, OAuth, JSON output for scripts and shell access to any MCP server for agents
pctx turns tools and MCP servers into code that an agent runs in a sandbox instead of passing every result through its context.
An MCP builder agent that picks servers from the official registry and composes them into your own agentic MCP server.
The mcpl CLI searches tools across several MCP servers and calls them from the terminal, with OAuth sign-in done by a human
A CLI for any MCP server: list and call tools, resources and prompts, run mock and proxy modes, guard access and manage agent configs
README in short
The README presents Code Mode as a way to call MCP and UTCP tools through code execution. For agents with shell access it recommends the utcp CLI with search, run and OAuth login commands. It also describes an MCP variant and TypeScript and Python libraries. The repository is split into code-mode-cli, code-mode-mcp and language packages.