Content
# MCP-BOS: Scalable MCP Server Framework
# MCP-BOS: Modular and Scalable Model Context Protocol Server Framework
A flexible MCP server framework designed for Claude Desktop, utilizing a convention-based automatic module discovery mechanism. Easily extend AI application functionalities through a simple module interface and declarative configuration, without modifying core code. Supports the FastMCP standard and includes complete tools, resources, and prompt template registration capabilities.
## Features
- 🧩 Modular Design: Functions are organized into self-contained modules for easy expansion
- 🔍 Automatic Discovery: A convention-over-configuration approach to module loading
- ⚙️ Declarative Configuration: Flexibly configure modules and parameters through config.json
- 🔌 Plug-and-Play: New functionalities can be added simply by including a module directory that conforms to the interface
- 🔒 Secure and Stable: A layered architecture ensures the core system is stable and reliable
- 📝 Detailed Logging: A comprehensive logging system facilitates debugging and monitoring
- 🖥️ Claude Desktop Integration: Deep integration with Claude, providing an AI-enhanced experience
## Tech Stack
`Python` `FastMCP` `Model Context Protocol` `Claude Desktop` `JSON` `Modular Design` `Microkernel Architecture`
## Architectural Philosophy

The MCP-BOS framework adopts a modern modular architecture design, with key design principles including:
### Modular Design
The entire framework is module-centric, with each functionality encapsulated in independent modules, making functional expansion simple and intuitive. Modules operate independently but collaborate through standard interfaces, forming a complete service ecosystem.
### Automatic Discovery Mechanism
The framework can automatically discover modules in the `modules` directory without the need to manually register each module. This "convention over configuration" approach significantly reduces expansion costs.
### Declarative Configuration
Global and module-level configurations are managed through the `config.json` file, providing high flexibility to enable or disable specific modules based on different needs.
### Layered Architecture
The framework is divided into a core layer and a module layer, where the core layer is responsible for basic functionalities and the module layer handles specific business functions. This layered design enhances the robustness and maintainability of the framework.
## Directory Structure
```
mcp-bos/
├── config.json # Global configuration file
├── main.py # Main entry file
├── core/ # Core system
│ ├── __init__.py
│ ├── module_registry.py # Module registry
│ ├── module_loader.py # Module loader
│ ├── module_interface.py # Module interface definitions
│ ├── config_manager.py # Configuration manager
│ └── server.py # FastMCP server adapter
├── modules/ # Functional module directory
│ ├── __init__.py
│ ├── hello_world/ # Hello World example module
│ │ ├── __init__.py
│ │ └── hello.py
│ └── ... # Other functional modules
├── utils/ # Utility functions
│ ├── __init__.py
│ └── helpers.py
└── README.md # Project documentation
```
### Core Component Descriptions
- **main.py**: The entry point of the framework, responsible for initializing and starting the server
- **core/**: Core component directory
- **module_interface.py**: Defines the interfaces that all modules must implement
- **module_registry.py**: Manages registered modules
- **module_loader.py**: Automatically discovers and loads modules
- **config_manager.py**: Loads and manages configurations
- **server.py**: Integrates with FastMCP to provide server functionalities
- **modules/**: Functional module directory, each subdirectory is an independent module
- **utils/**: Common utility functions
## Configuration File Structure
The `config.json` file is the core configuration of the framework, divided into global configuration and module configuration:
```json
{
"global": {
"server_name": "MCP-BOS",
"debug": true,
"log_level": "INFO",
"transport": "stdio",
"dependencies": ["mcp[cli]"]
},
"modules": {
"hello_world": {
"enabled": true,
"message": "Hello, {}!"
},
"module_name": {
"enabled": false,
"param1": "value1"
}
}
}
```
- **global**: Global configuration section
- **server_name**: Server name
- **debug**: Whether to enable debug mode
- **log_level**: Log level
- **transport**: Transport protocol, usually "stdio"
- **dependencies**: List of dependency packages
- **modules**: Module configuration section, each module has its own configuration section
- **enabled**: Whether to enable this module
- Other module-specific configuration parameters
## Usage
### Installation
1. Clone the repository:
```bash
git clone https://github.com/kinbos/mcp-bos.git
cd mcp-bos
```
2. Install dependencies:
```bash
uv pip install mcp[cli]
```
### Configuration
Edit the `config.json` file to configure the server and modules:
1. Set global parameters such as server name and log level
2. Enable or disable modules
3. Configure module-specific parameters
### Running
There are several ways to run the server:
1. **Run directly**:
```bash
python main.py
```
2. **Run with uv**:
```bash
uv run main.py
```
3. **Integrate with Claude Desktop**:
```bash
# Use mcp CLI to integrate into Claude Desktop
mcp install main.py
```
4. **Development debug mode**:
```bash
# Use mcp Inspector to test the server
mcp inspect main.py
```
### Adding a New Module
1. Create a new module directory under `modules`:
```bash
mkdir modules/my_module
```
2. Create necessary files:
```bash
touch modules/my_module/__init__.py
touch modules/my_module/my_module.py
```
3. Implement the module interface:
```python
# modules/my_module/my_module.py
from core.module_interface import ModuleInterface
class MyModule(ModuleInterface):
def get_info(self):
return {
"name": "my_module",
"version": "1.0.0",
"description": "My custom module",
"author": "kinbos 严富坤",
"email": "fookinbos@gmail.com",
"website": "htttps://www.yanfukun.com"
}
def register(self, server):
@server.tool()
def my_tool(param: str) -> str:
"""Custom tool"""
return f"Processing parameter: {param}"
@server.resource("my://resource")
def my_resource() -> str:
"""Custom resource"""
return "Resource content"
```
4. Export the module class:
```python
# modules/my_module/__init__.py
from modules.my_module.my_module import MyModule
__all__ = ['MyModule']
```
5. Enable the module in the configuration file:
```json
{
"modules": {
"my_module": {
"enabled": true,
"custom_param": "value"
}
}
}
```
6. Restart the server, and the new module will be automatically discovered and loaded.
## Frequently Asked Questions
### Module Not Loaded
- Check if the module directory structure is correct
- Ensure that the `__init__.py` file exports the module class
- Verify if the module is enabled in the configuration file
- Check the log output for detailed error information
### Encoding Issues
If you encounter Chinese encoding issues in a Windows environment, ensure that the correct environment variable is set:
```json
"env": {
"PYTHONIOENCODING": "utf-8"
}
```
### Server Connection Issues
- Confirm that Claude Desktop is configured correctly
- Check if dependencies are installed correctly
- Review the Claude Desktop log files
## Contribution Guidelines
Contributions are welcome, please follow these steps:
1. Fork the project
2. Create a feature branch
3. Submit your changes
4. Create a Pull Request
## Author
- **kinbos 严富坤** - [Personal Website](https://www.yanfukun.com)
- Email: fookinbos@gmail.com
Connection Info
You Might Also Like
rea
Reverse engineering for coding agents: one CLI and MCP server to inspect any...
everything-claude-code
Complete Claude Code configuration collection - agents, skills, hooks,...
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
cc-switch
All-in-One Assistant for Claude Code, Codex & Gemini CLI across platforms.
Agent-Reach
Give your AI agent eyes to see the entire internet. Read & search Twitter,...
servers
Model Context Protocol Servers