MCP TypeScript シンプルテンプレート
モデルコンテキストプロトコル(MCP)サーバーを構築するためのシンプルなTypeScriptテンプレート。このプロジェクトは、AIシステムに統合できるカスタムMCPツールを作成するための基盤を提供します。
概要
このテンプレートは、サンプルのBMI計算ツールを備えた基本的なMCPサーバーを実装します。以下の操作方法を示します。
TypeScriptでMCPサーバーをセットアップする
Zodを使用した入力検証を備えたMCPツールの定義と実装
通信のためにサーバーを標準I/Oに接続する
前提条件
Node.js (v20以上を推奨)
npmまたはyarn
インストール
このリポジトリをクローンする
依存関係をインストールします:
プロジェクト構造
index.ts
- サンプルツールを使用したメインサーバーの実装package.json
- プロジェクトの依存関係とスクリプトtsconfig.json
- TypeScript 設定
使用法
構築と実行
サーバーをビルドして起動します。
これにより、TypeScript コードがコンパイルされ、MCP サーバーが起動します。
発達
開発の場合、次のことが可能です。
index.ts
を修正して独自のツールを追加するビルド コマンドを実行してコンパイルします。
カスタムツールの作成
新しいツールを作成するには、 index.ts
の次のパターンに従います。
依存関係
@modelcontextprotocol/sdk
- コア MCP SDKzod
- スキーマ検証dotenv
- 環境変数の管理typescript
- TypeScript コンパイラ
ライセンス
ISC
貢献
貢献を歓迎します!お気軽にプルリクエストを送信してください。
Tools
AI システムと統合できるカスタム モデル コンテキスト プロトコル サーバーを作成するための基盤であり、実装例としてシンプルな BMI 計算ツールを提供します。
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 -
- 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 -114Apache 2.0
- -securityFlicense-qualityA basic Model Context Protocol server implementation that demonstrates core functionality including tools and resources for AI chat applications.Last updated -
- -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 -8MIT License