Cover image
Try Now
2025-03-28

该存储库包含MCP主机的Python实现,该实现能够使用SSE协议运行多个MCP服务器

3 years

Works with Finder

1

Github Watches

0

Github Forks

1

Github Stars

Multiple MCP SSE Servers with a Python Host

This repository contains a Server-Sent Events (SSE) Model Control Protocol (MCP) client implementation that uses Google's Gemini API. The Host app reads the config.json file, instantiates instances of MCP Client class to launch the MCP servers and maintain connections with them, clean up on shutdown etc.

It's possible to package this host app as a dmg package and distribute which can then be used with any MCP SSE ervers. Todo: Add stdio server support Todo: Add multiple model support Todo: Add tool chaining

Setup

  1. Clone this repository:

    git clone https://github.com/hackerinheels/multipleMCPServerWithPythonHost.git
    cd multipleMCPServerWithPythonHost
    
  2. Create a .env file in the root directory with your API keys:

    GEMINI_API_KEY=your_api_key_here
    MODEL_NAME=gemini-2.0-flash
    

    You can get a Gemini API key from Google's AI Studio.

  3. Set up Google Calendar API using the instructions in the googleCalendar/README.md file

  4. Update config.json to include the browser-use server:

    {
        "mcpServers": {
            "calendar": {
                "command": "uv",
                "args": ["run", "googleCalendar/calendarServer.py", "--port", "8000"]
            },
            "browser-use": {
                "command": "uv",
                "args": ["run", "<path-to-browser-use-mcp-server>/server", "--port", "8006"]
            }
        }
    }
    

    Replace <path-to-browser-use-mcp-server> with the actual path where you cloned the repository.

  5. Create a .env file in the browser-use-mcp-server directory with the following configuration:

CHROME_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"

Running the Application

uv venv --python 3.11
source .venv/bin/activate
uv pip install -r requirements.txt
uv run host.py

This will start all the servers listed in the config.json file

Usage

Once the servers and client are running, you can interact with them by typing queries.

Google Calendar Commands

The calendar server provides the following tools:

  • list_events: List upcoming calendar events
  • get_event_details: Get detailed information about a specific event
  • search_events: Search for events matching a query

Example queries:

  • "Show my upcoming events"
  • "Search for meetings with John"
  • "Get details for event {event_id}"

Browser Use For Browser Automation

This tool enable browser automation and control with the following tools:

  • 'browser_use'
  • 'browser_get_result'

Type quit to exit the client.

Requirements

  • Python 3.11+
  • UV package manager
  • Google Gemini API key
  • Google Calendar API credentials (for calendar server)

License

MIT

MCP Multi-Server Configuration

This repository demonstrates how to load and run multiple MCP servers using a configuration file.

Servers Included

Calendar Server

  • Interact with Google Calendar
  • Manage events and schedules

Browser-use Server

  • Automate browser interactions
  • Control Chrome browser programmatically
  • Execute browser-based tasks

4. Browser-use Server Environment Setup

Create a .env file in the browser-use-mcp-server directory with the following configuration:

CHROME_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"

Note: Make sure to replace "your-openai-api-key" with your actual OpenAI API key.

Notes

  • Make sure all API keys are properly configured in .env
  • Ensure Chrome is installed for browser-use server
  • Each server runs on its designated port
  • The host manages all server lifecycles

Troubleshooting

  • If a server fails to start, check its port availability
  • Verify all environment variables are set correctly
  • Ensure Chrome path is correct for your system

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Lists Tailwind CSS classes in monospaced font

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Yasir Eryilmaz
  • AI scriptwriting assistant for short, engaging video content.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

    Reviews

    1 (1)
    Avatar
    user_NVRfII0H
    2025-04-17

    I've been using multipleMCPServerWithPythonHost by hackerinheels, and it's fantastic! This product simplifies managing multiple MCP servers with ease, leveraging Python's power. The setup is convenient, and the project is well-documented. If you work with MCP servers frequently, I highly recommend checking out this project. You can find more details on GitHub at https://github.com/hackerinheels/multipleMCPServerWithPythonHost.