多路单载波
主控程序 (模型上下文协议)服务器模板生成器
引言
mcpc 是一个命令行工具,为MCP(模型上下文协议)服务器项目生成脚手架。它可以帮助您快速设置一个具有所有必要文件和配置的结构正确的项目。
特性
- 为TypeScript或Python生成MCP服务器模板
- 支持多个包管理器(pnpm、yarn、npm用于TypeScript;uv用于Python)
- 自动依赖项安装
- 系统依赖性验证
- Git存储库初始化
- 遵循MCP官方文件的完整项目结构
- Python测试模式,用于在没有Claude的情况下验证服务器功能
- 包括配置文件和最佳实践
安装
先决条件
- Rust和Cargo(可通过以下方式安装 安宁)
构建和安装
使用Make:
# Build and install in one step
make install或直接使用Cargo:
# Install from local repository
cargo install --path .用法
基本用法:
mcpc project_name [options]选项:
-l, --language:要使用的编程语言(py/python,ts/typescript,默认:typescript)-t, --tool:要使用的包管理器工具:
- 对于TypeScript:pnpm(默认)、yarn、npm - 对于Python:uv(默认)
示例:
# Create a TypeScript project named 'weather-api' using pnpm
mcpc weather-api -l ts -t pnpm
# Create a Python project named 'mcp-server' using uv
mcpc mcp-server -l py -t uv生成的项目结构
TypeScript项目
project_name/
├── .gitignore
├── .prettierignore
├── .prettierrc
├── package.json
├── README.md
├── tsconfig.json
├── build/
└── src/
└── index.tsPython项目
project_name/
├── .gitignore
├── pyproject.toml
├── README.md
├── requirements.txt
├── server.py
└── .venv/使用生成的项目
python
# Activate virtual environment
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies (if not already installed)
uv pip install -r requirements.txt
# Test server functionality without Claude
python server.py --test
# Run server for Claude integration
python server.pyTypeScript
# Install dependencies (if not already installed)
pnpm install # or: yarn / npm install
# Build the project
pnpm run build # or: yarn build / npm run build
# Run server
node build/index.jsClaude桌面集成
要与Claude for Desktop集成,请在Claude的配置文件中配置您的服务器:
{
"mcpServers": {
"weather": {
"command": "uv", // or "node" for TypeScript
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/PROJECT",
"run",
"server.py" // or "build/index.js" for TypeScript
]
}
}
}发展
可用的生成命令
make # Build the project (same as 'make build')
make build # Build the project in debug mode
make release # Build the project in release mode
make install # Build in release mode and install
make run # Run the project in debug mode
make run-release # Run the project in release mode
make test # Run tests
make docs # Generate and open documentation
make clean # Clean build artifacts
make fmt # Format code with rustfmt
make check # Check for compilation errors
make clippy # Run Clippy lints从源代码构建
git clone https://github.com/yourusername/mcpc.git
cd mcpc
make install许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。


