Skip to main content
Glama

Next.js MCP Server

使用 Next.js 的无头 MCP(来自注册表)

使用@vercel/mcp-adapter和可配置的 MCP 注册表

部署 URL

此应用程序部署于: https://nextjs-mcp-use.vercel.app

特征

  • MCP 注册表:在单个 JSON 文件中配置多个 MCP 服务器
  • GitHub Actions :使用计划和手动工作流程测试和监控您的 API 端点
  • 错误处理:优雅地处理超时和连接失败
  • 环境变量:为每个 MCP 服务器配置环境变量

MCP 注册

MCP 注册表是一个 JSON 配置文件,用于存储所有可用 MCP 服务器的信息。每个服务器都可以启用或禁用,并拥有各自的环境变量。

注册表位于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 } }

用法

此示例应用程序使用Vercel MCP 适配器,允许您在任何 Next.js 项目中的一组路由上放入 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 Actions

本项目包含用于测试和监控 API 端点的 GitHub Actions 工作流程。更多信息请参阅.github/workflows/README.md文件。

在 Vercel 上运行的注意事项

  • 要使用 SSE 传输,需要在process.env.REDIS_URL下将 Redis 附加到项目
  • 确保已启用Fluid Compute以实现高效执行
  • 启用 Fluid compute 后,打开app/route.ts并将maxDuration调整为 800(如果您使用 Vercel Pro 或 Enterprise 帐户)
  • 部署 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.

Next.js 项目的示例 MCP 服务器实现,使用 Vercel MCP 适配器处理跨不同传输方法的协议请求。

  1. 部署 URL
    1. 特征
      1. MCP 注册
        1. 用法
          1. API 端点
          2. 测试 API
        2. GitHub Actions
          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
                28
                • 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