MCP桥接服务

MCP桥接服务是一个强大的桥接应用程序,可实现本地模型上下文协议(MCP)服务器与远程AI代理之间的无缝通信,支持分布式AI工作流,其中业务逻辑在远程运行,同时保持对本地系统的访问。

  • by sarathak
  • 本地部署
  • 更新于
在 GitHub 查看 sarathak/mcp-bridge

使用说明

MCP Bridge

A powerful bridge application that enables seamless communication between local Model Context Protocol (MCP) servers and remote AI agents, allowing distributed AI workflows where business logic runs remotely while maintaining local system access.

⚠️ Project Status: This project is currently under development and is not ready for use. APIs, configurations, and features are subject to change.

Overview

MCP Bridge solves the challenge of connecting remote AI agents with local system resources through the Model Context Protocol. This architecture enables powerful use cases where AI agents running on remote servers need to interact with local applications, browsers, or system resources while keeping the core business logic centralized.

Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Remote Agent  │◄──►│   MCP Bridge    │◄──►│  Local MCP      │
│  (Remote Server)│    │                 │    │    Client       │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                                                        │
                                                        ▼
                                                ┌─────────────────┐
                                                │ Local Resources │
                                                │ • Browser       │
                                                │ • File System   │
                                                │ • Applications  │
                                                └─────────────────┘

Key Features

  • 🌐 Remote-Local Bridge: Connect remote AI agents with local MCP servers
  • 🔒 Secure Communication: Encrypted communication between remote and local components
  • 🎯 Flexible Deployment: Deploy business logic remotely while maintaining local access
  • ⚡ Real-time Sync: Low-latency communication for responsive interactions
  • 🔧 Easy Integration: Simple setup and configuration process

Use Cases

Web Application Automation

Remote agents can control local browsers to:

  • Perform automated testing of web applications
  • Execute complex user workflows
  • Gather data from web services
  • Interact with local development environments

Local System Integration

Enable remote agents to:

  • Access local file systems
  • Interact with desktop applications
  • Monitor system resources
  • Execute local scripts and commands

Distributed AI Workflows

  • Centralized Logic: Keep AI models and business logic on powerful remote servers
  • Local Execution: Execute tasks that require local system access
  • Hybrid Processing: Combine remote intelligence with local capabilities

Project Structure

TBD

Quick Start

Prerequisites

  • Python 3.8+
  • uv (Fast Python package manager)
  • Local MCP server setup
  • Network connectivity between local and remote environments

Installation

  1. Clone the repository

    git clone https://github.com/sarathak/mcp-bridge.git
    cd mcp-bridge
    
  2. Set up the local client

    cd local-client
    uv sync
    
  3. Configure the remote adapter

    cd ../remote-adapter
    uv sync
    

Configuration

  1. Local Client Configuration (local-client/config.json)

    {
      "local_mcp_endpoint": "http://localhost:3000",
      "remote_bridge_url": "wss://your-remote-server.com/bridge",
      "auth_token": "your-auth-token",
      "log_level": "INFO"
    }
    
  2. Remote Adapter Configuration (remote-adapter/config.json)

    {
      "bridge_port": 8080,
      "allowed_origins": ["https://your-domain.com"],
      "mcp_protocol_version": "1.0",
      "max_connections": 100
    }
    

Usage Examples

TBD

Security Considerations

  • Authentication: All connections require valid authentication tokens
  • Encryption: End-to-end encryption for all communications
  • Access Control: Configurable permissions for local resource access
  • Audit Logging: Complete logging of all bridge operations

Development

Running in Development Mode

  1. Start the local client

    cd local-client
    uv run python -m src.main
    # or with auto-reload for development
    uv run watchdog --auto-restart src/
    
  2. Start the remote adapter

    cd remote-adapter
    uv run python -m src.server
    # or with auto-reload for development
    uv run watchdog --auto-restart src/
    

Testing

# Run all tests
uv run pytest

# Run integration tests
uv run pytest tests/integration/

# Run specific test suite
uv run pytest tests/test_bridge.py

# Run with coverage
uv run pytest --cov=src tests/

Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes and add tests
  4. Commit your changes: git commit -am 'Add new feature'
  5. Push to the branch: git push origin feature-name
  6. Submit a pull request

Roadmap

  • [ ] WebSocket connection optimization
  • [ ] Multi-protocol support (HTTP, gRPC)
  • [ ] Enhanced security features
  • [ ] Docker containerization
  • [ ] Kubernetes deployment support

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Acknowledgments

  • Model Context Protocol (MCP) specification
  • WebSocket protocol standards
  • Open source community contributors

⚠️ Development Notice: This project is actively under development. Features may be incomplete, APIs are unstable, and breaking changes may occur frequently. Please check back for updates or consider contributing to help move the project forward.