Integrations
Enables configuration of the MCP server through environment variables, supporting settings for port configuration, environment mode, and OAuth settings.
Provides the HTTP transport layer for the MCP server, allowing it to serve MCP resources, tools, and prompts over a RESTful API interface.
Serves as the runtime environment for the MCP server, enabling both HTTP and stdio transport options.
MCP サーバー ボイラープレート
TypeScript と Express を使用して構築された、モデル コンテキスト プロトコル (MCP) の定型サーバー実装。
目次
概要
このプロジェクトは、モデルコンテキストプロトコル(MCP)に準拠したサーバーを実装します。MCPにより、アプリケーションは標準化された方法でLLMのコンテキストを提供できるようになります。MCPには以下のものが含まれます。
- HTTPおよびstdioトランスポートオプションを備えた完全に構成されたMCPサーバー
- 主要な機能を実証するためのサンプルリソース、ツール、プロンプト
- 型安全性と開発者エクスペリエンスの向上を実現する TypeScript サポート
- HTTPトランスポート層の高速統合
プロジェクト構造
はじめる
前提条件
- Node.js (v18以降)
- npmまたはyarn
インストール
リポジトリをクローンし、依存関係をインストールします。
環境変数
サンプル環境ファイルをコピーし、必要に応じて変更します。
利用可能な環境変数:
PORT
: HTTPサーバーのポート(デフォルト: 3000)NODE_ENV
: 環境モード(開発、本番)- OAuth設定(必要な場合)
サーバーの実行
HTTPサーバー
HTTP サーバーをビルドして起動します。
自動再起動を使用した開発の場合:
サーバーはhttp://localhost:3000/mcp
(または .env ファイルで指定されたポート) で利用できます。
標準モード
サーバーを stdio モード (コマンドライン ツール用) で実行するには:
自動再起動を使用した開発の場合:
リソース
定型文には次のサンプル リソースが含まれています。
- 静的情報リソース:
info://server
- サーバーに関する基本情報を提供します
- 動的グリーティングリソース:
greeting://{name}
- 指定された名前パラメータを使用してパーソナライズされた挨拶を生成します
リソースにアクセスするには:
- MCPプロトコルを通じて
- MCPクライアントライブラリの使用
ツール
定型文には次のサンプル ツールが含まれています。
- 電卓: 基本的な算術演算を実行します
- パラメータ:
operation
: 実行する演算(加算、減算、乗算、除算)a
: 最初の数字b
: 2番目の数字
- パラメータ:
- タイムスタンプ: 現在の時刻をさまざまな形式で提供します
- パラメータ:
format
: 出力形式 (iso、unix、readable)
- パラメータ:
プロンプト
定型文には次のサンプルプロンプトが含まれています。
- 挨拶: パーソナライズされた挨拶プロンプトを作成します
- パラメータ:
name
: 挨拶する名前formal
:フォーマルな挨拶スタイルを使用するかどうか(オプション)
- パラメータ:
- データ分析: データ分析のプロンプトを作成します
- パラメータ:
data
:分析するデータformat
: データ形式 (json、csv、テキスト)instructions
:追加の分析指示(オプション)
- パラメータ:
サーバーの拡張
リソースの追加
新しいリソースを追加するには:
src/resources/
に新しいファイルを作成します (例:myResource.ts
)- リソースハンドラーを実装する
src/resources/index.ts
に登録する
例:
ツールの追加
新しいツールを追加するには:
src/tools/
に新しいファイルを作成します (例:myTool.ts
)- ツールハンドラーを実装する
src/tools/index.ts
に登録する
例:
プロンプトの追加
新しいプロンプトを追加するには:
src/prompts/
に新しいファイルを作成します(例:myPrompt.ts
)- プロンプトハンドラーを実装する
src/prompts/index.ts
に登録する
例:
テストとデバッグ
MCP サーバーをテストするには、以下を使用できます。
- MCPインスペクターツール
- MCP クライアント ライブラリ
- 直接 HTTP リクエスト (デバッグ用)
ライセンス
このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細については LICENSE ファイルを参照してください。
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
アプリケーションがサンプル リソース、ツール、およびプロンプトを使用して LLM の標準化されたコンテキストを提供できるようにする、すぐに使用できるモデル コンテキスト プロトコル (MCP) サーバーのスターター実装。
Related MCP Servers
- AsecurityAlicenseAqualityA beginner-friendly Model Context Protocol (MCP) server that helps users understand MCP concepts, provides interactive examples, and lists available MCP servers. This server is designed to be a helpful companion for developers working with MCP. Also comes with a huge list of servers you can install.Last updated -3936JavaScriptApache 2.0
- AsecurityAlicenseAqualityAn educational implementation of a Model Context Protocol server that demonstrates how to build a functional MCP server for integrating with various LLM clients like Claude Desktop.Last updated -188PythonMIT License
- -security-license-qualityA specialized server that helps users create new Model Context Protocol (MCP) servers by providing tools and templates for scaffolding projects with various capabilities.Last updated -1TypeScript
- -securityAlicense-qualityA Model Context Protocol (MCP) server implementation that enables LLMs to interact with the Osmosis protocol, allowing for querying and transaction functionality through natural language.Last updated -9TypeScriptMIT License