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"]
}
}
}
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; 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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| bub_mcp-0.3.1.tar.gz | 9.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bub_mcp-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.4 kB
Release files / bub_mcp-0.3.1.tar.gz
| Download URL | bub_mcp-0.3.1.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72dd3f7e8574270288ffef333801f372c536916bdba901241b78d584aa8dfdfe
|
|
BLAKE2b-256 checksum How to use checksums |
0091ab067e8e46fce047dd8c00bb25dcdf5784919e61ac851983e48952dd6f38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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.1-py3-none-any.whl
| Download URL | bub_mcp-0.3.1-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1935b0b1dac7d93cd5f8b7088ec5d38e1a8d02f051aa839806b15966997878fb
|
|
BLAKE2b-256 checksum How to use checksums |
f9ab5c068fa5dc10a4c5676c7d1e56f6cc791f5f4bc300a8ca395d78a27ae53e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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.1
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.