Skip to main content

A Python package for master MCP servers.

Project description

mcp-master

A Python package for master MCP servers.

Python implementation of the Model Context Protocol (MCP)

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 mcp_master import MasterMCPServer
import asyncio
from os import getenv

set_config({
    'judge_model_id': "us.anthropic.claude-3-5-haiku-20241022-v1:0",
    'judge_model_service_url': '', # Set this to where your judge LLM is hosted
    'OPENAI_API_KEY': getenv('OPENAI_API_KEY'), 
    'OPENAI_BASE_URL': getenv('OPENAI_BASE_URL'), # Set this to where your other LLMs will be hosted
})

# 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 master_server.py
server = MasterMCPServer(3000, [
    ("http://localhost:8091/mcp", 'test_server_1'),
    ("http://localhost:8092/mcp", 'test_server_2')
])
asyncio.run(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, 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.2.tar.gz (13.9 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.2-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcp_master-0.0.2.tar.gz
  • Upload date:
  • Size: 13.9 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.2.tar.gz
Algorithm Hash digest
SHA256 a154bf7154c16f5c204e6084f3cdd54d0880f6dc8ede6b45d8a286edae9ed5ad
MD5 45fea0c8625810035f6d255be2fc3a2b
BLAKE2b-256 0ef39da1846c4f935de8f55db305da90b6e32d74d3addb41f80cff115e34ed51

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_master-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 18.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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 971e5764a0802be51a08d4cdbeb62ff82ea1c99c6d7aea33b03431a41f0dba4c
MD5 1ccb5742fcb3a7022b7505ae80633bd5
BLAKE2b-256 b074f03a7dc4222fae89915452f6a084f4a4f31c0fc21a04b5a1a1d141f61e34

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