chenreuven_mcp_ts_simple_template

chenreuven_mcp_ts_simple_template

by ChenReuven
A lightweight TypeScript template for building custom Model Context Protocol (MCP) servers.

TypeScript MCP Server Template

A lightweight, ready-to-use TypeScript template for building Model Context Protocol (MCP) servers. This template provides the essential scaffolding to create custom AI tools that can be seamlessly integrated with large language models.

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

  1. Clone this repository
  2. Install dependencies:
npm install

Project Structure

  • index.ts - Main server implementation with sample tool
  • package.json - Project dependencies and scripts
  • tsconfig.json - TypeScript configuration

Usage

Building and Running

Build and start the server:

npm start

This will compile the TypeScript code and start the MCP server.

Development

For development, you can:

  1. Modify index.ts to add your own tools
  2. Run the build command to compile:
npm run build

Creating Custom Tools

To create a new tool, follow this pattern in index.ts:

server.tool(
  "your-tool-name",
  {
    // Define input schema using Zod
    paramName: z.string(),
    // Add more parameters as needed
  },
  async ({ paramName }) => ({
    content: [{
      type: "text",
      text: "Your tool's response"
    }]
  })
);

Dependencies

  • @modelcontextprotocol/sdk - Core MCP SDK
  • zod - Schema validation
  • dotenv - Environment variable management
  • typescript - TypeScript compiler

License

ISC

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

A lightweight, ready-to-use TypeScript template for building Model Context Protocol (MCP) servers. This template provides the essential scaffolding to create custom AI tools that can be seamlessly integrated with large language models.

Resources

Stars

2 stars

Watchers

1 watching

Forks

0 forks

Report repository

Releases


No releases published

Packages 0


No packages published

Languages

Features & Capabilities

Categories
mcp_server model_context_protocol typescript ai_tools zod nodejs api_integration

Implementation Details

Stats

0 Views
2 GitHub Stars

Repository Info

ChenReuven Organization

Similar MCP Servers

continuedev_continue by continuedev
25049
21423
9300