Skip to main content
Glama
sammcj
by sammcj

パッケージドキュメント MCP サーバー

複数のプログラミング言語と言語サーバー プロトコル (LSP) 機能にわたるパッケージ ドキュメントへの効率的なアクセスを LLM に提供する MCP (モデル コンテキスト プロトコル) サーバー。

鍛冶屋のバッジ

特徴

  • 多言語サポート:

    • go doc経由のGoパッケージ

    • 組み込みのhelp()経由の Python ライブラリ

    • レジストリドキュメント経由の NPM パッケージ (プライベートレジストリを含む)

    • crates.io と docs.rs 経由の Rust クレート

  • スマートドキュメント解析:

    • 説明、使用法、例を含む構造化された出力

    • コンテキストの過負荷を避けるための焦点を絞った情報

    • 特定のシンボル/関数の検索のサポート

    • ドキュメント全体にわたるあいまい検索と正確な検索機能

  • 高度な検索機能:

    • パッケージドキュメント内を検索

    • 柔軟なクエリのためのあいまい一致

    • 関連性スコアリングによるコンテキスト認識結果

    • 検索結果からのシンボル抽出

  • 言語サーバープロトコル (LSP) サポート:

    • コードシンボルのホバー情報

    • コード補完

    • 診断(エラーと警告)

    • 現在TypeScript/JavaScriptをサポート

    • 他の言語にも拡張可能

  • パフォーマンスの最適化:

    • 組み込みキャッシュ

    • 効率的な解析

    • 最小限のメモリフットプリント

Related MCP server: DocsFetcher MCP Server

インストール

npx -y mcp-package-docs

Smithery経由でインストール

Smithery経由で Claude Desktop のパッケージドキュメントを自動的にインストールするには:

npx -y @smithery/cli install mcp-package-docs --client claude

使用法

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 機能には、共通言語サーバーのデフォルト構成が含まれます。

  • TypeScript/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. サーバーは次のツールを提供します。

go_doc の参照 / go_package の説明

Go パッケージのドキュメントを取得します

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

Pythonドキュメントの検索 / Pythonパッケージの説明

Python パッケージのドキュメントを取得します

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

Rustパッケージの説明

crates.io と docs.rs から Rust クレートドキュメントを取得します。

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

検索パッケージドキュメント

パッケージドキュメント内を検索

{
  "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)
  }
}

npmドキュメントの検索 / npmパッケージの説明

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 Packages、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 サポートを有効にすると、次の追加ツールが使用できるようになります。

ゲットホバー

ドキュメント内の位置のホバー情報を取得する

{
  "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_completeions

文書内の位置の補完候補を取得する

{
  "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
  }
}

診断情報を取得する

ドキュメントの診断情報(エラー、警告)を取得する

{
  "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 クレートドキュメント用)

  • 言語サーバー(LSP機能用):

    • TypeScript/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 ライセンスに基づいてライセンスされています - 詳細についてはLICENSEファイルを参照してください。

-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

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/sammcj/mcp-package-docs'

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