NestJS MCP Server
Provides tools to analyze repository activity for calculating Four Keys (DORA) metrics, including deployment frequency, lead time for changes, change failure rate, and mean time to recovery (MTTR) by accessing releases, pull requests, and issues.
Integrates with GitHub Actions to detect deployment events and workflow failures for use in software delivery performance analysis and metric calculation.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
NestJS MCP Server
NestJSを使用したModel Context Protocol (MCP)サーバーの実装サンプルです。 DDD/クリーンアーキテクチャを適用しやすい構造で、今後のMCP開発のベースとして利用できます。
🎯 特徴
NestJS: エンタープライズグレードのフレームワーク
デコレーターベース:
@Toolデコレーターで簡潔にツールを定義レイヤー分離: サービス層とツール層を分離(DDD適用可能)
依存性注入: テスタブルで保守性の高い設計
Streamable HTTP: 最新のMCP仕様に対応
Zod: 型安全なパラメータバリデーション
Related MCP server: MCP Redirect Server
🌿 ブランチ構成
ブランチ | 内容 |
| 入門向け。時刻・計算・メモのシンプルなツールでMCPの基本を学ぶ |
| 実践向け。GitHub APIを使った Four Keys (DORA Metrics) の実装 |
git checkout four-keys-example
npm install # GitHub API関連の依存パッケージが追加されるため再インストールが必要📦 提供する機能
get_current_time - 現在の日時を取得
calculate - 四則演算(加算、減算、乗算、除算)
save_note - メモの保存
get_note - メモの取得
list_notes - 保存されたメモの一覧表示
🚀 セットアップ
1. 依存関係のインストール
npm install2. ビルド
npm run build3. サーバーの起動
npm startサーバーが起動すると、以下のように表示されます:
🚀 NestJS MCP Server running on http://localhost:3000
📡 MCP Endpoint: http://localhost:3000/mcp4. テスト実行
npm test # 単体テスト
npm run test:e2e # サーバー起動中にMCPクライアントから疎通確認🏗️ プロジェクト構造
src/
├── main.ts # エントリーポイント
├── app.module.ts # ルートモジュール
├── mcp/ # MCPモジュール
│ ├── mcp.module.ts # MCP設定・プロバイダー登録
│ ├── tools/ # ツール層(MCPインターフェース)
│ │ ├── time.tool.ts # 時刻ツール
│ │ ├── calculator.tool.ts # 計算ツール
│ │ └── notes.tool.ts # メモツール
│ └── services/ # サービス層(ビジネスロジック)
│ ├── time.service.ts
│ ├── calculator.service.ts
│ └── notes.service.ts
└── domain/ # ドメイン層(将来の拡張用)
└── notes/
└── (エンティティ、リポジトリなど)📝 実装例
ツール定義(デコレーターベース)
// src/mcp/tools/time.tool.ts
import { Injectable } from '@nestjs/common';
import { Tool } from '@rekog/mcp-nest';
import { z } from 'zod';
import { TimeService } from '../services/time.service';
@Injectable()
export class TimeTool {
constructor(private readonly timeService: TimeService) {}
@Tool({
name: 'get_current_time',
description: '現在の日時を取得します',
parameters: z.object({}),
})
async getCurrentTime() {
const time = this.timeService.getCurrentTime();
return `現在の日時: ${time}`;
}
}サービス層(ビジネスロジック)
// src/mcp/services/time.service.ts
import { Injectable } from '@nestjs/common';
@Injectable()
export class TimeService {
getCurrentTime(): string {
const now = new Date();
return now.toLocaleString('ja-JP', { timeZone: 'Asia/Tokyo' });
}
}モジュール設定
// src/mcp/mcp.module.ts
import { Module } from '@nestjs/common';
import { TimeService } from './services/time.service';
import { TimeTool } from './tools/time.tool';
@Module({
providers: [
// サービス層
TimeService,
// ツール層
TimeTool,
],
})
export class McpToolsModule {}🔧 開発
開発モード(ホットリロード)
npm run start:devビルドのみ
npm run build🎓 学習ポイント
1. レイヤー分離
ツール層: MCPプロトコルとのインターフェース(
@Toolデコレーター)サービス層: ビジネスロジック(
@Injectable())ドメイン層: エンティティ、リポジトリ(将来の拡張)
2. 依存性注入
constructor(private readonly timeService: TimeService) {}コンストラクタインジェクションで疎結合を実現し、テストが容易。
3. 型安全なパラメータ
parameters: z.object({
operation: z.enum(['add', 'subtract', 'multiply', 'divide']),
a: z.number(),
b: z.number(),
})Zodによる実行時バリデーションとTypeScript型推論。
4. MCPモジュール設定
McpModule.forRoot({
name: 'nestjs-mcp-server',
version: '1.0.0',
transport: McpTransportType.STREAMABLE_HTTP,
mcpEndpoint: '/mcp',
})🌟 今後の拡張例
データベース統合
// TypeORM
@Module({
imports: [
TypeOrmModule.forRoot({...}),
TypeOrmModule.forFeature([Note]),
],
})
// Prisma
@Injectable()
export class NotesService {
constructor(private prisma: PrismaService) {}
}外部API統合
@Module({
imports: [HttpModule],
})
@Injectable()
export class ExternalApiService {
constructor(private http: HttpService) {}
}認証・認可
@Tool({...})
@UseGuards(AuthGuard)
async protectedTool() {...}📚 参考リンク
📄 ライセンス
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Model Context Protocol server for Studex tools, notifications, and profile integrations
ADHD-friendly tasks, notes & projects for LucidNest - 18 tools, scoped tokens, Streamable HTTP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA TypeScript implementation of a Model Context Protocol server that provides a frictionless framework for developers to build and deploy AI tools and prompts, focusing on developer experience with zero boilerplate and automatic tool registration.2,530 npm14MIT
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server built with NestJS that provides OAuth 2.1 authentication with GitHub and exposes MCP tools through Server-Sent Events transport. Enables secure, real-time communication with JWT-based protection and dependency injection.-
- AlicenseNot gradedqualityDmaintenanceA NestJS module for building Model Context Protocol (MCP) servers using decorators to expose services as tools, resources, and prompts. It features auto-discovery, a built-in playground UI, and support for multiple transports including SSE and Stdio.12 npmMIT
- AlicenseNot gradedqualityDmaintenanceA minimal NestJS MCP server skeleton for experimenting with the Model Context Protocol. Currently a placeholder with no implemented tools or resources.19 npmMIT