akiraNuma/mcp-server-tutorial
3.3
If you are the rightful owner of mcp-server-tutorial and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
This project is a sample MCP server application using Express, TypeScript, and the MCP SDK.
Tools
1
Resources
0
Prompts
0
MCP Server Application
概要
このディレクトリは、Express + TypeScript + MCP SDK を使ったMCPサーバーのサンプルプロジェクトです。
環境情報
Node.js バージョン
- 推奨バージョン: Node.js 22.22.0 (
.node-versionで指定)
バージョン管理ツールでのセットアップ
# nodenv を使用している場合
nodenv install 22.22.0
nodenv local 22.22.0
# nvm を使用している場合
nvm install 22.22.0
nvm use 22.22.0
セットアップ手順
- 依存関係のインストール
npm install
- 環境変数の設定
cp .env.example .env
# .envファイルを編集して適切な値を設定してください
- サーバー起動(開発モード)
npm run dev
エンドポイント
http://localhost:3000/mcp(デフォルト設定の場合)
デバッグ用ツール
npx @modelcontextprotocol/inspector
(応用編)Redmine連携機能
実践的なサンプルとして、Redmine APIと連携するツールを実装しています。チケットの取得・作成・更新が可能です。
必要なヘッダー
MCPクライアントから以下のヘッダーを送信してください。
| ヘッダー | 説明 |
|---|---|
x-redmine-url | RedmineのベースURL(例: https://redmine.example.com) |
x-redmine-api-key | Redmine APIキー |
Redmine APIキーの取得方法
- Redmine管理者に「REST APIを有効にする」設定を依頼(管理 → 設定 → API)
- Redmineにログイン
- 右上のアカウント名 → 「個人設定」
- 右ペインの「APIアクセスキー」欄で「表示」をクリック
クライアント設定例(VS Code)
# mcp.json
{
"servers": {
"redmine-mcp": {
"type": "http",
"url": "http://localhost:3000/mcp",
"headers": {
"x-redmine-url": "https://your-redmine.example.com",
"x-redmine-api-key": "your-api-key-here"
}
}
}
}