Integrations
Enables configuration of the MCP server through environment variables, supporting settings for port configuration, environment mode, and OAuth settings.
Provides the HTTP transport layer for the MCP server, allowing it to serve MCP resources, tools, and prompts over a RESTful API interface.
Serves as the runtime environment for the MCP server, enabling both HTTP and stdio transport options.
MCP Server Boilerplate
A boilerplate server implementation for the Model Context Protocol (MCP), built with TypeScript and Express.
Table of Contents
- Overview
- Project Structure
- Getting Started
- Running the Server
- Resources
- Tools
- Prompts
- Extending the Server
- Testing and Debugging
- License
Overview
This project implements a server that follows the Model Context Protocol (MCP), which allows applications to provide context for LLMs in a standardized way. It includes:
- A fully configured MCP server with HTTP and stdio transport options
- Sample resources, tools, and prompts to demonstrate key functionality
- TypeScript support for type safety and better developer experience
- Express integration for the HTTP transport layer
Project Structure
Getting Started
Prerequisites
- Node.js (v18 or later)
- npm or yarn
Installation
Clone the repository and install dependencies:
Environment Variables
Copy the example environment file and modify as needed:
Available environment variables:
PORT
: The port for the HTTP server (default: 3000)NODE_ENV
: Environment mode (development, production)- OAuth settings (if needed)
Running the Server
HTTP Server
Build and start the HTTP server:
For development with auto-restart:
The server will be available at http://localhost:3000/mcp
(or the port specified in your .env file).
Stdio Mode
To run the server in stdio mode (for command-line tools):
For development with auto-restart:
Resources
The boilerplate includes these example resources:
- Static Info Resource:
info://server
- Provides basic information about the server
- Dynamic Greeting Resource:
greeting://{name}
- Generates a personalized greeting with the provided name parameter
To access resources:
- Through the MCP protocol
- Using an MCP client library
Tools
The boilerplate includes these example tools:
- Calculator: Performs basic arithmetic operations
- Parameters:
operation
: Operation to perform (add, subtract, multiply, divide)a
: First numberb
: Second number
- Parameters:
- Timestamp: Provides the current time in various formats
- Parameters:
format
: Output format (iso, unix, readable)
- Parameters:
Prompts
The boilerplate includes these example prompts:
- Greeting: Creates a personalized greeting prompt
- Parameters:
name
: Name to greetformal
: Whether to use formal greeting style (optional)
- Parameters:
- Analyze Data: Creates a prompt for data analysis
- Parameters:
data
: The data to analyzeformat
: Data format (json, csv, text)instructions
: Additional analysis instructions (optional)
- Parameters:
Extending the Server
Adding Resources
To add a new resource:
- Create a new file in
src/resources/
(e.g.,myResource.ts
) - Implement your resource handler
- Register it in
src/resources/index.ts
Example:
Adding Tools
To add a new tool:
- Create a new file in
src/tools/
(e.g.,myTool.ts
) - Implement your tool handler
- Register it in
src/tools/index.ts
Example:
Adding Prompts
To add a new prompt:
- Create a new file in
src/prompts/
(e.g.,myPrompt.ts
) - Implement your prompt handler
- Register it in
src/prompts/index.ts
Example:
Testing and Debugging
To test your MCP server, you can use:
- The MCP Inspector tool
- MCP client libraries
- Direct HTTP requests (for debugging)
License
This project is licensed under the MIT License - see the LICENSE file for details.
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A ready-to-use starter implementation of the Model Context Protocol (MCP) server that enables applications to provide standardized context for LLMs with sample resources, tools, and prompts.
Related MCP Servers
- AsecurityAlicenseAqualityA beginner-friendly Model Context Protocol (MCP) server that helps users understand MCP concepts, provides interactive examples, and lists available MCP servers. This server is designed to be a helpful companion for developers working with MCP. Also comes with a huge list of servers you can install.Last updated -3936JavaScriptApache 2.0
- AsecurityAlicenseAqualityAn educational implementation of a Model Context Protocol server that demonstrates how to build a functional MCP server for integrating with various LLM clients like Claude Desktop.Last updated -188PythonMIT License
- -security-license-qualityA specialized server that helps users create new Model Context Protocol (MCP) servers by providing tools and templates for scaffolding projects with various capabilities.Last updated -1TypeScript
- -securityAlicense-qualityA Model Context Protocol (MCP) server implementation that enables LLMs to interact with the Osmosis protocol, allowing for querying and transaction functionality through natural language.Last updated -9TypeScriptMIT License