A lightweight factory framework for creating and managing MCP (Model Context Protocol) servers with simplified configuration and project building capabilities.
Project description
MCP Factory
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:
- Basic Server - Create simple MCP server
- Factory Complete Example - Complete workflow using factory
- Server Mounting - Multi-server mounting
๐งช 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2a4e70263b88bbde708cddb6246c96899fda31c8fbb542877a26801d9a44e8b
|
|
| MD5 |
e8c146c2344731ad6998f67d3c37a4f5
|
|
| BLAKE2b-256 |
58967fc7944116963de4118c1f806589f7fdc7dfdebc1026ac677c4eaddf402d
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a18ad3f13f1e484b6cfdd2c986e429d826fe7d6cf5d8c31e69f81ac4f26f7f6
|
|
| MD5 |
cae00d010fdbdc7f59a6c0d2d8a4bc6d
|
|
| BLAKE2b-256 |
741fc96a10c363ff081469b290d1f99d823335e2e0dbfcd3ba6c3c6bef03c663
|