diamond
Enables AI assistants to search and read offline documentation from synced libraries via MCP tools, providing hybrid keyword and semantic search without network calls.
README
Diamond
I got tired of watching an AI agent make fourteen tool calls to resolve a TanStack issue.
Diamond is a documentation registry and MCP server. It crawls a docs site once, stores the content locally, and serves it to your AI assistant on demand — no network call, no hallucinated APIs, no nonsense.
Inspired by pnpm.
If you like it, well then, I made this for you.
Quick Start
# get the code
git clone https://github.com/elmojones3/diamond.git
# navigate to it
cd diamond
# install dependencies
pnpm install
# (optional) makes `diamond` available globally
pnpm link --global
# Sync a library's docs
diamond sync https://mswjs.io/docs --key msw --recursive
# Install as an MCP server (Claude Code, Claude Desktop, Cursor, Gemini CLI, or Codex)
diamond install --claude-code
# Start MCP over stdio (used by MCP hosts)
diamond mcp
# Or run a persistent local HTTP MCP endpoint
diamond serve --port 65535 --bg
That's it. Your AI assistant now has offline access to MSW's documentation.
How It Works
1. Crawl with a real browser.
Diamond uses Playwright to render pages the same way Chrome does. It waits for JavaScript frameworks to hydrate, then clicks through tab panels and code switchers to capture content that plain scrapers miss. It respects robots.txt and identifies as DiamondCrawler.
2. Extract the signal.
Mozilla Readability (the Firefox Reader View engine) strips navbars, sidebars, and footers. dom-to-semantic-markdown converts the clean HTML to structured Markdown that LLMs read well.
3. Hybrid Search (Keyword + Semantic).
Diamond builds two indices for every library: a fast MiniSearch keyword index and a semantic vector index using all-MiniLM-L6-v2. This allows your AI to find exact technical terms and conceptually related content (e.g. searching for "problems" finds "Error Handling") fully offline.
4. Store without duplication. Content is hashed with SHA-256 and stored once, regardless of how many library versions reference it. Versioned directories are hardlinks into this store, so multiple versions cost almost nothing extra.
5. Serve over MCP.
diamond mcp (stdio) or diamond serve (HTTP) exposes everything to any MCP-compatible AI host via tools and resource URIs:
docs://msw/latest/api/handlers ← read a specific page
repo://my-library/src/index.ts ← read a file from a local repo
CLI
# Sync docs into the registry (use this for MCP access)
diamond sync <url> --key <name> --recursive
# One-shot crawl to a local directory (no registry)
diamond crawl <url> --key <name> --recursive
# Start MCP over stdio (for host-managed MCP processes)
diamond mcp
# Start persistent HTTP MCP server
diamond serve --port 65535
# Run persistent HTTP MCP server in the background
diamond serve --bg
# Inspect running background server and tail logs
diamond view server
# Register a local git repository (immediately indexed and searchable)
diamond repo add <path> --key <name>
# Watch registered repos and keep their indices up to date as files change
diamond watch
# Remove a library or repo from the registry (reclaims disk space for docs)
diamond remove <id>
# Automatic MCP configuration
diamond install --claude-code --claude-desktop --cursor --gemini-cli --codex
Which Server Command Should I Use?
- Use
diamond mcpfor Claude Code, Cursor, Codex, and other MCP hosts that spawn a stdio MCP process. - Use
diamond servewhen you want a persistent local HTTP endpoint (http://127.0.0.1:<port>/mcp), including daemon mode via--bg. diamond servedefaults to port65535; override with--portorDIAMOND_PORT.
MCP Tools
Once your MCP host is configured with diamond mcp (or you run diamond serve for HTTP), your AI assistant has access to:
| Tool | What it does |
|---|---|
list_registry |
List all synced libraries and repos |
sync_docs |
Crawl and sync a library (callable from the AI) |
search_library |
Hybrid search (keyword + semantic) across docs or repos |
remove_library |
Remove a library or repo from the registry |
MCP Setup
You can use diamond install to automatically configure your tools, or manually edit your configuration files:
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"diamond": {
"command": "diamond",
"args": ["mcp"]
}
}
}
Cursor (.cursor/mcp.json):
{
"mcpServers": {
"diamond": {
"command": "diamond",
"args": ["mcp"]
}
}
}
Codex (~/.codex/config.toml):
[mcp_servers.diamond]
command = "diamond"
args = ["mcp"]
Storage Layout
Diamond follows the XDG Base Directory Specification. Override any path with the standard XDG environment variables.
~/.config/diamond/registry.json ← manifest of all synced libraries
~/.local/share/diamond/store/ ← content-addressable store (SHA-256)
~/.local/share/diamond/storage/ ← versioned views (hardlinked from store)
Requirements
- Node.js 22+
- pnpm
- Playwright / Chromium — on first use, run
npx playwright install chromium
Contributing
Contributions are welcome. See CONTRIBUTING.md to get started.
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。