From 489a8008688bb0acef2dc75c0231bdf2126b591e Mon Sep 17 00:00:00 2001 From: mirror <674958229@qq.com> Date: Tue, 29 Apr 2025 20:44:00 +0800 Subject: [PATCH] add: add mcp-context7 descriptions (#2149) --- .../mcp-servers/mcp-context7/README.md | 49 +++++++++++++++++ .../mcp-servers/mcp-context7/README_ZH.md | 49 +++++++++++++++++ .../mcp-servers/mcp-context7/mcp-server.yaml | 55 +++++++++++++++++++ 3 files changed, 153 insertions(+) create mode 100644 plugins/wasm-go/mcp-servers/mcp-context7/README.md create mode 100644 plugins/wasm-go/mcp-servers/mcp-context7/README_ZH.md create mode 100644 plugins/wasm-go/mcp-servers/mcp-context7/mcp-server.yaml diff --git a/plugins/wasm-go/mcp-servers/mcp-context7/README.md b/plugins/wasm-go/mcp-servers/mcp-context7/README.md new file mode 100644 index 000000000..af1ed6827 --- /dev/null +++ b/plugins/wasm-go/mcp-servers/mcp-context7/README.md @@ -0,0 +1,49 @@ +# Context7 MCP Server + +An implementation of the Model Context Protocol (MCP) server that integrates [Context7](https://context7.com), providing up-to-date, version-specific documentation and code examples. + +Source Code: [https://github.com/upstash/context7](https://github.com/upstash/context7) + +## Features + +- Get up-to-date, version-specific documentation +- Extract real, working code examples from source +- Provide concise, relevant information without filler +- Free for personal use +- Integration with your MCP server and tools + +## Usage Guide + +### Generate SSE URL + +On the MCP Server interface, log in and enter the API-KEY to generate the URL. + +### Configure MCP Client + +On the user's MCP Client interface, add the generated SSE URL to the MCP Server list. + +```json +"mcpServers": { + "context7": { + "url": "https://mcp.higress.ai/mcp-context7/{generate_key}", + } +} +``` + +### Available Tools + +#### resolve-library-id +Resolves a general package name into a Context7-compatible library ID. This is a required first step before using the get-library-docs tool. + +Parameters: +- query: Library name to search for and retrieve a Context7-compatible library ID (required) + +#### get-library-docs +Fetches up-to-date documentation for a library. You must call resolve-library-id first to obtain the exact Context7-compatible library ID. + +Parameters: +- folders: Folders filter for organizing documentation +- libraryId: Unique identifier of the library (required) +- tokens: Maximum number of tokens to return (default: 5000) +- topic: Specific topic within the documentation +- type: Type of documentation to retrieve (currently only "txt" supported) diff --git a/plugins/wasm-go/mcp-servers/mcp-context7/README_ZH.md b/plugins/wasm-go/mcp-servers/mcp-context7/README_ZH.md new file mode 100644 index 000000000..e6c89a795 --- /dev/null +++ b/plugins/wasm-go/mcp-servers/mcp-context7/README_ZH.md @@ -0,0 +1,49 @@ +# Context7 MCP Server + +一个集成了[Context7](https://context7.com)的模型上下文协议(MCP)服务器实现,提供最新、版本特定的文档和代码示例。 + +源码地址:[https://github.com/upstash/context7](https://github.com/upstash/context7) + +## 功能 + +- 获取最新、版本特定的文档 +- 从源码中提取真实可用的代码示例 +- 提供简洁、相关的信息,无冗余内容 +- 支持个人免费使用 +- 与MCP服务器和工具集成 + +## 使用教程 + +### 生成 SSE URL + +在 MCP Server 界面,登录后输入 API-KEY,生成URL。 + +### 配置 MCP Client + +在用户的 MCP Client 界面,将生成的 SSE URL添加到 MCP Server列表中。 + +```json +"mcpServers": { + "context7": { + "url": "https://mcp.higress.ai/mcp-context7/{generate_key}", + } +} +``` + +### 可用工具 + +#### resolve-library-id +用于将通用包名解析为Context7兼容的库ID,是使用get-library-docs工具获取文档的必要前置步骤。 + +参数说明: +- query: 要搜索的库名称,用于获取Context7兼容的库ID (必填) + +#### get-library-docs +获取库的最新文档。使用前必须先调用resolve-library-id工具获取Context7兼容的库ID。 + +参数说明: +- folders: 用于组织文档的文件夹过滤器 +- libraryId: 库的唯一标识符 (必填) +- tokens: 返回的最大token数,默认5000 +- topic: 文档中的特定主题 +- type: 要检索的文档类型,目前仅支持"txt" diff --git a/plugins/wasm-go/mcp-servers/mcp-context7/mcp-server.yaml b/plugins/wasm-go/mcp-servers/mcp-context7/mcp-server.yaml new file mode 100644 index 000000000..e6a90a7c2 --- /dev/null +++ b/plugins/wasm-go/mcp-servers/mcp-context7/mcp-server.yaml @@ -0,0 +1,55 @@ +server: + name: context7-mcp-server +tools: + - name: resolve-library-id + description: Required first step - Resolves a general package name into a Context7-compatible library ID. Must be called before using 'get-library-docs' to retrieve a valid Context7-compatible library ID. + args: + - name: query + description: Library name to search for and retrieve a Context7-compatible library ID. + type: string + required: true + position: query + requestTemplate: + url: https://context7.com/api/v1/search + method: GET + responseTemplate: + body: | + {{- range $index, $item := .results }} + ## 结果 {{add $index 1}} + - **id**: {{ $item.id }} + - **title**: {{ $item.title }} + - **description**: {{ $item.description }} + {{- end }} + - name: get-library-docs + description: Fetches up-to-date documentation for a library. You must call 'resolve-library-id' first to obtain the exact Context7-compatible library ID required to use this tool. + args: + - name: folders + description: Folders filter for organizing documentation + type: string + position: query + - name: libraryId + description: Unique identifier of the library + type: string + required: true + position: path + - name: tokens + description: Maximum number of tokens to return + type: integer + position: query + default: 5000 + - name: topic + description: Specific topic within the documentation + type: string + position: query + - name: type + description: Type of documentation to retrieve + type: string + position: query + enum: ["txt"] + requestTemplate: + url: https://context7.com/api/v1{libraryId} + method: GET + headers: + - key: X-Context7-Source + value: server + \ No newline at end of file