Skip to main content
Glama
ChenReuven

MCP TypeScript Simple Template

by ChenReuven

MCP TypeScript シンプルテンプレート

モデルコンテキストプロトコル(MCP)サーバーを構築するためのシンプルなTypeScriptテンプレート。このプロジェクトは、AIシステムに統合できるカスタムMCPツールを作成するための基盤を提供します。

概要

このテンプレートは、サンプルのBMI計算ツールを備えた基本的なMCPサーバーを実装します。以下の操作方法を示します。

  • TypeScriptでMCPサーバーをセットアップする

  • Zodを使用した入力検証を備えたMCPツールの定義と実装

  • 通信のためにサーバーを標準I/Oに接続する

Related MCP server: MCP Server Python Template

前提条件

  • Node.js (v20以上を推奨)

  • npmまたはyarn

インストール

  1. このリポジトリをクローンする

  2. 依存関係をインストールします:

npm install

プロジェクト構造

  • index.ts - サンプルツールを使用したメインサーバーの実装

  • package.json - プロジェクトの依存関係とスクリプト

  • tsconfig.json - TypeScript 設定

使用法

構築と実行

サーバーをビルドして起動します。

npm start

これにより、TypeScript コードがコンパイルされ、MCP サーバーが起動します。

発達

開発の場合、次のことが可能です。

  1. index.tsを修正して独自のツールを追加する

  2. ビルド コマンドを実行してコンパイルします。

npm run build

カスタムツールの作成

新しいツールを作成するには、 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"
    }]
  })
);

依存関係

  • @modelcontextprotocol/sdk - コア MCP SDK

  • zod - スキーマ検証

  • dotenv - 環境変数の管理

  • typescript - TypeScript コンパイラ

ライセンス

ISC

貢献

貢献を歓迎します!お気軽にプルリクエストを送信してください。

Available Tools

2 tools
calculate-bmiD
ParametersJSON Schema
NameRequiredDescriptionDefault
heightMYes
weightKgYes

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

echoD
ParametersJSON Schema
NameRequiredDescriptionDefault
textYes

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

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.

  1. 2 tool updatesv1.0.0
    • First observedcalculate-bmi
    • First observedecho

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 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.
    -