Supports configuration via .env files for setting API keys and other environment variables
Supports installation via git clone, allowing users to easily download the MCP server
Allows fetching the MCP server code from the GitHub repository
Supports MDX document format for storing and retrieving documentation
Integrates with OpenAI's Embeddings API to enable semantic search of documents based on meaning rather than exact text matching
Includes test suite that can be run with pytest to verify functionality
Built with Python and includes Python scripts for metadata generation
docs-mcp
ユーザーが設定したドキュメントを効率的に検索・参照できるMCPサーバーです。
主な機能
- 📄 ドキュメント一覧表示 - すべてのドキュメントとその説明を一覧表示
- 🔍 grep検索 - 正規表現を使った高速な全文検索
- 🧠 セマンティック検索 - OpenAI Embeddingsを使った意味的な類似検索
- 📝 ドキュメント取得 - 指定したドキュメントの全内容を取得
必要な環境
- uv (install方法はこちら)
- OpenAI APIキー(セマンティック検索を使用する場合)
インストール
セットアップ
1. 環境変数を設定
2. ドキュメントを配置
docs/
ディレクトリにドキュメントを配置します。デフォルトでは、以下の拡張子のファイルが読み込まれます:
- ドキュメント系:
.md
,.mdx
,.txt
,.rst
,.asciidoc
,.org
- 設定・データ系:
.json
,.yaml
,.yml
,.toml
,.ini
,.cfg
,.conf
,.xml
,.csv
- プログラミング言語:
.py
,.js
,.jsx
,.ts
,.tsx
,.java
,.cpp
,.c
,.h
,.go
,.rs
,.rb
,.php
など - スクリプト:
.sh
,.bash
,.zsh
,.ps1
,.bat
- Web系:
.html
,.css
,.scss
,.vue
,.svelte
- その他:
.sql
,.graphql
,.proto
,.ipynb
,.dockerfile
,.gitignore
など
例 (docs以下のフォルダ名はなんでもOKです。)
3. メタデータを生成(推奨)
これにより以下のファイルが生成されます:
docs_metadata.json
- 各ドキュメントの1行説明docs_embeddings.json
- セマンティック検索用のベクトルデータ
注意: このステップをスキップした場合:
list_docs
コマンドはファイルパスのみを表示します(説明文なし)semantic_search
コマンドは使用できません
新しいドキュメントを追加した場合も同じコマンドを実行してください。
MCPの設定json例
基本設定(すべてのドキュメントを読み込む)
フォルダを指定して読み込む
環境変数DOCS_FOLDERS
を使用して、特定のフォルダのみを読み込むことができます:
複数のプロジェクトを管理する場合、異なるサーバー名で複数の設定を作成できます。
カスタムファイル拡張子の設定
デフォルトで多くのファイル形式に対応していますが、特定の拡張子のみを対象にしたい場合は、環境変数DOCS_FILE_EXTENSIONS
で指定できます:
拡張子はカンマ区切りで指定し、ドット(.)は省略可能です。この設定はgenerate_metadata.py
スクリプトでも同様に機能します。
テスト
テストを実行するには:
スクリプト
URLからドキュメントをインポート
WebサイトのドキュメントをMarkdown形式で高速にインポートできます。並列ダウンロード機能により、大量のページも効率的に取得可能です。
主な特徴:
- 🚀 並列ダウンロード(デフォルト10並列)で高速化
- 📊 プログレスバーでダウンロード・保存状況を可視化
- 🌏 日本語URLを適切にデコードしてファイル名に変換
- 🌲 URLのパス構造を維持したディレクトリツリーで保存
オプション:
--output-dir
,-o
: 出力先ディレクトリ(デフォルト:imported
)--depth
,-d
: クロールの深さ(デフォルト: 2)--include-pattern
,-i
: 含めるURLパターン(正規表現、複数指定可)--exclude-pattern
,-e
: 除外するURLパターン(正規表現、複数指定可)--concurrent
,-c
: 同時ダウンロード数(デフォルト: 10)--timeout
: タイムアウト(秒、デフォルト: 30)--rate-limit
: レート制限(秒、デフォルト: 0.1)
使用例:
インポート後はgenerate_metadata.py
を実行してメタデータを更新してください。
GitHubリポジトリからインポート
GitHubリポジトリの特定フォルダ以下のファイルをローカルに取得できます。
主な特徴:
- 📁 指定したフォルダ以下を再帰的に取得
- 🚀 並列ダウンロードで高速化
- 🔑 GitHub Personal Access Token対応(レート制限回避)
- 🎯 ファイルパターンによるフィルタリング
オプション:
--output-dir
,-o
: 出力先ディレクトリ(デフォルト:github
)--token
,-t
: GitHub Personal Access Token(環境変数GITHUB_TOKEN
でも設定可)--include-pattern
,-i
: 含めるファイルパターン(正規表現、複数指定可)--exclude-pattern
,-e
: 除外するファイルパターン(正規表現、複数指定可)--concurrent
,-c
: 同時ダウンロード数(デフォルト: 10)--timeout
: タイムアウト(秒、デフォルト: 30)--rate-limit
: レート制限(秒、デフォルト: 0.1)
使用例:
インポート後はgenerate_metadata.py
を実行してメタデータを更新してください。
利用可能なMCPツール
list_docs
すべてのドキュメントの一覧を取得
- メタデータ生成済み:
ファイルパス - 説明文
の形式で表示 - メタデータ未生成:
ファイルパス
のみ表示
get_doc
指定したドキュメントの全内容を取得
- 引数:
path
- ドキュメントのファイルパス
grep_docs
正規表現でドキュメント内を検索
- 引数:
pattern
- 検索パターン、ignore_case
- 大文字小文字を無視(デフォルト: true)
semantic_search
意味的に関連する内容を検索
- 引数:
query
- 検索クエリ、limit
- 結果数(デフォルト: 5) - 注意:
generate_metadata.py
を実行していない場合は使用できません
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
An MCP server that allows users to efficiently search and reference user-configured documents through document listing, grep searching, semantic searching with OpenAI Embeddings, and full document retrieval.
Related MCP Servers
- AsecurityAlicenseAqualityAn MCP server implementation that provides tools for retrieving and processing documentation through vector search, enabling AI assistants to augment their responses with relevant documentation contextLast updated -76281TypeScriptMIT License
- -securityAlicense-qualityAn MCP server implementation that provides tools for retrieving and processing documentation through vector search, enabling AI assistants to augment their responses with relevant documentation context. Uses Ollama or OpenAI to generate embeddings. Docker files includedLast updated -5920TypeScriptMIT License
- -securityFlicense-qualityAn MCP server that integrates with SerpApi to retrieve search results from multiple search engines including Google, Bing, Yahoo, and others, enabling fast access to both live and archived search data.Last updated -Python
- -securityFlicense-qualityAn MCP server that enables AI models to search the web using OpenAI's 4o-mini Search model, allowing access to up-to-date information for just a few cents per search.Last updated -1JavaScript