mcp_server_ts_sample

akiraNuma/mcp_server_ts_sample

3.2

If you are the rightful owner of mcp_server_ts_sample and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This is a sample project for an MCP server using Express.js and TypeScript.

MCP Server TypeScript Sample

Express.js + MCPサーバーのサンプルプロジェクトです。

ディレクトリ構成

project-root/
├── .env                       # 環境変数
├── .env.example               # 環境変数のテンプレート
└── src/
    ├── index.ts               # エントリーポイント(サーバ起動)
    ├── server.ts              # サーバ起動スクリプト
    ├── config/                # 設定関連
    ├── mcp/
    │   ├── tools/             # Toolの定義
    │   ├── resources/         # Resourceの定義
    │   └── prompts/           # Promptの定義
    ├── middleware/            # Expressのミドルウェア
    └── routes/                # ルーティング

セットアップ

  1. 依存関係のインストール:
npm install
  1. 環境変数の設定:
cp .env.example .env
# .envファイルを編集して適切な値を設定してください
  1. ビルド:
npm run build
  1. サーバー起動:
npm start

開発モード:

npm run dev

エンドポイント

  • http://localhost:3000/mcp(デフォルト設定の場合)

ツールの追加方法

  1. src/mcp/tools/ ディレクトリに新しいツールファイルを作成
  2. src/mcp/index.ts でツールを登録