
captaincrouton89/mcp-boilerplate 是从 https://github.com/captaincrouton89/mcp-boilerplate. 导入的 MCP 服务器候选人。
概览
captaincrouton89/mcp-boilerplate 是从 https://github.com/captaincrouton89/mcp-boilerplate. 导入的 MCP 服务器候选人。
概述(AI 翻译)
构建MCP(模型上下文协议)服务器的入门模板。该样板为创建可与Claude Desktop、Cursor、Claude Code、Gemini及其他兼容MCP的AI助手集成的MCP服务器提供了清晰的基础。
目的
这个模板帮助你快速开始构建:
- AI助手定制工具
- 动态内容资源提供者
- 用于常见操作的提示模板
- 外部API和服务的集成点
特色
- 两个示例工具:“hello-world” 和 “get-mcp-docs”
- 支持与ES2022目标和ES模块的TypeScript
- 多客户端安装脚本(Claude Desktop、Cursor、Claude Code、Gemini 等)
- 自动 npm 发布工作流程
- 通过[[T0]支持环境变量]
- 带有 Zod 验证的简洁项目结构
工作原理
该MCP服务器模板提供:
- 使用 MCP SDK 的基本服务器配置
- 示例工具实现
- 构建与安装脚本
- 用于开发的TypeScript配置
附带的示例演示了如何创建一个简单工具,该工具能接收名称参数并返回问候语。
开始
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
MCP Server Boilerplate
A starter template for building MCP (Model Context Protocol) servers. This boilerplate provides a clean foundation for creating your own MCP server that can integrate with Claude Desktop, Cursor, Claude Code, Gemini, and other MCP-compatible AI assistants.
Purpose
This boilerplate helps you quickly start building:
- Custom tools for AI assistants
- Resource providers for dynamic content
- Prompt templates for common operations
- Integration points for external APIs and services
Features
- Two example tools: “hello-world” and “get-mcp-docs”
- TypeScript support with ES2022 target and ES modules
- Multi-client installation scripts (Claude Desktop, Cursor, Claude Code, Gemini, etc.)
- Automatic npm publishing workflow
- Environment variable support via
.env.local - Clean project structure with Zod validation
How It Works
This MCP server template provides:
- A basic server setup using the MCP SDK
- Example tool implementation
- Build and installation scripts
- TypeScript configuration for development
The included example demonstrates how to create a simple tool that takes a name parameter and returns a greeting.
Getting Started
Option 1: Use the Published Package (Recommended)
You can use this MCP server directly without cloning:
# Run the server directly with npx
npx @r-mcp/boilerplate
Option 2: Customize and Develop
# Clone the boilerplate
git clone
cd mcp-server-boilerplate
# Install dependencies
pnpm install
# Build the project
pnpm run build
# Start the server
pnpm start
Installation Scripts
This boilerplate includes convenient installation scripts for different MCP clients:
# Install to all MCP clients (Claude Desktop, Cursor, Claude Code, Gemini, MCP)
pnpm run install-server
# Install to specific clients
pnpm run install-desktop # Claude Desktop
pnpm run install-cursor # Cursor IDE
pnpm run install-code # Claude Code CLI
pnpm run install-code-library # Claude Code Library (~/.claude/mcp-library/)
pnpm run install-mcp # Local .mcp.json for development
# You can also combine multiple targets:
node scripts/update-config.js cursor code desktop
These scripts will:
- Build the project automatically (TypeScript compilation + chmod permissions)
- Configure clients to use
npx @r-mcp/@latest(auto-updating) - Only the local
.mcp.jsonuses the development version (node dist/index.js) - Include environment variables from
.env.localif present
Publishing Your Server
To publish your customized MCP server:
# Build, commit, and publish to npm in one command
pnpm run release
This script (scripts/build-and-publish.js) will:
- Commit any pending changes first
- Update package name to
@r-mcp/ - Update bin name to match directory
- Increment patch version automatically
- Build the TypeScript project
- Commit version bump to git
安装
npx -y @r-mcp/boilerplate@latest配置
{
"mcpServers": {
"boilerplate": {
"command": "npx",
"args": ["-y", "@r-mcp/boilerplate@latest"],
"env": {
// Environment variables from .env.local are included here
}
}
}
}