Skip to main content

bub-mcp

Expose configured MCP servers as Bub tools.

Installation

uv pip install bub-mcp

Configuration

The plugin reads MCP server definitions from a dedicated JSON file under Bub home:

  • ~/.bub/mcp.json
  • or $BUB_HOME/mcp.json when BUB_HOME is set

The file must contain a top-level mcpServers mapping:

{
  "mcpServers": {
    "weather": {
      "url": "https://weather.example.com/mcp",
      "transport": "http"
    },
    "local": {
      "command": "python",
      "args": ["./server.py"]
    }
  }
}

Discovered MCP tools are registered as Bub deferred tools by default: the model only sees their names until it loads their definitions with tool.describe, which keeps large MCP tool sets out of the prompt. Set BUB_MCP_DEFERRED_TOOLS=false to expose them directly instead.

CLI Usage

Use the CLI to inspect and manage mcp.json:

bub mcp list

Add an HTTP server:

bub mcp add --transport http weather https://weather.example.com/mcp

Add an SSE server with headers:

bub mcp add \
  --transport sse \
  --header "Authorization: Bearer token" \
  events \
  https://events.example.com/mcp

Add a stdio server with environment variables:

bub mcp add \
  --transport stdio \
  --env API_KEY=secret \
  filesystem \
  -- npx -y @modelcontextprotocol/server-filesystem /tmp

Remove a server:

bub mcp remove weather

bub mcp add writes the server config into mcp.json and performs a connection test before exiting.

Embedding

Other Bub plugins can reuse the MCP lifecycle and tool bridge with a read-only configuration:

from bub_mcp.plugin import MCPChannel

channel = MCPChannel.from_server_configs(
    {"weather": {"url": "https://weather.example.com/mcp"}}
)

# Inside the embedding application's async lifecycle:
await channel.connect()
try:
    channel.bind_agent(agent)
    # Run the agent while its MCP connections are open.
finally:
    await channel.stop()

Discovered tools belong to the channel and are available through channel.tools; they are not provided through the provide_tools hook. Bub collects those tools when a BubAgent is created, so tools discovered afterward would not reach existing agents. The plugin's load_state hook waits for startup discovery and binds tools to the turn's Agent (including an explicit _runtime_agent). Stopping the channel removes its bindings and restores any tools it replaced.

An embedding application can call channel.bind_agent(agent) after startup discovery completes, or await channel.bind_runtime_tools(framework, message) from its own load_state hook. Both paths use instance tools. This requires Bub's instance-tool API introduced in upstream PR #311.

The default MCPChannel() behavior remains backed by Bub's mcp.json. Read-only channels reject add() and remove() so an embedding plugin remains the owner of its source configuration. The standalone MCPChannel() construction remains unchanged. A composite plugin that must keep unrelated components running when all MCP servers fail can subclass the channel and set stop_when_all_failed = False.

Metadata

Release files for bub-mcp 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bub-mcp 0.3.2
File Size Uploaded Provenance Actions
bub_mcp-0.3.2.tar.gz 9.5 kB Without provenance Details for bub_mcp-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bub-mcp 0.3.2
File Interpreter ABI Platform Actions
bub_mcp-0.3.2-py3-none-any.whl Python 3 none any Details for bub_mcp-0.3.2-py3-none-any.whl

Total release size: 20.6 kB

Release files / bub_mcp-0.3.2.tar.gz

Download URL bub_mcp-0.3.2.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a62337b93f692e5b357d2964b9fd5c2d97f6507f5f89ea20b9f3eeb35e9fe57e
BLAKE2b-256 checksum
How to use checksums
89a57f91d23f96dbde3d4d74af1f9eb13543e56c47f07a0973893caa7e02adbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bub_mcp-0.3.2-py3-none-any.whl

Download URL bub_mcp-0.3.2-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0765fd4393bf0d6d5e20054e7443d322c90b9b9414b0ddf8a97313a1103c73fc
BLAKE2b-256 checksum
How to use checksums
6921c5557610807a78a58539ea6e5bb7b0f46ae70becc3bc400e07a5741295e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for bub-mcp 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page