Model Context Protocol (MCP) integration for Bridgic.
Project description
Bridgic MCP Integration
This package provides Model Context Protocol (MCP) integration for the Bridgic framework.
Overview
The bridgic-protocols-mcp package enables Bridgic to connect to and interact with MCP servers, allowing you to:
- Connect to MCP Servers: Establish connections via different transports and connections with lifecycle management
- Use MCP Tools: Integrate MCP tools seamlessly into Bridgic agentic workflows
- Access MCP Prompts: Retrieve and use prompts from MCP servers
Installation
pip install bridgic-protocols-mcp
Quick Start
Connecting to an MCP Server
from bridgic.protocols.mcp import McpServerConnectionStdio
# Create a connection to a filesystem MCP server
connection = McpServerConnectionStdio(
name="filesystem-server",
command="npx",
args=["-y", "@modelcontextprotocol/server-filesystem", "/path/to/directory"],
)
# Establish the connection
connection.connect()
# List available tools
tools = connection.list_tools()
for tool in tools:
print(f"Tool: {tool.tool_name} - {tool.tool_description}")
Using MCP Tools in an Automa
MCP tools can be integrated into Bridgic automas as workers in GraphAutoma. Furthermore, in ReCentAutoma, these tools can be used in a more advanced LLM-driven agents to select and invoke them dynamically.
Using MCP Tools as Workers in GraphAutoma
MCP tools can be converted to workers and added to a GraphAutoma, giving them the same execution status as regular scheduling units. This allows you to orchestrate MCP tool calls alongside other workers in your workflow.
from bridgic.core.automa import GraphAutoma
from bridgic.protocols.mcp import McpServerConnectionStdio
# Setup connection
connection = ...
connection.connect()
# Create automa and add MCP tools as workers. Then they can be orchestrated with other workers,
# participate in dependency graphs, and be scheduled just like any other worker in the system.
automa = GraphAutoma()
for tool_spec in connection.list_tools():
# Convert each MCP tool to a worker and add it to the automa
worker = tool_spec.create_worker()
automa.add_worker(worker)
Using MCP Tools with ReCentAutoma
MCP tools can also be used directly with ReCentAutoma, where the LLM can autonomously select and call tools based on the user's request. This enables building intelligent agents that can interact with MCP servers through natural language.
from bridgic.core.agentic.recent import ReCentAutoma
from bridgic.protocols.mcp import McpServerConnectionStreamableHttp
from bridgic.llms.openai import OpenAILlm, OpenAIConfiguration
import os
# Setup MCP connection
connection = ...
connection.connect()
# Create ReCentAutoma with MCP tools
react_automa = ReCentAutoma(
llm=llm,
tools=connection.list_tools(),
)
Features
Connection Management
The package provides two connection implementations:
McpServerConnectionStdio: For stdio-based MCP serversMcpServerConnectionStreamableHttp: For HTTP-based MCP servers
Both support:
- Automatic lifecycle management
- Thread-safe operations
- Timeout configuration
Tool Integration
MCP tools are automatically wrapped in Bridgic's tool system:
McpToolSpec: Represents an MCP tool as a Bridgic tool specificationMcpToolWorker: Executes MCP tool calls
Prompt Integration
Access prompts from MCP servers:
# List available prompts
prompts = connection.list_prompts()
# Get a specific prompt
prompt_template = prompts[0]
messages = prompt_template.format_messages(arg1="value1", arg2="value2")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bridgic_protocols_mcp-0.1.1.tar.gz.
File metadata
- Download URL: bridgic_protocols_mcp-0.1.1.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
265e6bf7f201366f75d20e94ecf705268252e026e9b526bdb411ffc8f7bdccda
|
|
| MD5 |
3bbf0cfae999a33c49248949a622eb4d
|
|
| BLAKE2b-256 |
8e462e85a5d71682fb78460df462ca13048909a5535874b5a0439e1d8a2a586a
|
File details
Details for the file bridgic_protocols_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: bridgic_protocols_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de8ec83a23ab793cdab477fe90e853240f0417001668660027458927cdb5c12b
|
|
| MD5 |
1ef775cde7aabe1ac28817b662476e2f
|
|
| BLAKE2b-256 |
2ef4f41f37eefea52a45c91efcc41cd3d3ca51d3860043b6c809665deb5837e9
|