MCP Hub Tools

by hekmon8
  • Apple
  • Linux

Integrations

  • Provides an HTTP-based implementation that allows Node.js applications to connect to the MCP server over HTTP, with authentication via API key in the Authorization header.

mcphub_tools MCP 服务器

由 aimcp 提供支持的 McP 工具,助您轻松找到所需的 MCP。此服务器支持在 MCP Hub 中搜索可用的 MCP。

开放协议

该服务器实现了模型上下文协议 (MCP) 。它充当 MCP 服务器,可供 MCP 客户端(例如兼容的 AI 助手或开发工具)连接。

介绍

mcphub_tools是一个用于与MCP Hub交互的 MCP 服务器。其主要功能是提供一个工具,允许用户根据关键字搜索在 Hub 上注册的 MCP(模型上下文协议/服务器)。

工具

该服务器提供以下工具:

search_mcp_hub

  • **描述:**在 MCP Hub 上搜索 MCP。
  • 输入模式:
    { "type": "object", "properties": { "keywords": { "type": "string", "description": "Keywords to search for MCPs" } }, "required": ["keywords"] }
  • **输出:**返回包含来自 MCP Hub API 的搜索结果的 JSON 字符串。

get_mcp_info

  • **描述:**获取有关特定 MCP 的详细信息。
  • 输入模式:
    { "type": "object", "properties": { "id": { "type": "string", "description": "MCP identifier (UUID)" } }, "required": ["id"] }
  • **输出:**返回包含指定 MCP 详细信息的 JSON 字符串。

实施选项

MCP Hub 支持两种不同的方式实现 MCP 服务器:

1. 基于 stdio 的标准 MCP 服务器

这是 MCP 服务器通过标准输入/输出 (stdio) 与客户端通信的传统实现方式。这种方法非常适合可与 Claude Desktop 等 MCP 客户端集成的独立命令行工具。

使用基于 stdio 的实现的最简单方法是通过我们发布的包:

# Using npx (recommended for most users) npx @aimcp/tools # Using uvx (faster startup) uvx @aimcp/tools

2. 基于 HTTP 的 MCP 服务器

MCP Hub 还提供了基于 HTTP 的实现,允许 AI 助手和其他工具通过 HTTP 连接到 MCP 服务器。该实现在 MCP Hub 的 API 中,位于/api/open/v1/streamable

HTTP 端点位于:

https://mcp.aimcp.info/api/open/v1/streamable

用法

