← All changes
feature· API

Run code against Sinatra's MCP tools

Sinatra's MCP server has a run_code tool: an agent writes a short JavaScript function that calls the other tools, and Sinatra runs it in a sandbox, so a search, a filter and several follow-up calls take one step instead of one round trip each.

Every call the code makes runs as you, with the same checks as calling that tool directly, so code can't do anything the tools themselves can't. The sandbox has no network or filesystem access, and each run is capped: 50 tool calls, 200 ms of computation, 30 seconds and a 50,000-character result. One trade-off to know: your MCP client asks you to approve a run_code call once for the whole script, not each tool call inside it, so read the code before you approve it. The existing tools are unchanged, so clients that call them one at a time keep working.