top | item 45467807

Show HN: Lootbox – CLI that unifies MCP and custom functions for Claude Code

2 points| jmcodes | 4 months ago |github.com

Hey HN! I built a CLI that unifies MCP tools and your custom functions under one code execution interface. Think serverless functions for your coding assistant but on your local machine

Installation is a one-liner curl script (see README)

Instead of configuring your AI with dozens of individual tools, drop a ts file in a directory, and give the LLM one capability: execute TypeScript with lootbox.

  // my-functions/example.ts
  export async function analyzeText(args: { text: string }) {
    return {
      length: args.text.length,
      words: args.text.split(' ').length,
      uppercase: args.text.toUpperCase()
    };
  }

  # Run server with your functions + MCP servers
  lootbox-runtime --rpc-dir ./my-functions --mcp-config mcp.json

  # AI writes code that uses both:
  lootbox -e '
    const file = await tools.mcp_github.read_file({repo: "x/y", path: "README.md"});
    const analysis = await tools.myapp.analyzeText({text: file});
    console.log(analysis);
  '
Your custom TypeScript functions auto-discover alongside your MCP servers and get turned into a fully typed 'tools' object that the AI can use.

AI gets full type definitions for everything. Writes code that chains operations together instead of doing sequential tool calls.

LLM scripts are executed in a Deno Sandbox with only net access. RPC files get full access.

Based on Cloudflare's Code Mode research but completely local.

Check the README for some sample rpc files, a workflow, and a much deeper dive on how it all works.

Typically Claude Code will use

  lootbox --help
  lootbox --namespaces
  lootbox --types kv,sqlite // returns the types from the typed client
And will then start writing a script to orchestrate the tools to accomplish the goal.

Lootbox can also run files so you can tell Claude to save the script as a file and later just run it with

  lootbox path/to/script.ts
Built it after continuing to experiment and play with my original take on Code Mode.

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

Original Take: https://github.com/jx-codes/codemode-mcp

discuss

order

No comments yet.