Provides the runtime environment for the MCP server, enabling server-side execution of the tools and communication via standard I/O.
Supports package management for the MCP server, allowing easy installation of dependencies and execution of build scripts.
Serves as the foundation for building custom MCP tools, providing type safety and structure for implementing tools that can be integrated with AI systems.
Alternative package manager for the MCP server, offering another option for dependency management and script execution.
Used for schema validation to define and validate tool inputs, ensuring properly formatted data is provided to the MCP tools.
MCP TypeScript Simple Template
A simple TypeScript template for building Model Context Protocol (MCP) servers. This project provides a foundation for creating custom MCP tools that can be integrated with AI systems.
Overview
This template implements a basic MCP server with a sample BMI calculator tool. It demonstrates how to:
- Set up an MCP server in TypeScript
- Define and implement MCP tools with input validation using Zod
- Connect the server to standard I/O for communication
Prerequisites
- Node.js (v20 or higher recommended)
- npm or yarn
Installation
- Clone this repository
- Install dependencies:
Project Structure
index.ts
- Main server implementation with sample toolpackage.json
- Project dependencies and scriptstsconfig.json
- TypeScript configuration
Usage
Building and Running
Build and start the server:
This will compile the TypeScript code and start the MCP server.
Development
For development, you can:
- Modify
index.ts
to add your own tools - Run the build command to compile:
Creating Custom Tools
To create a new tool, follow this pattern in index.ts
:
Dependencies
@modelcontextprotocol/sdk
- Core MCP SDKzod
- Schema validationdotenv
- Environment variable managementtypescript
- TypeScript compiler
License
ISC
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Tools
A foundation for creating custom Model Context Protocol servers that can integrate with AI systems, providing a simple BMI calculator tool as an example implementation.
Related MCP Servers
- -securityFlicense-qualityA demonstration implementation of the Model Context Protocol server that facilitates communication between AI models and external tools while maintaining context awareness.Last updated -Python
- AsecurityAlicenseAqualityA customizable Model Context Protocol server implementation that enables AI models to interact with external tools including weather queries, Google search, and camera control functionality.Last updated -113PythonApache 2.0
- -securityFlicense-qualityA basic Model Context Protocol server implementation that demonstrates core functionality including tools and resources for AI chat applications.Last updated -Python
- -securityAlicense-qualityA guide for implementing Model Context Protocol (MCP) servers that provide AI models with external tools like web search, text manipulation, and mathematical operations.Last updated -8PythonMIT License