Token导航 LogoToken导航TokenDH.com
MCP Package Docs Server logo
文档知识stdio官方级别未说明来源级核验

MCP Package Docs Server

MCP Server

mcp-package-docs

MCP服务器为LLMs提供跨编程语言的高效包文档访问和语言服务器协议(LSP)功能。

工具数

0

提示词数

0

GitHub Stars

79

资源数

0
TypeScript性能优化文档处理

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

sammcj

提供方

sammcj

最后核验

2026/5/17 20:22

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx -y mcp-package-docs

详细介绍

包装文档MCP服务器

MCP(模型上下文协议)服务器,为LLM提供跨多种编程语言和语言服务器协议(LSP)功能的包文档高效访问。

特性

  • 多语言支持:

- 通过以下方式发送包裹 go doc - 通过内置的Python库 help() - 通过注册表文档(包括私有注册表)提供NPM包 - 通过crates.io和docs.rs对板条箱进行防锈处理

  • 智能文档解析:

- 带有描述、用法和示例的结构化输出 - 集中信息以避免上下文过载 - 支持特定符号/函数查找 - 跨文档的模糊和精确搜索功能

  • 高级搜索功能:

- 在软件包文档中搜索 - 灵活查询的模糊匹配 - 具有相关性评分的情境感知结果 - 从搜索结果中提取符号

  • 语言服务器协议(LSP)支持:

- 代码符号的悬停信息 - 代码补全 - 诊断(错误和警告) - 目前支持Types/JavaScript - 可扩展到其他语言

  • 性能优化:

- 内置缓存 - 高效解析 - 最小内存占用

安装

注意:我不建议使用 npx -y 在生产环境中运行您的MCP服务器,因为您非常信任当时从互联网上下载的任何软件包。我强烈建议在本地克隆存储库或构建容器映像。

npx -y mcp-package-docs

用法

作为MCP服务器

  1. 添加到MCP设置配置中:
{
  "mcpServers": {
    "package-docs": {
      "command": "npx",
      "args": ["-y", "mcp-package-docs"],
      "env": {
        "ENABLE_LSP": "true" // Optional: Enable Language Server Protocol support
      }
    }
  }
}
  1. LSP功能包括通用语言服务器的默认配置:
  • Types/JavaScript: typescript-language-server --stdio
  • HTML: vscode-html-language-server --stdio
  • CSS: vscode-css-language-server --stdio
  • JSON: vscode-json-language-server --stdio

如果需要,您可以覆盖这些默认值:

{
  "mcpServers": {
    "package-docs": {
      "command": "npx",
      "args": ["-y", "mcp-package-docs"],
      "env": {
        "ENABLE_LSP": "true",
        "TYPESCRIPT_SERVER": "{\"command\":\"/custom/path/typescript-language-server\",\"args\":[\"--stdio\"]}"
      }
    }
  }
}
  1. 服务器提供以下工具:

lookup_go_doc/descripte_go_package

Fetches Go软件包文档

{
  "name": "describe_go_package",
  "arguments": {
    "package": "encoding/json", // required
    "symbol": "Marshal"        // optional
  }
}

lookup_python.doc/describe_python_package

获取Python包文档

{
  "name": "describe_python_package",
  "arguments": {
    "package": "requests",    // required
    "symbol": "get"          // optional
  }
}

describe_rust_package

从crates.io和docs.rs获取Rust板条箱文档

{
  "name": "describe_rust_package",
  "arguments": {
    "package": "serde",      // required: crate name
    "version": "1.0.219"     // optional: specific version
  }
}

search_package_docs

在软件包文档中搜索

{
  "name": "search_package_docs",
  "arguments": {
    "package": "requests",    // required: package name
    "query": "authentication", // required: search query
    "language": "python",     // required: "go", "python", "npm", "swift", or "rust"
    "fuzzy": true            // optional: enable fuzzy matching (default: true)
  }
}

lookup_npm_doc/descripte_npm_package

从公共和私有注册表获取NPM包文档。根据您的.npmrc配置自动使用适当的注册表。

{
  "name": "describe_npm_package",
  "arguments": {
    "package": "axios",      // required - supports both scoped (@org/pkg) and unscoped packages
    "version": "1.6.0"       // optional
  }
}

