Skip to main content

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 ReActAutoma, 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 ReActAutoma

MCP tools can also be used directly with ReActAutoma, 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 import ReActAutoma
from bridgic.protocols.mcp import McpServerConnectionStreamableHttp
from bridgic.llms.openai import OpenAILlm, OpenAIConfiguration
import os

# Setup MCP connection
connection = ...
connection.connect()

# Create ReActAutoma with MCP tools
react_automa = ReActAutoma(
    llm=llm,
    system_prompt="You are a helpful assistant that can help users query information about GitHub repositories.",
    tools=connection.list_tools(),
)

Features

Connection Management

The package provides two connection implementations:

  • McpServerConnectionStdio: For stdio-based MCP servers
  • McpServerConnectionStreamableHttp: 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 specification
  • McpToolWorker: 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bridgic_protocols_mcp-0.1.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bridgic_protocols_mcp-0.1.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file bridgic_protocols_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: bridgic_protocols_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 12.1 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

Hashes for bridgic_protocols_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0da835cb92c7a4ee93297fe5e7bf2282f0a47d8088425167b50425570d531849
MD5 73b451673d5f20b1e7df93c97fc746af
BLAKE2b-256 9407bf246547b855ea0eaa13f6ad99de8e4637ef2a2d2b1b86aa4f337ea20ec9

See more details on using hashes here.

File details

Details for the file bridgic_protocols_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bridgic_protocols_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.4 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

Hashes for bridgic_protocols_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84e650de6f3aac2d9d2356d1f342f55efd0ea795f863d3b93e3a3a24abbb5f9e
MD5 85854f7164c959e81a7bc2f2f773d361
BLAKE2b-256 6c8a6f2420c20c051859c796e94ee3c7289cbe6ba4497d67ce7ceb7b7be3dbab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page