先决条件

  • 为基于 stdio 的实现安装 Node.js 和 npm(或 pnpm/yarn)。
  • 来自 MCP Hub 的 API 密钥( https://www.aimcp.info )。
如何获取 API 密钥
  • 转到https://www.aimcp.info
  • 注册或登录。
  • 导航到您的个人资料或帐户设置。
  • 寻找生成或检索 API 密钥的选项。
  • 或者您可以访问此处生成 API 密钥。注意:API 密钥的请求速率限制为每小时 20 个。

验证

MCP API 需要使用有效的 API 密钥进行身份验证。此密钥必须通过以下方式提供:

  1. 对于基于 stdio 的实现:环境变量MCP_HUB_API_KEY
  2. 对于基于 HTTP 的实现: Authorization标头作为 Bearer 令牌。
Authorization: Bearer YOUR_API_KEY

与 AI 助手和 MCP 客户端集成

Claude桌面配置

要将 MCP Hub 与 Claude Desktop 结合使用:

  1. 找到您的 Claude Desktop 配置文件:
    • Windows: %APPDATA%\claude\config.json
    • macOS: ~/Library/Application Support/claude/config.json~/.config/claude/config.json
    • Linux: ~/.config/claude/config.json
  2. 添加以下配置:
{ "mcpServers": { "mcp-hub": { "command": "npx", "args": ["@aimcp/tools"], "environment": { "MCP_HUB_API_KEY": "YOUR_API_KEY" } } } }
  1. 重新启动 Claude Desktop 以应用更改。
  2. 在对话中,您可以通过输入“@mcp-hub”来访问 MCP Hub 工具。
Cline 和其他 CLI 工具

对于基于命令行的工具(例如 Cline):

  1. 在您的项目目录中创建一个名为servers.json的配置文件:
{ "servers": [ { "name": "mcp-hub-tools", "command": ["npx", "@aimcp/tools"], "environment": { "MCP_HUB_API_KEY": "YOUR_API_KEY" } } ] }
  1. 参考此配置启动该工具:
cline --mcp-servers-config ./servers.json
对于支持远程 MCP 服务器的工具

一些较新的 MCP 客户端支持直接 HTTP 连接。请使用以下方式配置它们:

{ "mcpServers": { "mcp-hub-http": { "url": "https://mcp.aimcp.info/api/open/v1/streamable", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } }
对于使用基于文件配置的工具(光标等)
  1. 创建配置文件:
{ "mcpServers": { "mcp-hub": { "command": "npx", "args": ["@aimcp/tools"], "environment": { "MCP_HUB_API_KEY": "YOUR_API_KEY" } } } }
  1. 在您的工具设置中引用此文件或使用适当的配置参数启动。

手动运行

您还可以手动运行基于 stdio 的服务器进行测试(确保在您的环境中设置了MCP_HUB_API_KEY ):

export MCP_HUB_API_KEY="YOUR_API_KEY_HERE" npx @aimcp/tools

API接口

该服务器与以下 MCP Hub API 端点交互:

  • 端点: GET https://www.aimcp.info/api/open/v1/search
  • **身份验证:**需要使用MCP_HUB_API_KEYAuthorization标头中输入 Bearer 令牌。
  • 查询参数: keywords (字符串)

使用基于 HTTP 的 MCP API

MCP Hub 在/api/open/v1/streamable提供了一个基于 HTTP 的 MCP 服务器,该服务器实现了模型上下文协议 (MCP Protocol)。这使得 AI 助手和工具能够直接搜索 MCP 并获取 MCP 信息。

连接步骤

  1. 首先建立连接以获取会话ID:
GET /api/open/v1/streamable Authorization: Bearer YOUR_API_KEY

回复:

{ "success": true, "sessionId": "194830ab-eb0b-4d17-a574-af96705276c2", "message": "Connection established. Use this sessionId for subsequent calls." }
  1. 使用会话 ID 调用工具:
POST /api/open/v1/streamable?sessionId=194830ab-eb0b-4d17-a574-af96705276c2 Content-Type: application/json Authorization: Bearer YOUR_API_KEY { "jsonrpc": "2.0", "method": "callTool", "params": { "name": "search_mcp_hub", "arguments": { "keywords": "example" } }, "id": "call-1" }

开发与部署

发展

  1. 安装依赖项: pnpm install
  2. 构建: pnpm run build (在build/中将 TypeScript 编译为 JavaScript)
  3. 监视模式: pnpm run watch (发生更改时自动重新编译)
  4. 使用 Inspector 进行测试: pnpm run inspector (使用 MCP Inspector 工具运行服务器)

创建你自己的基于 stdio 的 MCP 服务器

如果您想创建自己的基于 stdio 的 MCP 服务器,请按照以下步骤操作:

  1. 设置您的项目:
    mkdir my-mcp-server cd my-mcp-server npm init -y npm install @modelcontextprotocol/sdk
  2. 创建您的服务器实现:
// index.ts import { Server } from '@modelcontextprotocol/sdk/server'; import { CallToolRequestSchema, ListToolsRequestSchema, McpError, ErrorCode } from '@modelcontextprotocol/sdk/types'; import { StdioTransport } from '@modelcontextprotocol/sdk/transports/stdio'; // Create an MCP server instance const server = new Server( { name: "my-mcp-server", version: "1.0.0" }, { capabilities: { tools: {}, } } ); // Set up tool handlers server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ { name: 'my_tool', description: 'Description of my tool', inputSchema: { type: 'object', properties: { param1: { type: 'string', description: 'Description of param1', }, }, required: ['param1'], }, }, ], })); server.setRequestHandler(CallToolRequestSchema, async (request) => { // Extract tool name and arguments const toolName = request.params.name; const args = request.params.arguments; if (toolName === 'my_tool') { // Validate arguments if (typeof args !== 'object' || args === null || typeof args.param1 !== 'string') { throw new McpError( ErrorCode.InvalidParams, 'Invalid arguments. Requires "param1" (string).' ); } try { // Implement your tool logic here const result = `Processed: ${args.param1}`; return { content: [ { type: 'text', text: result, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } } else { throw new McpError( ErrorCode.MethodNotFound, `Unknown tool: ${toolName}` ); } }); // Connect the server to stdin/stdout const transport = new StdioTransport(); server.connect(transport).catch(console.error);
  1. 编译并运行你的服务器:
    npx tsc node dist/index.js
  2. 使用 MCP Inspector 工具测试您的服务器:
    npx @modelcontextprotocol/inspector

部署

  1. 确保服务器已构建( pnpm run build )。
  2. build目录包含必要的 JavaScript 文件。
  3. 如果软件包安装得当(例如全局或链接),则可以使用node build/index.js或命令mcphub_tools运行服务器。
  4. 配置您的 MCP 客户端/管理器以指向服务器可执行文件并提供MCP_HUB_API_KEY环境变量。

您还可以将您的 MCP 服务器发布到 npm,以便其他人可以安装和使用它。

Related MCP Servers

  • A
    security
    A
    license
    A
    quality
    A 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 -
    3
    9
    36
    JavaScript
    Apache 2.0
  • -
    security
    A
    license
    -
    quality
    MCP Server simplifies the implementation of the Model Context Protocol by providing a user-friendly API to create custom tools and manage server workflows efficiently.
    Last updated -
    4
    3
    TypeScript
    MIT License
  • -
    security
    -
    license
    -
    quality
    A 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 -
    1
    TypeScript
  • -
    security
    -
    license
    -
    quality
    A Model Context Protocol (MCP) server that interacts with system APIs, allowing users to check connections, search employees, register breakfast, and update chemical information by shifts.
    Last updated -
    2

View all related MCP servers

ID: ljjvaq7kh0