I measured what code mode actually saves: 65,500 tokens vs 226
Cloudflare's "code mode" suggests LLMs excel at generating code to interact with external services (MCPs) rather than directly calling them. A test demonstrated that an LLM could generate a 2,500-endpoint API using only 1,000 tokens. The author then performed a personal task: fetching all in-progress Linear tickets and counting "mcp" occurrences within them.This task could be done via tool calls, requiring 40 sequential model interactions and over 65,000 tokens. Alternatively, a ten-line script accomplished the same in a single interaction with approximately 226 tokens. This represents a significant saving in both context size and round trips, leading to faster execution.Beyond cost, the script offered superior accuracy. While the LLM's counting was approximate, a script provided exact results. A major hurdle for code mode adoption is the re-authentication required for each service when the agent is already logged in.To address this, the author created agent-codemode, which leverages existing credentials. This tool enables multi-server scripting with typed clients and eliminates the need for repeated authentication. The key innovation is allowing agents to utilize pre-existing credentials seamlessly.The tool also includes a skill that can be added to the agent's configuration, encouraging its default use. While primarily tested on macOS, Linux and Windows support is partially available. It's important to note that any process launched from a user's session can access these credentials.
agent-codemode, which leverages existing credentials. This tool enables multi-server scripting with typed clients and eliminates the need for repeated authentication. The key innovation is allowing agents to utilize pre-existing credentials seamlessly.The tool also includes a skill that can be added to the agent's configuration, encouraging its default use. While primarily tested on macOS, Linux and Windows support is partially available. It's important to note that any process launched from a user's session can access these credentials.