
my docs mcp server
A lightweight MCP server that indexes and searches Markdown files in a specified directory, providing full-text search and file retrieval via the Model Context Protocol.
Repository Info
About This Server
A lightweight MCP server that indexes and searches Markdown files in a specified directory, providing full-text search and file retrieval via the Model Context Protocol.
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
my-docs-mcp-server
概要
このMCPサーバーは、指定したディレクトリ配下のMarkdown(.md)ファイルを全文検索インデックス化し、MCPプロトコル経由で検索・参照できるMCPサーバーです。
- MCPの
toolsとして全文検索(search_docs)を提供 - MCPの
resourcesとしてファイル全文取得(read_doc)を提供 - TypeScript製
技術スタック・実装技術
- TypeScript: サーバー本体の実装言語。
- @modelcontextprotocol/sdk: MCPサーバーのプロトコル実装・通信に利用。
- MiniSearch: Markdownファイルの全文検索インデックス作成・検索に利用。軽量で高速な全文検索ライブラリ。
- wakachigaki: 日本語テキストを分かち書き(トークナイズ)する軽量ライブラリ。MiniSearchのトークナイザとして利用し、日本語検索の精度を大幅に向上。
- fast-glob: docsディレクトリ配下のMarkdownファイルを再帰的に探索。
- Node.js標準のfs/promises, path: ファイル読み込みやパス操作。
- Stdioサーバー: MCPクライアント(Claude DesktopやInspector等)と標準入出力経由で通信。
セットアップ
- 依存パッケージのインストール
npm install
- docsディレクトリの作成とMarkdownファイルの配置
mkdir docs
# 例: サンプルファイル作成
echo "# サンプル\nこれはテストです。" > docs/sample.md
- TypeScriptビルド
npm run build
サーバーの起動方法
開発用(TypeScriptを直接実行)
npm run dev -- [docsディレクトリのパス]
# 例: npm run dev -- ./docs
本番用(ビルド済みで実行)
npm start -- [docsディレクトリのパス]
# 例: npm start -- ./docs
docsディレクトリのパスは省略可能(省略時はdocs/が使われます)
MCP Inspectorでの動作確認
MCP Inspectorを使うと、GUIでサーバーのtools/resourcesをテストできます。
npm run inspect -- [docsディレクトリのパス]
# 例: npm run inspect -- ./docs
またはビルド済みで:
npx -y @modelcontextprotocol/inspector node build/index.js ./docs
Claude Desktopでの利用例
- Claude Desktopの設定ファイル(例:
~/Library/Application Support/Claude/claude_desktop_config.json)を開き、以下のようにサーバーを追加します。
{
"mcpServers": {
"docs-search": {
"command": "node",
"args": [
"/path/to/docs-search/build/index.js",
"/path/to/your-project/docs"
]
}
}
}
commandはnode、argsにビルド済みサーバーのパスとdocsディレクトリのパスを指定してください。- パスは絶対パス推奨です。
- Claude Desktopを再起動すると、MCPツール一覧に
search_docsが表示されます。
提供ツール・リソース
Tool: search_docs
- 概要: Markdownファイルを全文検索(日本語は分かち書きトークナイズで高精度検索)
- 入力:
query(検索ワード, 必須)、limit(最大件数, 省略可, デフォルト5) - 出力: 検索結果(ファイル名、パス、スニペット)
- 備考: 検索クエリ・本文ともにwakachigakiで分かち書きし、自然な日本語検索が可能です。
Resource: read_doc
- 概要: ファイル全文取得
- 入力:
filePath(MCPリソースURI経由で指定) - 出力: ファイル全文
ログ
サーバーは主要な処理ごとに標準エラー出力(stderr)へ詳細なログを出力します。
ライセンス
MIT
Quick Start
Clone the repository
git clone https://github.com/kbyk004/my-docs-mcp-serverInstall dependencies
cd my-docs-mcp-server
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.