Next.js MCP Server

Integrations
  • 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にあり、次の構造を持ちます。

{ "server-name": { "url": "http://localhost:3002/sse", "enabled": true, "env": { "API_KEY": "your-api-key" } }, "another-server": { "url": "https://example.com/sse", "enabled": false } }

使用法

このサンプル アプリは、任意の Next.js プロジェクト内のルートのグループに MCP サーバーをドロップインできるVercel MCP アダプターを使用します。

MCP TypeScript SDK ドキュメントに従って、ツール、プロンプト、リソースを使用してapp/[transport]/route.ts更新します。

APIエンドポイント

  • チャット API : /api/chat - ストリーミング チャット エンドポイント
  • 完了 API : /api/completions - 非ストリーミングチャット完了エンドポイント

APIのテスト

提供されているテスト スクリプトを使用して API エンドポイントをテストできます。

# Test the chat endpoint npm run test:chat -- --message "Your message here" # Test the completions endpoint npm run test:completions -- --message "Your message here" # Test with a custom URL npm run test:chat -- --url http://localhost:3000/api/chat --message "Your message here"

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には、呼び出しを試すためのサンプル クライアントが含まれています。
node scripts/test-client.mjs https://nextjs-mcp-use.vercel.app
-
security - not tested
A
license - permissive license
-
quality - not tested

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 サーバー実装。

  1. デプロイされたURL
    1. 特徴
      1. MCPレジストリ
        1. 使用法
          1. APIエンドポイント
          2. APIのテスト
        2. GitHubアクション
          1. Vercelで実行する場合の注意事項
            1. サンプルクライアント

              Related MCP Servers

              • -
                security
                A
                license
                -
                quality
                MCP Server for the Perplexity API.
                Last updated -
                50
                Python
                MIT License
                • Linux
                • Apple
              • A
                security
                A
                license
                A
                quality
                An 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 -
                7
                65
                3
                TypeScript
                MIT License
              • -
                security
                A
                license
                -
                quality
                An MCP server that enables fetching web content using the Node.js undici library, supporting various HTTP methods, content formats, and request configurations.
                Last updated -
                66
                8
                TypeScript
                MIT License
                • Apple
                • Linux
              • A
                security
                F
                license
                A
                quality
                An MCP server implementation that enables interaction with the Unstructured API, providing tools to list, create, update, and manage sources, destinations, and workflows.
                Last updated -
                39
                26
                • Apple

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/cameronking4/nextjs-mcp-use'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server