Skip to main content
Glama
MCP TypeScript Simple Template

MCP TypeScript Simple Template

by ChenReuven

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

Related MCP server: MCP Server Python Template

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.

Available Tools

2 tools
calculate-bmiD

Inputs: heightM (required), weightKg (required).

echoD

Inputs: text (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    D1.5/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools have clearly distinct purposes: calculate_bmi is for health-related calculations, while echo is for text repetition. There is no overlap or ambiguity between them, making it easy for an agent to choose the right tool.

    Naming Consistency2/5

    The naming is inconsistent: calculate_bmi uses kebab-case, while echo uses lowercase without a clear pattern. There is no consistent verb_noun convention, and the styles are mixed, though the names are still readable.

    Tool Count2/5

    With only 2 tools, the server feels too thin for a general-purpose template. It lacks depth and variety, suggesting an incomplete or minimal implementation that doesn't fully cover a meaningful domain.

    Completeness1/5

    The server is severely incomplete; it only offers two unrelated tools with no descriptions, making it impossible to assess domain coverage. There are obvious gaps, and it doesn't support any coherent workflow or lifecycle.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      A streamlined foundation for building Model Context Protocol servers in Python, designed to make AI-assisted development of MCP tools easier and more efficient.
      12
      MIT
    • A
      license
      D
      quality
      D
      maintenance
      A foundation for building custom local Model Context Protocol (MCP) servers that provide tools accessible to AI assistants like Cursor or Claude Desktop.
      1
      37
      MIT
    • -
      license
      Not graded
      quality
      D
      maintenance
      A standardized foundation for building Model Context Protocol servers that integrate with VS Code, using Python with stdio transport for seamless AI tool integration.
      -