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

VS CodeCursor

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

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 control
  • setup_project - Index multiple libraries at once and create a named stack
  • read_url - Fetch and parse any documentation URL into clean text
  • list_libraries - List indexed libraries with pagination support
  • get_indexing_status - Check indexing progress for a library
  • list_stacks - List saved project stacks for scoped search

search_docs

The primary search tool. Returns ranked, token-budgeted documentation results.

Parameters

ParameterTypeRequiredDescription
querystringYesSearch query text
librarystringNoLibrary name (e.g. "django", "react", "tokio")
depthstringNo"normal" (default) or "deep" for comprehensive results
limitnumberNoMax results (1-50)
max_tokensnumberNoToken budget for response
versionstringNoFilter by library version
session_idstringNoSession ID for cross-query deduplication
stackstringNoRestrict search to libraries in a saved stack
kindstringNoFilter by snippet kind: api, guide, example, readme, changelog
languagestringNoFilter by code block language in snippets
ecosystemstringNoFilter by ecosystem: pypi, npm, rust, go, hex, ruby, dart, java

Examples

Search the Django docs for how to filter querysets

The AI assistant calls search_docs with query: "how to filter querysets" and library: "django".

Do a deep search of the tokio docs for task spawning patterns

Deep mode returns more results grouped by topic, ideal for comprehensive research.

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:

  1. Cache — Sub-millisecond return for repeated queries
  2. BM25 — Full-text search with TF-IDF ranking via Tantivy
  3. Cross-Encoder — Neural reranking for semantic precision
  4. Token Budget — Smart truncation respecting your LLM’s context window
  5. 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

ParameterTypeRequiredDescription
librariesstring[]YesList of library names to index
namestringNoOptional 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

  1. Each library name is resolved to its ecosystem
  2. Documentation is fetched and indexed in parallel
  3. A named stack is created linking all libraries
  4. Future search_docs calls 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

ParameterTypeRequiredDescription
urlstringYesHTTPS URL to fetch and parse
max_tokensnumberNoMaximum 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

  1. Fetches the URL content via HTTPS
  2. Parses HTML into clean Markdown text
  3. Strips navigation, headers, footers, and boilerplate
  4. Truncates to the specified token budget
  5. Returns clean, readable text optimized for LLM consumption

Use Cases

  • Reading a specific API reference page you’ve already found
  • Following links from search_docs results
  • 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

ParameterTypeRequiredDescription
ecosystemstringNoFilter by ecosystem (pypi, npm, rust, go, hex, ruby, dart, java)
limitnumberNoMax results per page (default 50, max 200)
offsetnumberNoPagination 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

ParameterTypeRequiredDescription
librarystringYesLibrary name or full ID (e.g. "django" or "pypi/django")

Example

{
  "library": "react"
}

Notes

  • Returns queue position when available.
  • Returns Not indexed when 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

  1. Run setup_project once for a codebase.
  2. Use list_stacks to discover available stack names.
  3. Pass stack to search_docs for 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:

  1. Searches across all ecosystem registries
  2. Matches the library name to the correct source
  3. 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".