Skip to main content

A Python package for master MCP servers.

Project description

mcp-master

A Python package for master MCP servers.

PyPI MIT licensed Python Version

Table of Contents

Overview

The MCP Master package allows the creation of intermediaries between clients and MCP servers. This offloads tool-related reasoning and logic to the master server without requiring client-side modifications. This Python package provides full master MCP support, making it easy to:

  • Build MCP master servers that connect clients to multiple MCP servers through the Streamable HTTP transport
  • Choose tools via reasoning structures like LangGraph
  • Easily scale the available selection of tools

Read about the Model Context Protocol here.

Installation

For projects using pip:

pip install mcp-master

Quickstart

Master MCP Servers

A simple master MCP server that connects to two of the included demo servers:

# master_server.py
from src.mcp_master import MasterMCPServer
from src.mcp_master import global_config as gconfig
from os import getenv

gconfig.selector_model_id = ''  # Set this to your tool selector model ID
gconfig.judge_model_id = ''  # Set this to your judge model ID
gconfig.judge_model_service_url = ''  # Set this to where your judge LLM is hosted
gconfig.OPENAI_API_KEY = getenv('OPENAI_API_KEY')
gconfig.OPENAI_BASE_URL = getenv('OPENAI_BASE_URL')  # Set this to where your other LLMs will be hosted, None for default

# Create an MCP server on port 3000 with two test servers
# Ensure both test servers are running by starting them in the terminal before starting demo_master_server.py
server = MasterMCPServer(
    port=3000,
    sub_servers=[
        # (server url, server identifier) pairs - ensure all server identifiers are unique
        # If the server is located locally (as the demo servers are), ensure the server identifier matches the server's file name (without the .py)
        ("http://localhost:8091/mcp", 'test_server_1'),
        ("http://localhost:8092/mcp", 'test_server_2')
    ]
)
server.startup()

You can run this server in the terminal by running:

python master_server.py

Master MCP Clients

MCP clients utilizing the streamable-HTTP protocol can connect to master MCP servers without any modification. Details provided in the URL.

For a complete working example of an MCP client, see the MCP GitHub repository.

License

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

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

mcp_master-0.0.6.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

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

mcp_master-0.0.6-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file mcp_master-0.0.6.tar.gz.

File metadata

  • Download URL: mcp_master-0.0.6.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for mcp_master-0.0.6.tar.gz
Algorithm Hash digest
SHA256 e66dd7f8dae025a666ee37462189728fcbc1941709fa277cd55bbb08c1f7889b
MD5 cd877201d413a17b66dc1ff365c93073
BLAKE2b-256 2d8d946d0ca14775b4af4cd6a7e1e1a247e901ae57790ffe158e82c8c2569577

See more details on using hashes here.

File details

Details for the file mcp_master-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: mcp_master-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for mcp_master-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 eaef7b2a4f5d07c3bd0c6e0d08a16ca17e2fccdc5dd3b86a03ae1d183edecc49
MD5 bc506cc232a64e3a3972f4c13efd93b1
BLAKE2b-256 83ffe1e384d46c6b8555e8602aa0e5cf4d3cfc735984e7d946aa4bc1645aaac0

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