- Explore MCP Servers
- mcp_bridge
Mcp Bridge
What is Mcp Bridge
mcp_bridge is a Dart plugin designed to facilitate communication between different transport types using the Model Context Protocol (MCP). It enables connection between MCP clients and servers that may utilize varying underlying communication protocols, such as Standard I/O (STDIO) and Server-Sent Events (SSE).
Use cases
Use cases for mcp_bridge include connecting a local mcp_server running with STDIO to an external LLM frontend over SSE, embedding mcp_server within a Flutter app and exposing it via HTTP to AutoGen/ChatGPT, and bridging CLI-based tools with web-based LLM UIs.
How to use
To use mcp_bridge, add it to your pubspec.yaml file or install it via command line. Then, import the package in your Dart application, configure the bridge with the desired transport types and server/client settings, and initialize the bridge to start communication.
Key features
Key features of mcp_bridge include: acting as a bridge between MCP-compatible clients and servers, supporting multiple transport types (STDIO and SSE), enabling full-duplex message forwarding, auto-reconnection support, configurable server shutdown behavior, and JSON-configurable bridge setup.
Where to use
mcp_bridge can be used in various fields such as application development, particularly in scenarios involving local and remote Large Language Models (LLMs), as well as in connecting CLI-based tools with web-based LLM user interfaces.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcp Bridge
mcp_bridge is a Dart plugin designed to facilitate communication between different transport types using the Model Context Protocol (MCP). It enables connection between MCP clients and servers that may utilize varying underlying communication protocols, such as Standard I/O (STDIO) and Server-Sent Events (SSE).
Use cases
Use cases for mcp_bridge include connecting a local mcp_server running with STDIO to an external LLM frontend over SSE, embedding mcp_server within a Flutter app and exposing it via HTTP to AutoGen/ChatGPT, and bridging CLI-based tools with web-based LLM UIs.
How to use
To use mcp_bridge, add it to your pubspec.yaml file or install it via command line. Then, import the package in your Dart application, configure the bridge with the desired transport types and server/client settings, and initialize the bridge to start communication.
Key features
Key features of mcp_bridge include: acting as a bridge between MCP-compatible clients and servers, supporting multiple transport types (STDIO and SSE), enabling full-duplex message forwarding, auto-reconnection support, configurable server shutdown behavior, and JSON-configurable bridge setup.
Where to use
mcp_bridge can be used in various fields such as application development, particularly in scenarios involving local and remote Large Language Models (LLMs), as well as in connecting CLI-based tools with web-based LLM user interfaces.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
MCP Bridge
A Dart plugin for bridging between different transport types using the Model Context Protocol (MCP). This package enables you to connect an MCP client and server even if they use different underlying communication protocols (e.g., STDIO, SSE).
Features
- Acts as a bridge between MCP-compatible clients and servers
- Supports multiple transport types:
- Standard I/O (STDIO)
- Server-Sent Events (SSE)
- Enables full-duplex message forwarding between client and server
- Auto-reconnection support for client or server failure
- Server shutdown behavior configuration
- JSON-configurable bridge setup
- Designed for local and remote LLM use cases
Use Cases
- Connect a local
mcp_serverrunning with STDIO to an external LLM frontend over SSE - Embed
mcp_serverinside a Flutter app and expose it via HTTP to AutoGen/ChatGPT - Bridge CLI-based tools and web-based LLM UIs
Installation
Add the package to your pubspec.yaml:
dependencies:
mcp_bridge: ^0.1.0
Or install via command line:
dart pub add mcp_bridge
Basic Usage
import 'package:mcp_bridge/mcp_bridge.dart';
void main() async {
final bridge = McpBridge(
McpBridgeConfig(
serverTransportType: 'stdio',
clientTransportType: 'sse',
serverConfig: {
'command': 'dart',
'arguments': ['my_server.dart'],
},
clientConfig: {
'serverUrl': 'http://localhost:8080/sse',
'headers': {'Authorization': 'Bearer test_token'},
},
serverShutdownBehavior: ServerShutdownBehavior.shutdownBridge,
),
);
bridge.setAutoReconnect(enabled: true);
await bridge.initialize();
print('Bridge is running...');
}
Transport Modes
Standard I/O (STDIO)
Useful for wrapping CLI-based MCP servers or clients:
Server-Sent Events (SSE)
Enables HTTP-based communication between bridge and MCP endpoints:
Configuration (JSON)
You can load bridge settings from a JSON file using McpBridgeConfig.fromJson(...).
{
"serverTransportType": "stdio",
"clientTransportType": "sse",
"serverShutdownBehavior": "shutdownBridge",
"serverConfig": {
"command": "dart",
"arguments": [
"my_server.dart"
]
},
"clientConfig": {
"serverUrl": "http://localhost:8080/sse",
"headers": {
"Authorization": "Bearer test_token"
}
}
}
Logging
You can configure logging behavior using your own logger, or forward logs from client/server for debugging.
final Logger _logger = Logger.getLogger('mcp_bridge');
_logger.setLevel(LogLevel.debug);
_logger.info('Bridge initialized');
Examples
See the example folder for a full example including:
- Bridge setup using STDIO server and SSE client
- Argument parsing with
argspackage - CLI tool to launch test environments
Future Plans
- [ ] WebSocket transport support
- [ ] Serial port support for embedded systems
Related Packages
mcp_server: Build and expose an MCP-compatible servermcp_client(planned): Connect to any MCP-compliant server
Issues and Feedback
Please file any issues, bugs, or feature requests in our issue tracker.
License
MIT License. See LICENSE for details.
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










