v0.4.0 - Codemode API
New Features
Codemode API
A new reduced-context API for AI to interact with MCP servers via JavaScript code execution. Instead of exposing dozens of tools, codemode exposes just 2 tools that dramatically reduce context usage:
codemode_search- Search for MCP capabilities (tools, resources, prompts, servers) across all connected backends using regex patternscodemode_execute- Execute JavaScript code in a sandboxed environment with access to themcp.*API
Available mcp.* API
// Server discovery
mcp.listServers()
// Tool operations
mcp.listTools(serverPattern?)
mcp.callTool(server, tool, args?)
// Resource operations
mcp.listResources(serverPattern?)
mcp.listResourceTemplates(serverPattern?)
mcp.readResource(server, uri)
// Prompt operations
mcp.listPrompts(serverPattern?)
mcp.getPrompt(server, name, args?)
// Utilities
mcp.sleep(ms)
mcp.log(...args)Security Features
- Sandboxed VM execution with blocked dangerous globals (process, require, eval, fetch, etc.)
- Configurable timeout (1s - 5min, default 30s)
- MCP call limit enforcement (default 100 calls)
- Code length limits (100KB max)
Improvements
- Request tracking integration for waterfall UI debugging
- Structured logging for codemode executions
- Comprehensive test suite (52 tests)
Bug Fixes
- Fixed timeout timer leak in sandbox execution
- Fixed unsafe status cast for server info
- Added missing "resource" content type handling
- Warning logs from API operations are now captured in results