该工具读取您的~/.npmrc文件,以确定每个包的正确注册表:

  • 使用作用域注册表配置(例如@mycompany:registry=…)
  • 支持私有注册表(GitHub软件包、GitLab、Nexus、Artifactory等)
  • 如果没有配置自定义注册表,则返回默认的npm注册表

示例.npmrc配置:

registry=https://nexus.mycompany.com/repository/npm-group/
@mycompany:registry=https://nexus.mycompany.com/repository/npm-private/
@mycompany-ct:registry=https://npm.pkg.github.com/

语言服务器协议(LSP)工具

启用LSP支持后,以下附加工具可用:

get_hover

获取文档中某个位置的悬停信息

{
  "name": "get_hover",
  "arguments": {
    "languageId": "typescript", // required: language identifier (e.g., "typescript", "javascript")
    "filePath": "src/index.ts", // required: path to the source file
    "content": "const x = 1;",  // required: content of the file
    "line": 0,                  // required: zero-based line number
    "character": 6,             // required: zero-based character position
    "projectRoot": "/path/to/project" // optional: project root directory
  }
}

get_完成

在文档中获取职位的完成建议

{
  "name": "get_completions",
  "arguments": {
    "languageId": "typescript", // required: language identifier
    "filePath": "src/index.ts", // required: path to the source file
    "content": "const arr = []; arr.",  // required: content of the file
    "line": 0,                  // required: zero-based line number
    "character": 16,            // required: zero-based character position
    "projectRoot": "/path/to/project" // optional: project root directory
  }
}

get_诊断学

获取文档的诊断信息(错误、警告)

{
  "name": "get_diagnostics",
  "arguments": {
    "languageId": "typescript", // required: language identifier
    "filePath": "src/index.ts", // required: path to the source file
    "content": "const x: string = 1;",  // required: content of the file
    "projectRoot": "/path/to/project" // optional: project root directory
  }
}

LLM中的示例用法

查找文档

// Looking up Go documentation
const goDocResult = await use_mcp_tool({
  server_name: "package-docs",
  tool_name: "describe_go_package",
  arguments: {
    package: "encoding/json",
    symbol: "Marshal"
  }
});

// Looking up Python documentation
const pythonDocResult = await use_mcp_tool({
  server_name: "package-docs",
  tool_name: "describe_python_package",
  arguments: {
    package: "requests",
    symbol: "post"
  }
});

// Looking up Rust documentation
const rustDocResult = await use_mcp_tool({
  server_name: "package-docs",
  tool_name: "describe_rust_package",
  arguments: {
    package: "serde"
  }
});

// Searching within documentation
const searchResult = await use_mcp_tool({
  server_name: "package-docs",
  tool_name: "search_package_docs",
  arguments: {
    package: "serde",
    query: "serialize",
    language: "rust",
    fuzzy: true
  }
});

// Using LSP for hover information (when LSP is enabled)
const hoverResult = await use_mcp_tool({
  server_name: "package-docs",
  tool_name: "get_hover",
  arguments: {
    languageId: "typescript",
    filePath: "src/index.ts",
    content: "const axios = require('axios');\naxios.get",
    line: 1,
    character: 7
  }
});

需求

  • Node.js>=20
  • Go(用于Go包文档)
  • Python 3(用于Python包文档)
  • 互联网连接(用于NPM包文档和Rust crate文档)
  • 语言服务器(用于LSP功能):

- Types/JavaScript: npm install -g typescript-language-server typescript - HTML/CSS/JSON: npm install -g vscode-langservers-extracted

发展

# Install dependencies
npm i

# Build
npm run build

# Watch mode
npm run watch

贡献

  1. 分叉存储库
  2. 创建功能分支(git checkout -b feature/amazing-feature)
  3. 提交您的更改(git commit -m 'Add some amazing feature')
  4. 推到分支(git push origin feature/amazing-feature)
  5. 打开拉取请求

许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

目录标签

目录标签

TypeScript性能优化文档处理多语言支持本地部署文档解析高级搜索语言服务器协议

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

mcp-package-docs

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP