Getting Started
DocSnippet is an MCP server that provides AI coding assistants with fast, accurate documentation search across Rust, npm, PyPI, Go, Elixir/Hex, Ruby, Dart/Flutter, and Java ecosystems.
One-Click Install
Manual Configuration
Or add the DocSnippet MCP server to your editor’s configuration manually:
Claude Code
Add to your .mcp.json:
{
"mcpServers": {
"docsnippet": {
"url": "https://cloud.docsnippet.com/mcp"
}
}
}
Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"docsnippet": {
"url": "https://cloud.docsnippet.com/mcp"
}
}
}
VS Code
Add to .vscode/mcp.json:
{
"servers": {
"docsnippet": {
"url": "https://cloud.docsnippet.com/mcp"
}
}
}
Your First Search
Once installed, just ask your AI assistant to search documentation:
Search the Django docs for how to filter querysets
DocSnippet automatically detects the ecosystem, indexes the library on first use, and returns ranked, token-budgeted results.
Available Tools
DocSnippet provides these MCP tools:
search_docs- Search library documentation with optional library scoping and depth controlsetup_project- Index multiple libraries at once and create a named stackread_url- Fetch and parse any documentation URL into clean textlist_libraries- List indexed libraries with pagination supportget_indexing_status- Check indexing progress for a librarylist_stacks- List saved project stacks for scoped search
search_docs
The primary search tool. Returns ranked, token-budgeted documentation results.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search query text |
library | string | No | Library name (e.g. "django", "react", "tokio") |
depth | string | No | "normal" (default) or "deep" for comprehensive results |
limit | number | No | Max results (1-50) |
max_tokens | number | No | Token budget for response |
version | string | No | Filter by library version |
session_id | string | No | Session ID for cross-query deduplication |
stack | string | No | Restrict search to libraries in a saved stack |
kind | string | No | Filter by snippet kind: api, guide, example, readme, changelog |
language | string | No | Filter by code block language in snippets |
ecosystem | string | No | Filter by ecosystem: pypi, npm, rust, go, hex, ruby, dart, java |
Examples
Basic search
Search the Django docs for how to filter querysets
The AI assistant calls search_docs with query: "how to filter querysets" and library: "django".
Deep search
Do a deep search of the tokio docs for task spawning patterns
Deep mode returns more results grouped by topic, ideal for comprehensive research.
Version-specific search
Search the React 18 docs for Suspense
Pass version: "18" to filter results to a specific library version.
How Results Are Ranked
Results pass through DocSnippet’s 5-layer cascade:
- Cache — Sub-millisecond return for repeated queries
- BM25 — Full-text search with TF-IDF ranking via Tantivy
- Cross-Encoder — Neural reranking for semantic precision
- Token Budget — Smart truncation respecting your LLM’s context window
- Session Dedup — Eliminates duplicates across conversation turns
Auto-Indexing
Libraries are indexed on first search. DocSnippet auto-detects the ecosystem:
- Rust — Fetches from docs.rs
- JavaScript — Fetches from npm README and package docs
- Python — Fetches from PyPI and associated documentation
- Go — Fetches from pkg.go.dev
- Elixir — Fetches from hexdocs.pm
- Ruby — Fetches from rubygems.org documentation pages
- Dart/Flutter — Fetches from pub.dev
- Java — Fetches from Javadoc / Maven sources
Subsequent searches use the cached index for fast retrieval.
setup_project
Index all your project’s dependencies at once. Creates a named stack for scoped searches.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
libraries | string[] | Yes | List of library names to index |
name | string | No | Optional project/stack name |
Examples
Index project dependencies
Set up a project with django, celery, and redis-py
The AI assistant calls setup_project with:
{
"libraries": ["django", "celery", "redis-py"],
"name": "my-backend"
}
Mixed ecosystem project
Index react, typescript, and tailwindcss for my frontend project
DocSnippet auto-detects each library’s ecosystem. You can mix libraries from Rust, npm, PyPI, Go, Hex, Ruby, Dart, and Java in a single project.
How It Works
- Each library name is resolved to its ecosystem
- Documentation is fetched and indexed in parallel
- A named stack is created linking all libraries
- Future
search_docscalls can search across the entire stack
Tips
- Use bare library names like
"django"— no ecosystem prefix needed - You can also use full IDs like
"pypi/django"if needed - Libraries that are already indexed will skip the fetch step
- Stack names help organize searches across multiple projects
read_url
Fetch a specific documentation page and parse it into clean, LLM-friendly text.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | HTTPS URL to fetch and parse |
max_tokens | number | No | Maximum tokens to return (default 1500) |
Examples
Read a specific docs page
Read the Axum routing documentation at https://docs.rs/axum/latest/axum/routing/index.html
Read with a token budget
Read https://react.dev/reference/react/useState but limit to 1000 tokens
How It Works
- Fetches the URL content via HTTPS
- Parses HTML into clean Markdown text
- Strips navigation, headers, footers, and boilerplate
- Truncates to the specified token budget
- Returns clean, readable text optimized for LLM consumption
Use Cases
- Reading a specific API reference page you’ve already found
- Following links from
search_docsresults - Parsing changelog or migration guide pages
- Reading README files from repository URLs
list_libraries
List all indexed libraries, with optional ecosystem filtering and offset-based pagination.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ecosystem | string | No | Filter by ecosystem (pypi, npm, rust, go, hex, ruby, dart, java) |
limit | number | No | Max results per page (default 50, max 200) |
offset | number | No | Pagination offset (default 0) |
Examples
List all indexed libraries
{}
List only npm libraries
{
"ecosystem": "npm",
"limit": 50,
"offset": 0
}
Fetch next page
{
"limit": 200,
"offset": 200
} get_indexing_status
Check indexing progress for a library by name or full ID.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
library | string | Yes | Library name or full ID (e.g. "django" or "pypi/django") |
Example
{
"library": "react"
}
Notes
- Returns queue position when available.
- Returns
Not indexedwhen indexing has not been started. - Useful for polling after first-time auto-indexing.
list_stacks
List all stacks that were created with setup_project.
Parameters
This tool takes no parameters:
{}
What It Returns
- Stack names
- Library count per stack
- Libraries included in each stack
Workflow Tip
- Run
setup_projectonce for a codebase. - Use
list_stacksto discover available stack names. - Pass
stacktosearch_docsfor scoped search.
Supported Ecosystems
DocSnippet indexes documentation across multiple ecosystems. Each uses a source-specific crawler and parser.
Rust (docs.rs)
- Source: docs.rs API documentation
- Resolution: Crate names resolve directly (e.g.,
"tokio","serde","axum") - Content: Module docs, struct/enum/trait definitions, function signatures, examples
Search tokio docs for async runtime configuration
JavaScript (npm)
- Source: npm package READMEs and linked documentation
- Resolution: Package names resolve directly (e.g.,
"react","express","zod") - Content: README content, API references, usage examples
Search react docs for useEffect cleanup
Python (PyPI)
- Source: PyPI package metadata and linked documentation sites
- Resolution: Package names resolve directly (e.g.,
"django","flask","pydantic") - Content: Package docs, API references, tutorials
Search django docs for model field types
Go (pkg.go.dev)
- Source: pkg.go.dev documentation
- Resolution: Module/package paths (e.g.,
"github.com/gin-gonic/gin") - Content: Package docs, exported API, examples
Elixir (Hex)
- Source: hexdocs.pm
- Resolution: Package names (e.g.,
"phoenix","ecto") - Content: Guides, API docs, module references
Ruby (RubyGems)
- Source: RubyGems metadata and linked docs
- Resolution: Gem names (e.g.,
"rails","sidekiq") - Content: API docs, guides, examples
Dart / Flutter (pub.dev)
- Source: pub.dev package docs
- Resolution: Package names (e.g.,
"dio","riverpod") - Content: API references, usage guides, snippets
Java (Javadoc / Maven)
- Source: Javadoc sites and Maven-linked docs
- Resolution: Package/artifact names (e.g.,
"spring-boot") - Content: Class references, method docs, examples
Ecosystem Auto-Detection
You don’t need to specify which ecosystem a library belongs to. DocSnippet automatically:
- Searches across all ecosystem registries
- Matches the library name to the correct source
- Fetches and indexes from the appropriate documentation site
If a name exists in multiple ecosystems, you can disambiguate with a prefix: "pypi/requests" vs "npm/requests".