Next.js を使用したヘッドレス MCP の使用 (レジストリから)
設定可能なMCPレジストリで@vercel/mcp-adapter
を使用する
デプロイされたURL
このアプリケーションは、 https://nextjs-mcp-use.vercel.appにデプロイされています。
特徴
- MCP レジストリ: 単一の JSON ファイルで複数の MCP サーバーを構成する
- GitHub Actions : スケジュールされたワークフローと手動ワークフローを使用して API エンドポイントをテストおよび監視します
- エラー処理: タイムアウトと接続失敗を適切に処理します
- 環境変数: 各MCPサーバーの環境変数を設定します
MCPレジストリ
MCPレジストリは、利用可能なすべてのMCPサーバーに関する情報を保存するJSON設定ファイルです。各サーバーは有効化または無効化でき、独自の環境変数を持つことができます。
レジストリはconfig/mcp-registry.json
にあり、次の構造を持ちます。
使用法
このサンプル アプリは、任意の Next.js プロジェクト内のルートのグループに MCP サーバーをドロップインできるVercel MCP アダプターを使用します。
MCP TypeScript SDK ドキュメントに従って、ツール、プロンプト、リソースを使用してapp/[transport]/route.ts
更新します。
APIエンドポイント
- チャット API :
/api/chat
- ストリーミング チャット エンドポイント - 完了 API :
/api/completions
- 非ストリーミングチャット完了エンドポイント
APIのテスト
提供されているテスト スクリプトを使用して API エンドポイントをテストできます。
GitHubアクション
このプロジェクトには、APIエンドポイントのテストと監視のためのGitHub Actionsワークフローが含まれています。詳細については、.github/workflows/README.mdファイルをご覧ください。
Vercelで実行する場合の注意事項
- SSEトランスポートを使用するには、
process.env.REDIS_URL
の下のプロジェクトにRedisが接続されている必要があります。 - 効率的な実行のためにFluid Computeが有効になっていることを確認してください
- Fluidコンピューティングを有効にした後、
app/route.ts
を開き、Vercel ProまたはEnterpriseアカウントを使用している場合はmaxDuration
800に調整します。 - Next.js MCP テンプレートをデプロイする
サンプルクライアント
scripts/test-client.mjs
には、呼び出しを試すためのサンプル クライアントが含まれています。
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.
Vercel MCP アダプターを使用して、さまざまなトランスポート方法にわたるプロトコル要求を処理する、Next.js プロジェクト用のサンプル MCP サーバー実装。
Related MCP Servers
- AsecurityAlicenseAqualityAn MCP server that provides tools for interacting with Vercel API, enabling management of deployments, DNS records, domains, projects, and environment variables through natural language.Last updated -710916TypeScriptMIT License
- AsecurityFlicenseAqualityAn MCP server that provides various tools for interacting with the Vercel API, enabling management of deployments, DNS records, domains, projects, and environment variables through natural language commands.Last updated -710919JavaScript
- -securityAlicense-qualityA drop-in MCP server implementation for Next.js projects using Vercel MCP Adapter, allowing developers to integrate model context protocol functionality with custom tools, prompts, and resources.Last updated -JavaScriptMIT License
- -securityAlicense-qualityA sample implementation of a Model Context Protocol server using Next.js and the Vercel MCP Adapter, allowing developers to create AI assistants with custom tools and resources.Last updated -TypeScriptMIT License