Skip to main content
Glama

roku-docs-mcp

PyPI version Python 3.10+ License: MIT

MCP server for Roku developer documentation. Search and browse developer.roku.com locally with full-text search — no internet required after the initial crawl.

Built for use with Claude Code while developing Roku channels in BrightScript and SceneGraph.

Why this exists

developer.roku.com is a JavaScript SPA. Standard web fetching tools can't read it reliably. This server crawls it once with Playwright (via crawl4ai), stores all ~1000 pages in a local SQLite database with FTS5 full-text search, and exposes them through an MCP interface.

Related MCP server: docs-mcp

Features

  • 6 MCP tools — search, section-filtered search, page retrieval, section listing, cache stats, and cache refresh

  • FTS5 full-text search with BM25 ranking — instant results from local SQLite

  • Incremental recrawl — skips unchanged pages via content hash; only updates new or modified docs

  • CLI interface — roku-docs-mcp serve / crawl / search / stats / check

  • Auto-refresh daemon — optional background thread that checks freshness and re-crawls automatically (serve --auto-refresh)

  • Freshness check — roku-docs-mcp check exits 0 (fresh) or 1 (stale), ideal for external cron jobs

  • WAL mode — SQLite write-ahead logging for concurrent read performance

  • No internet after first crawl — all ~1000 docs pages stored locally

Installation

pip (persistent install)

pip install roku-docs-mcp
crawl4ai-setup   # downloads headless Chromium (~150 MB, one-time)

uvx (no setup needed, runs in ephemeral env)

uvx --from roku-docs-mcp roku-docs-mcp serve

Note: With uvx, run crawl4ai-setup inside the same environment first, or use the pip install method.

Populate the cache (first run)

Crawls developer.roku.com and stores all docs locally. Takes 15–30 minutes.

roku-docs-mcp crawl

The database is stored at ~/.cache/roku-docs-mcp/docs.db by default.

Register with your AI assistant

Claude Code

claude mcp add --scope user roku-docs -- roku-docs-mcp serve

After registration, restart Claude Code. The tools will be available in every session.

Claude Desktop

Add to ~/.config/claude/claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "roku-docs": {
      "command": "roku-docs-mcp",
      "args": ["serve"]
    }
  }
}

VS Code / GitHub Copilot

Add to .vscode/settings.json in your workspace:

{
  "mcp": {
    "servers": {
      "roku-docs": {
        "type": "stdio",
        "command": "roku-docs-mcp",
        "args": ["serve"]
      }
    }
  }
}

Available tools

Tool

Description

search_docs

Full-text search across all cached pages (FTS5 BM25 ranking)

search_by_section

FTS5 search filtered to a specific documentation section

get_page

Retrieve full markdown content of a page by path

list_sections

List all documentation sections with page counts

get_stats

Return database statistics: total pages, DB size, last crawl date

refresh_cache

Re-crawl developer.roku.com and update the local cache

search_docs

search_docs(query: str, limit: int = 10) -> list[dict]

Supports FTS5 MATCH syntax. Examples:

  • "roSGNode" — find all pages mentioning roSGNode

  • "focus keyboard" — pages about focus and keyboard input

  • "Task node thread" — pages about Task nodes and threading

search_by_section

search_by_section(section: str, query: str, limit: int = 10) -> list[dict]

Search within a specific section of the docs. Use list_sections() to see available section names. Examples:

  • section="references", query="roUrlTransfer" — find roUrlTransfer in the API reference

  • section="developer-program", query="certification" — certification requirements

get_page

get_page(path: str) -> dict

Retrieve a page by its path (e.g. /docs/references/brightscript/components/rosgnode.md). Partial paths are matched with a fuzzy fallback.

Returns a dict with url, path, section, title, content, and crawled_at fields.

list_sections

list_sections() -> dict

Returns all sections and page counts, plus the timestamp of the last crawl.

get_stats

get_stats() -> dict

Returns database statistics: total_pages, db_size_mb, sections breakdown, and last_crawled.

refresh_cache

refresh_cache(max_depth: int = 10, max_pages: int = 2000) -> dict

Re-crawls developer.roku.com using incremental updates (skips unchanged pages). Use when Roku publishes new docs. Runs in a separate process to avoid event loop conflicts.

Returns {"saved": N, "skipped": M}.

CLI subcommands

roku-docs-mcp [serve|crawl|search|stats|check]

Subcommand

Description

serve

Start the MCP server (default when no subcommand given)

crawl

Crawl developer.roku.com and populate/update the local cache

search <query>

Search the local cache and print results as JSON

stats

Print cache statistics as JSON

check

Check cache freshness; exits 0 (fresh) or 1 (stale)

