Code Mode

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

CLI

High risk

We rate an entry high when the tool writes to external systems, handles money, production databases or secrets, or runs arbitrary commands. The CLI installs it only with your consent.

Why this level

  • Runs code that calls external tools
  • Works with the network and OAuth tokens
All reasons and checks

universal-tool-calling-protocol/code-mode

Install

Manual install

npx -y @utcp/code-mode-cli prompt

Prints an instruction for the agent on how to use Code Mode.

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 label

Limitations

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.

Security check

  • Runs code that calls external tools
  • Works with the network and OAuth tokens

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.

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.

Editors’ pick

Open-source personal AI assistant on your own machine: answers in Telegram, Slack, Discord and WhatsApp, extended with skills and plugins

CLIHigh risk390.7KRepository stars
Editors’ pick

A self-improving agent from Nous Research with a TUI, messaging gateway, cron jobs and skills it writes itself

CLIHigh risk249.8KRepository stars
Editors’ pick

An open source coding agent for the terminal and desktop with build and plan modes

CLIHigh risk210.6KRepository stars
Editors’ pick

Open prompt library with a Claude Code plugin, MCP server and CLI: search, fetch and improve prompts and skills from an agent

PluginMedium risk171.5KRepository stars
Foxx AICode Mode

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.