home / mcp / mcp server boilerplate mcp server
Provides an MCP server scaffold with sample tools and cross-client setup for quick start and development.
Configuration
View docs{
"mcpServers": {
"captaincrouton89-mongo-mcp": {
"command": "npx",
"args": [
"-y",
"@r-mcp/boilerplate@latest"
],
"env": {
"API_KEY": "YOUR_API_KEY",
"DATABASE_URL": "YOUR_DATABASE_URL"
}
}
}
}You can build and run an MCP server that acts as a bridge between AI assistants and your own tools, data sources, and prompts. This server pattern lets AI agents call your custom tools, fetch dynamic content, and reuse prompts across multiple MCP-compatible clients with a clean, scalable setup.
Use MCP clients such as Claude Desktop, Cursor, Claude Code, or Gemini to connect to your MCP server. You can run a production server that is invoked by the MCP clients, or run a local development server for testing. The server exposes tools, resources, and prompts that the AI can call and reuse.
Prerequisites: you need Node.js installed on your machine. You should also have a package manager available (npm or pnpm). The flow includes two main options: run directly with a published package, or clone the boilerplate to customize and develop locally.
Option 1: Use the published package directly to run a server without cloning.
# Run the server directly with npx
npx @r-mcp/boilerplateOption 2: Customize and develop locally by cloning the starter and building it yourself.
# Clone the boilerplate
git clone <your-repo-url>
cd mcp-server-boilerplate
# Install dependencies
pnpm install
# Build the project
pnpm run build
# Start the server
pnpm startThe server can be installed for different MCP clients automatically, and you can also configure a local development path for testing. The project includes scripts that build, configure clients, and publish to npm.
Environment variables can be provided in a local file and are included in the MCP server configuration during installation. Typical variables include API keys and database connections, populated from a local file named .env.local.
You can publish your customized MCP server with an automated workflow that builds, increments the version, commits changes, and pushes to npm. The process uses a single release command to simplify publishing.
For local development, modify the source, then build and run to test. Use the installation and testing commands to ensure changes load correctly in MCP clients.
Two example tools are provided to illustrate how to define and expose functionality through your MCP server: a simple greeting tool and a tool to fetch documentation. These serve as templates to help you implement your own capabilities.
Tools, resources, and prompts are defined to empower the AI to perform actions, fetch content, and generate reusable prompts. You can expand these as your project grows to cover more domains and APIs.
A simple tool that returns a greeting message when invoked, demonstrating parameter handling and a basic response structure.
A tool that demonstrates retrieving documentation content or metadata from MCP resources, illustrating resource access and dynamic content delivery.