Skip to main content

A lightweight factory framework for creating and managing MCP (Model Context Protocol) servers with simplified configuration and project building capabilities.

Project description

MCP Factory

MCP Factory Python License

A factory framework focused on MCP server creation and management

๐ŸŽฏ Overview

MCP Factory is a lightweight MCP (Model Context Protocol) server creation factory. It focuses on simplifying the building, configuration and management process of MCP servers, enabling developers to quickly create and deploy MCP servers.

๐ŸŒŸ Core Features

  • ๐Ÿญ Server Factory - Quickly create and configure MCP server instances
  • ๐Ÿ“ Project Building - Automatically generate complete MCP project structure
  • ๐Ÿ”ง Configuration Management - Flexible YAML configuration system
  • ๐Ÿ”— Server Mounting - Support multi-server mounting and management
  • ๐Ÿ› ๏ธ CLI Tools - Simple and easy-to-use command line interface

๐Ÿš€ Quick Start

Installation

pip install mcp-factory

Or using uv:

uv add mcp-factory

Basic Usage

1. Create project using factory

from mcp_factory import MCPFactory

# Create factory instance
factory = MCPFactory(workspace_root="./workspace")

# Build new MCP project
project_path = factory.build_project(
    "my-server", 
    {"server": {"description": "My first MCP server"}}
)

# Create server instance
server_id = factory.create_server(
    name="my-server",
    source=project_path
)

2. Directly create managed server

from mcp_factory import ManagedServer

# Create managed server
server = ManagedServer(
    name="example-server",
    instructions="This is an example server"
)

# Add tools
@server.tool()
def hello(name: str) -> str:
    """Greet the specified user"""
    return f"Hello, {name}!"

# Run server
server.run()

3. Using CLI tools

# Create new project
mcp-factory project create my-project

# Run server from configuration file
mcp-factory server run config.yaml

# Run with custom transport
mcp-factory server run config.yaml --transport http --host 0.0.0.0 --port 8080

๐Ÿ“ Project Structure

mcp-factory/
โ”œโ”€โ”€ mcp_factory/           # Core modules
โ”‚   โ”œโ”€โ”€ factory.py         # Factory main class
โ”‚   โ”œโ”€โ”€ server.py          # Managed server
โ”‚   โ”œโ”€โ”€ config/            # Configuration management
โ”‚   โ”œโ”€โ”€ project/           # Project building
โ”‚   โ”œโ”€โ”€ mounting/          # Server mounting
โ”‚   โ””โ”€โ”€ cli.py             # Command line tools
โ”œโ”€โ”€ examples/              # Usage examples
โ”œโ”€โ”€ tests/                 # Test suite
โ””โ”€โ”€ docs/                  # Documentation

๐Ÿ› ๏ธ Core Components

MCPFactory

Factory main class, responsible for creating and managing MCP servers:

factory = MCPFactory(workspace_root="./workspace")

# Build project
project_path = factory.build_project("server-name", config_dict)

# Create server
server_id = factory.create_server("server-name", source)

# Manage servers
servers = factory.list_servers()

ManagedServer

Managed server class, providing complete MCP server functionality:

server = ManagedServer(name="my-server")

# Add tools
@server.tool()
def my_tool(param: str) -> str:
    return f"Processing: {param}"

# Run server
server.run()

๐Ÿ“š Examples

Check the examples/ directory for more usage examples:

๐Ÿงช Testing

# Run all tests
pytest

# Generate coverage report
pytest --cov=mcp_factory

# Type checking
mypy mcp_factory

# Code formatting
ruff format .
ruff check .

๐Ÿ“– Documentation

๐Ÿค Contributing

Contributions are welcome! Please check our contribution guidelines.

๐Ÿ“„ License

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


Note: This is the stable version of MCP Factory (v1.0.0), focusing on core factory functionality with full type safety and modern Python practices.

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_factory-1.0.0.tar.gz (62.5 kB view details)

Uploaded Source

Built Distribution

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

mcp_factory-1.0.0-py3-none-any.whl (69.2 kB view details)

Uploaded Python 3

File details

Details for the file mcp_factory-1.0.0.tar.gz.

File metadata

  • Download URL: mcp_factory-1.0.0.tar.gz
  • Upload date:
  • Size: 62.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mcp_factory-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c2a4e70263b88bbde708cddb6246c96899fda31c8fbb542877a26801d9a44e8b
MD5 e8c146c2344731ad6998f67d3c37a4f5
BLAKE2b-256 58967fc7944116963de4118c1f806589f7fdc7dfdebc1026ac677c4eaddf402d

See more details on using hashes here.

File details

Details for the file mcp_factory-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_factory-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 69.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mcp_factory-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a18ad3f13f1e484b6cfdd2c986e429d826fe7d6cf5d8c31e69f81ac4f26f7f6
MD5 cae00d010fdbdc7f59a6c0d2d8a4bc6d
BLAKE2b-256 741fc96a10c363ff081469b290d1f99d823335e2e0dbfcd3ba6c3c6bef03c663

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