Options for crawl:

roku-docs-mcp crawl --max-depth 10 --max-pages 2000

Options for search:

roku-docs-mcp search "roSGNode focus" --limit 5

Options for serve:

# Enable background auto-refresh daemon (checks every 24h, refreshes if cache is >7 days old)
roku-docs-mcp serve --auto-refresh

# Customize thresholds
roku-docs-mcp serve --auto-refresh --auto-refresh-days 3 --check-interval-hours 12

Flag

Default

Description

--auto-refresh

off

Enable background staleness checker and auto-recrawl

--auto-refresh-days

7

Days before cache is considered stale

--check-interval-hours

24

Hours between staleness checks

Using check with external cron:

# Recrawl every Sunday at midnight if stale
0 0 * * 0 roku-docs-mcp check || roku-docs-mcp crawl

Environment variables

Variable

Default

Description

ROKU_DOCS_DB_PATH

~/.cache/roku-docs-mcp/docs.db

Path to the SQLite database

ROKU_DOCS_START_URL

https://developer.roku.com/en-gb/docs/developer-program/getting-started/roku-dev-prog.md

Starting URL for the BFS crawl

ROKU_DOCS_URL_PATTERN

*developer.roku.com*docs*.md

Glob pattern to filter crawled URLs

ROKU_DOCS_CONTENT_SELECTOR

div.markdown-body.developer-content-body

CSS selector for content extraction

ROKU_DOCS_MAX_CONTENT_SIZE

500000

Maximum content size in bytes per page

ROKU_DOCS_AUTO_REFRESH_DAYS

7

Days before cache is considered stale (used by serve --auto-refresh)

ROKU_DOCS_CHECK_INTERVAL_HOURS

24

Hours between staleness checks (used by serve --auto-refresh)

Architecture

developer.roku.com (SPA)
        │
        ▼ crawl4ai + Playwright (BFS, ~1000 pages)
        │
        ▼ BeautifulSoup (extract .developer-content-body)
        │
        ▼ DefaultMarkdownGenerator (HTML → Markdown)
        │
        ▼ SQLite + FTS5 (~/.cache/roku-docs-mcp/docs.db)
           WAL mode, 64 MB cache, content hash for incremental updates
        │
        ▼ FastMCP server (stdio transport)
        │
        ▼ Claude Code / Claude Desktop / VS Code

The crawl runs once and caches everything. Subsequent queries hit local SQLite only — instant results.

Development

git clone https://github.com/yourusername/roku-docs-mcp
cd roku-docs-mcp
python -m venv venv && source venv/bin/activate
pip install -e ".[dev]"
crawl4ai-setup

# Run tests
python -m pytest tests/ -v        # 112 tests

# Type checking
python -m mypy src/               # strict mode, zero errors

Troubleshooting

"No results found" after install Run roku-docs-mcp crawl first. The cache starts empty.

crawl4ai-setup fails Make sure you have enough disk space (~300 MB for Chromium). On some Linux systems you may need playwright install-deps.

MCP server not appearing in Claude Code Run claude mcp list to verify registration. Restart Claude Code after adding the server.

Crawl takes too long or times out Use --max-pages to limit the crawl: roku-docs-mcp crawl --max-pages 200. This crawls the most recently modified pages first.

Database locked errors The server uses WAL mode and per-thread connections. If you see lock errors, ensure you're not running multiple roku-docs-mcp serve instances pointing at the same database.

Credits & Acknowledgements

This project would not be possible without the official Roku developer documentation and the work of the Roku team in maintaining it.

All documentation content indexed by this tool is authored and owned by Roku, Inc. and is made available at developer.roku.com. This MCP server is an unofficial tool that crawls and caches that content locally to improve developer tooling — it does not redistribute or claim ownership of any Roku documentation.

Official Roku resources

Thank you to the Roku developer relations and documentation teams for maintaining such a comprehensive reference. If you find errors or outdated content, please report them directly to Roku via the developer portal.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      B
      maintenance
      MCP server for Roku BrightScript documentation and device control, enabling doc search, device introspection, keypress/keysequence input, app launch, and sideloading.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Indexes documentation sites by base URL and serves keyword search, optional semantic search, and Markdown page retrieval as MCP tools, all from a single SQLite file.
      -
    • A
      license
      A
      quality
      C
      maintenance
      Provides local, offline searchable access to Roku and BrightScript development documentation via MCP tools and resources, including full-text search, sectioned reading of large docs, and background syncing from the upstream repo.
      4
      1
      -
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to search, install, read, and navigate DevDocs documentation offline via MCP, with token-efficient search/read/toc tools and local caching.
      6
      1
      MIT