Allows integration of MCP servers into Next.js applications with specific route handling capabilities.
Enables Server-Sent Events (SSE) transport for MCP functionality when deployed on Vercel.
Provides TypeScript SDK support for defining tools, prompts, and resources in the MCP server implementation.
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
- -securityAlicense-qualityMCP Server for the Perplexity API.Last updated -50PythonMIT License
- 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 -7653TypeScriptMIT License
- -securityAlicense-qualityAn MCP server that enables fetching web content using the Node.js undici library, supporting various HTTP methods, content formats, and request configurations.Last updated -668TypeScriptMIT License
- AsecurityFlicenseAqualityAn MCP server implementation that enables interaction with the Unstructured API, providing tools to list, create, update, and manage sources, destinations, and workflows.Last updated -3926