MCP Server Boilerplate
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Server Boilerplateshow me how to add a new tool to the server"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Server Boilerplate
A TypeScript template for building Model Context Protocol (MCP) servers.
This boilerplate provides a solid foundation for creating MCP servers that can integrate with Cursor, Claude, and other AI assistants. It includes best practices, example tools, proper error handling, and a well-structured TypeScript codebase.
What This Template Provides
Complete MCP Server Setup: Ready-to-use server with proper configuration
Example Tools: Demonstrates common MCP tool patterns and best practices
TypeScript Integration: Full type safety with Zod validation
Error Handling: Robust error handling patterns throughout
Testing Setup: Vitest configuration for unit testing
Development Workflow: Build, watch, and inspection scripts
Related MCP server: JSON MCP Boilerplate
Key Features
Type-Safe Development: Built with TypeScript and Zod for runtime validation and compile-time safety.
Modular Architecture: Well-organized code structure with separate modules for tools, utilities, and types.
Example Patterns: Demonstrates data retrieval, search, analytics, and system utilities.
Development Ready: Includes hot reload, testing, and MCP inspector integration.
Quick Start
1. Clone and Setup
git clone https://github.com/vltansky/mcp-boilerplate.git
cd mcp-server-boilerplate
yarn install
yarn build2. Configure MCP Client
Add to your .cursor/mcp.json or other MCP client configuration:
{
"mcpServers": {
"my-custom-server": {
"command": "node",
"args": ["path/to/your/dist/server.js"]
}
}
}3. Start Developing
yarn watch # Start development with hot reload4. Test Your Tools
Use the MCP inspector to test your tools:
yarn inspectorTask Master - Getting Started
Once you have your MCP server running, here's how to get the most out of the Task Master workflow:
Next Steps for Project Success
Configure AI models (if needed) and add API keys to
.envModels: Use
task-master modelscommandsKeys: Add provider API keys to .env (or inside the MCP config file i.e. .cursor/mcp.json)
Discuss your idea with AI and ask for a PRD using example_prd.txt, and save it to scripts/PRD.txt
Ask Cursor Agent (or run CLI) to parse your PRD and generate initial tasks:
MCP Tool: parse_prd | CLI: task-master parse-prd scripts/prd.txt
Ask Cursor to analyze the complexity of the tasks in your PRD using research
MCP Tool: analyze_project_complexity | CLI: task-master analyze-complexity
Ask Cursor to expand all of your tasks using the complexity analysis
Ask Cursor to begin working on the next task
Add new tasks anytime using the add-task command or MCP tool
Ask Cursor to set the status of one or many tasks/subtasks at a time. Use the task id from the task lists.
Ask Cursor to update all tasks from a specific task id based on new learnings or pivots in your project.
Ship it!
Example Tools Included
Core Tools
get_data- Demonstrates data retrieval with filtering and paginationsearch_items- Shows search functionality with multiple search types (exact, fuzzy, regex)analyze_data- Example analytics tool with chart data generationget_system_info- System utilities for date, timezone, and version information
Tool Patterns Demonstrated
Parameter Validation: Using Zod schemas for type-safe input validation
Error Handling: Consistent error handling and user-friendly error messages
Async Operations: Proper async/await patterns with timeout simulation
Response Formatting: JSON and compact-JSON output modes
Type Safety: Full TypeScript integration with proper type inference
Project Structure
src/
├── server.ts # Main MCP server setup and tool registration
├── tools/
│ └── example-tools.ts # Example tool implementations
└── utils/
└── formatter.ts # Response formatting utilities
docs/ # Documentation files
package.json # Dependencies and scripts
tsconfig.json # TypeScript configuration
vitest.config.ts # Testing configurationCustomizing for Your Use Case
1. Replace Example Tools
Edit src/tools/example-tools.ts to implement your business logic:
export async function yourCustomOperation(input: YourInputType): Promise<YourOutputType> {
// Your implementation here
return result;
}2. Update Server Registration
Modify src/server.ts to register your tools:
server.tool(
'your_tool_name',
'Description of what your tool does',
{
// Zod schema for parameters
param1: z.string().describe('Parameter description'),
param2: z.number().optional().default(10)
},
async (input) => {
// Tool implementation
const result = await yourCustomOperation(input);
return {
content: [{
type: 'text',
text: formatResponse(result, input.outputMode)
}]
};
}
);3. Add Your Data Layer
Create modules for your specific data sources:
src/
├── database/ # Database connections and queries
├── external-apis/ # External API integrations
├── file-system/ # File system operations
└── your-domain/ # Your business logicDevelopment Workflow
Available Scripts
yarn build- Compile TypeScript to JavaScriptyarn watch- Watch mode for developmentyarn start- Run the compiled serveryarn test- Run unit testsyarn test:ui- Run tests with UIyarn inspector- Start MCP inspector for testing tools
Testing Your Tools
Unit Tests: Add tests alongside your tool files
Integration Testing: Use the MCP inspector to test tool behavior
Manual Testing: Test with actual MCP clients like Cursor
Adding Dependencies
For data sources, add appropriate dependencies:
# Database
yarn add sqlite3 @types/sqlite3
# HTTP requests
yarn add axios
# File processing
yarn add fs-extra @types/fs-extra
# Date handling
yarn add date-fnsMCP Best Practices
Tool Design
Clear Descriptions: Write detailed tool descriptions for AI assistants
Parameter Validation: Use Zod for runtime validation
Error Handling: Provide meaningful error messages
Output Consistency: Use consistent response formats
Performance
Async Operations: Use async/await for all I/O operations
Resource Management: Clean up resources properly
Caching: Implement caching for expensive operations
Pagination: Support pagination for large datasets
Security
Input Validation: Validate all inputs with Zod
Error Messages: Don't expose sensitive information in errors
Resource Limits: Implement appropriate limits and timeouts
Authentication: Add authentication if accessing sensitive data
Common Use Cases
File System Tools
File search and indexing
Content analysis
Code parsing and analysis
Database Integration
Query interfaces
Data analysis and reporting
Schema exploration
External API Integration
API wrapping and simplification
Data aggregation from multiple sources
Rate limiting and caching
Development Tools
Code generation
Testing utilities
Build and deployment helpers
Contributing
Fork this repository
Create your feature branch
Add tests for new functionality
Ensure all tests pass
Submit a pull request
License
MIT License - feel free to use this template for your own projects.
Resources
Ready to build your MCP server? Start by customizing the example tools in src/tools/example-tools.ts and updating the server registration in src/server.ts.
Available Tools
2 toolsget_dataB
Retrieve data from your custom data source with optional filtering and pagination.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of items to return (1-100) | |
| filter | No | Filter criteria for the data | |
| outputMode | No | Output format: "json" for formatted JSON (default), "compact-json" for minified JSON | json |
| includeMetadata | No | Include additional metadata in the response |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full behavioral disclosure burden. It does not mention authentication requirements, rate limits, or what 'metadata' in the schema means. The description adds no behavioral context beyond what the schema already states.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence, front-loaded with the action ('Retrieve data'), and wastes no words. However, 'custom data source' is under-specified, which slightly reduces clarity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema and no annotations, the description should elaborate on return values and behavioral context. It fails to mention the meaning of 'metadata', the nature of the data source, or potential error conditions, making it incomplete for a 4-parameter tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema describes all four parameters with clear descriptions, so baseline is 3. The description's mention of 'filtering and pagination' adds minimal extra meaning by hinting at the filter and limit parameters, but does not explain outputMode or includeMetadata beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses the specific verb 'Retrieve' with the object 'data from your custom data source', clearly indicating the tool's function. It implicitly distinguishes from the sibling 'get_system_info' by focusing on custom data, but 'custom data source' is vague and lacks detail.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'with optional filtering and pagination' implies when to use the tool (when you need data with these capabilities), but there is no explicit guidance on alternatives or when not to use it. No comparison with the sibling tool 'get_system_info' is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_system_infoA
Get system information and utilities. Provides current date, timezone, and other helpful context.
| Name | Required | Description | Default |
|---|---|---|---|
| info | No | Type of system information to retrieve | all |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description must carry the burden of behavioral disclosure. It states the tool provides information, implying a read-only action, but does not mention output format, version specifics, or any potential side effects. This is adequate but not rich.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise, using two short sentences to convey the core purpose. It is front-loaded with the key verb and resource, with no superfluous information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple tool with one optional parameter and no output schema, the description is largely complete. It covers the main use cases (date, timezone) and implies additional context, though it does not explicitly mention the 'info' parameter or the 'version' option. The rich schema compensates for this.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% coverage with a clear description for the 'info' parameter and an enum defining valid values. The description adds no additional parameter semantics beyond what the schema already provides, so the baseline of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: getting system information such as date and timezone. It uses a specific verb and resource, and is distinct from the sibling tool 'get_data'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for retrieving system context, but it does not explicitly differentiate from get_data or explain when to use this tool over alternatives. No exclusion criteria are provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v0.1.0- First observed
get_data - First observed
get_system_info
TDQS
Scored across 2 tools
The two tools serve entirely different purposes: one retrieves data, the other provides system information. There is no overlap or ambiguity, so an agent can easily distinguish them.
Both tool names follow the same 'get_' prefix followed by a noun, resulting in a consistent naming convention.
With only two tools, the set feels minimal and thin. While it is a boilerplate, the number is at the lower edge of the typical range, making it borderline.
The tool surface is very limited: it offers only retrieval operations for data and a single system info utility. There are no create/update/delete operations for data, and the tools do not form a coherent workflow, leaving significant gaps for real use.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Kickstart development with a customizable TypeScript template featuring sample tools for greeting,…
A Model Context Protocol server for Wix AI tools
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Related MCP Servers
- FlicenseCqualityDmaintenanceA TypeScript template for creating Model Context Protocol servers that enable AI models to utilize external tools, including example operations and simple number addition functionality.22-
- FlicenseAqualityDmaintenanceA starter template for building MCP (Model Context Protocol) servers with TypeScript support. Provides a clean foundation with example tools, resources, and prompts for creating custom integrations with Claude, Cursor, or other MCP-compatible AI assistants.26-
- FlicenseCqualityDmaintenanceA starter template for building MCP (Model Context Protocol) servers that integrate with Claude, Cursor, or other MCP-compatible AI assistants. Provides a clean foundation with TypeScript support, example tool implementation, and installation scripts for quick customization.26-
- AlicenseNot gradedqualityDmaintenanceA TypeScript template for building Model Context Protocol (MCP) servers that enables developers to quickly create custom tools and integrate them with AI platforms like Claude, Cursor, Windsurf, and Cline.734MIT