DEV Community

JM Codes
JM Codes

Posted on

MCP servers have issues, so I built 'lootbox' (inspired by Cloudflare's Code Mode)

What it is

Lootbox sits between your MCP servers / tools and gives your coding assistant a deno code sandbox to script these together.

https://github.com/jx-codes/lootbox/

How it works (more info in the readme)

I mostly use Claude Code so I reference it below

This means that Claude can write:

const results = await tools.mcp_memory.search({ query: "workflow" });
const filtered = results.entities.filter(e => e.type === "command");
const created = await tools.mcp_memory.createEntities({
  entities: [{ name: "Command Reference", type: "doc", properties: { items: filtered } }]
});

console.log(JSON.stringify({
  found: results.total,
  filtered: filtered.length,
  created: created.created
}, null, 2));
Enter fullscreen mode Exit fullscreen mode

To chain multiple tool calls together instead of going one by one.

Scripts have access to stdin(default: string).json()

So Claude could also save the above as a script, run it, and chain it with unix tools:

# Run the script and extract specific fields
lootbox extract-commands.ts | jq '.created'
Enter fullscreen mode Exit fullscreen mode

Or chain multiple scripts / unix utils together.

lootbox extract-commands.ts | lootbox process-results.ts | jq '.summary'
Enter fullscreen mode Exit fullscreen mode

The scripts above (the ones Claude writes/runs) execute in a Deno process with only --allow-net

As an alternative to MCP

Because I also hated setting up MCP servers for small tools I needed, Lootbox will look for .ts files in a directory you define and expose those in the same sandbox.

// ./lootbox/tools/memory.ts
export function hello(args: { message: string }) {...}
Enter fullscreen mode Exit fullscreen mode

These scripts are run a deno process with --allow-all

I use ts-morph to extract types from these files and Claude can then run:

  • lootbox --namespaces → see what exists (no guessing)
  • lootbox --types memory,kv → get exact TypeScript signatures without polluting your context
  • Write a script → run it → verify JSON output
  • Chain scripts with jq and unix pipes (fully composable)

Key features:

  • Reusable scripts: Claude writes TypeScript once, saves it, runs it anytime
  • Chain MCP calls: Multiple tool calls in one script with full control flow
  • Unix composable: JSON output works with jq, grep, pipes
  • Built in workflow management: See repo / readme
  • Extend with functions: Write your own TypeScript functions that get exposed as tools.yournamespace.yourfunction()

Basically gives Claude full programming capabilities to orchestrate your MCP tools instead of one-shot tool calls.

This is meant to run locally and is just a tool I've been building that I found useful. I'll post a deeper dive later but wanted to share this with the community

MIT License, I'll be tweaking it and building on it as I use it more. Curious to hear y'all's thoughts.

Top comments (0)