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.jsonwhenBUB_HOMEis 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"]
}
}
}
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; discovery does
not modify bub.tools.REGISTRY. Bub snapshots that registry when an Agent is created, so changing
it afterward would not update 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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bub_mcp-0.3.0.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bub_mcp-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.5 kB
Release files / bub_mcp-0.3.0.tar.gz
| Download URL | bub_mcp-0.3.0.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
429b2301de195848268d2768a58f38c7b78c4bb06e1ac70ba05b3a6f6abfb4ed
|
|
BLAKE2b-256 checksum How to use checksums |
a6ae57392a3274fc67f1bf52d65f4de3317081262a9525ebe4e9e7e2bf37f6b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","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.0-py3-none-any.whl
| Download URL | bub_mcp-0.3.0-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
68d5b8707d9b9e7bc7199855398257364615d349df25a86adee24d459db5c0b3
|
|
BLAKE2b-256 checksum How to use checksums |
1f9bec9dcb508fa260f35512f45eeaeb3850d7218e58b404be595020e8178c0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","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}
|