npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@squadbase/mcp-bonsai

v0.0.1-build3

Published

MCP middleware proxy for filtering tools, resources, and prompts

Readme

@squadbase/mcp-bonsai

A middleware proxy for filtering tools, resources, and prompts from MCP (Model Context Protocol) servers.

Overview

mcp-bonsai sits between LLM clients (like Claude Code) and MCP servers as a proxy. It intercepts JSON-RPC messages and filters tools/list, resources/list, and prompts/list responses based on your configuration.

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│ LLM Client  │ ──► │ mcp-bonsai  │ ──► │ MCP Server  │
│ (Claude)    │ ◄── │  (Proxy)    │ ◄── │             │
└─────────────┘     └─────────────┘     └─────────────┘
                          │
                    Filters based on
                    configuration

Installation

npm install @squadbase/mcp-bonsai

Usage

CLI

npx mcp-bonsai --name <identifier> --command "<mcp-server-command>" [options]

Options

| Option | Required | Description | |--------|:--------:|-------------| | -n, --name <identifier> | ✅ | Identifier for config lookup | | -c, --command <cmd> | ✅ | MCP server command to spawn | | -f, --config <path> | | Config file path or JSON string | | --debug | | Enable debug logging to stderr |

Examples

# Filter next-devtools-mcp
npx mcp-bonsai \
  --name next-devtools \
  --command "npx -y next-devtools-mcp@latest" \
  --config ./mcp-bonsai.json

# Pass config as JSON string
npx mcp-bonsai \
  --name myserver \
  --command "uvx some-mcp-server" \
  --config '{"myserver": {"tools": ["allowed_tool"]}}'

Configuration

Configuration uses a whitelist approach to specify which tools, resources, and prompts are allowed.

Supported Formats

  • JSON (.json)
  • YAML (.yaml, .yml)

Schema

{
  "<server-name>": {
    "tools": ["tool1", "tool2"],
    "resources": ["resource://*"],
    "prompts": ["prompt1"]
  }
}

| Field | Type | Description | |-------|------|-------------| | tools | string[] | List of allowed tool names | | resources | string[] | List of allowed resource URIs (supports wildcards) | | prompts | string[] | List of allowed prompt names |

Configuration Examples

Filtering next-devtools-mcp

{
  "next-devtools": {
    "tools": [
      "init",
      "nextjs_docs",
      "nextjs_index",
      "nextjs_call"
    ],
    "resources": [],
    "prompts": []
  }
}

This configuration blocks browser_eval, enable_cache_components, and upgrade_nextjs_16.

YAML Format

next-devtools:
  tools:
    - init
    - nextjs_docs
    - nextjs_index
  resources: []
  prompts: []

Wildcards

Resource filtering supports wildcards (*).

{
  "myserver": {
    "resources": [
      "file://*",
      "system_logs://*"
    ]
  }
}

Usage with Claude Code

Register mcp-bonsai as an MCP server in ~/.claude/claude_code_config.json:

{
  "mcpServers": {
    "next-devtools-filtered": {
      "command": "npx",
      "args": [
        "mcp-bonsai",
        "--name", "next-devtools",
        "--command", "npx -y next-devtools-mcp@latest",
        "--config", "/path/to/mcp-bonsai.json"
      ]
    }
  }
}

How It Works

  1. Startup: Spawns the specified MCP server as a child process
  2. Passthrough: Most messages are forwarded as-is
  3. Filtering: Only tools/list, resources/list, and prompts/list responses are filtered based on configuration
  4. Execution: tools/call and other execution requests are passed through without modification

Debugging

Use the --debug option to output detailed logs to stderr:

npx mcp-bonsai \
  --name next-devtools \
  --command "npx -y next-devtools-mcp@latest" \
  --config ./mcp-bonsai.json \
  --debug

Debug logs show:

  • Client requests received
  • Server responses received
  • Filtered tools/resources/prompts

Development

# Build
npm run build

# Type check
npm run typecheck

# Unit tests
npm test

# Integration tests (requires network)
npm run test:integration

# Development mode (watch)
npm run dev

License

MIT