neuledge

Context

Community neuledge
Updated

Local-first documentation for AI agents

Context

Local-first documentation for AI agents Give your AI assistant expert knowledge of any library—offline, instant, private.

The Problem

You're building with Next.js 16, and your AI assistant confidently suggests code using the old Pages Router because that's what it learned from training data. You paste the docs. It hallucinates anyway. You paste more docs. The context window fills up. Repeat.

AI assistants are powerful, but they're stuck in the past. Their training data is months or years old, and they don't know the specifics of the libraries you're using today.

The Solution

Context connects your AI assistant directly to up-to-date documentation—locally, instantly, and privately.

You: "How do I create middleware in Next.js 16?"

AI:  [automatically queries local docs]
     "In Next.js 16, create a middleware.ts file in your project root..."
     [accurate, version-specific answer]

No copy-pasting. No hallucinations about deprecated APIs. No waiting for cloud lookups.

Real-World Use Cases

:muscle: "Make my AI actually useful for the stack I use"

Add docs for your entire tech stack. Your AI assistant becomes an expert in the exact versions you're using:

context add https://github.com/vercel/next.js
context add https://github.com/prisma/prisma
context add https://github.com/tailwindlabs/tailwindcss

Now ask things like:

  • "How do I set up Prisma with Next.js App Router?"
  • "What's the Tailwind config for dark mode?"
  • "Show me the new Server Actions syntax"

:building_construction: "Stop answering the same questions for my team"

Building an internal library? Package your documentation once, share it with your team:

# Build docs from your repo
context add https://github.com/your-company/design-system

# Your whole team can now ask:
# "How do I use the DataTable component?"
# "What props does Button accept?"

:airplane: "Code on flights and in coffee shops"

Context works 100% offline. Download docs once, query forever—no internet required.

:lock: "Keep proprietary code discussions private"

Cloud documentation services see your queries. Context runs entirely on your machine. Your questions about internal APIs stay internal.

Why Context Over Cloud Alternatives?

Context7 Deepcon Context
Price $10/month $8/month Free forever
Free tier 1,000 req/month ¹ 100 req/month Unlimited
Rate limits 60 req/hour Throttled None
Latency 100-500ms 100-300ms <10ms
Works offline :x: :x: :white_check_mark:
Privacy Queries sent to cloud Queries sent to cloud 100% local
Private repos $15/1M tokens :x: Free

¹ Context7 reduced free tier from ~6,000 to 1,000 requests/month in January 2026

:zap: Key Features

  • Single tool - One MCP tool does everything, no multi-step lookups
  • Token-aware - Smart relevance filtering, never overwhelms the context window
  • Dynamic schema - Available libraries shown in tool definition
  • Offline-first - Zero network calls during operation
  • SQLite + FTS5 - Fast full-text search with stemming

:rocket: Quick Start

1. Install

npm install -g @neuledge/context

2. Add documentation

# From any git repository (GitHub, GitLab, Bitbucket, etc.)
context add https://github.com/vercel/next.js
context add https://gitlab.com/org/repo
context add [email protected]:user/repo.git

# From a local directory
context add ./my-project
context add /path/to/docs

# From URL (pre-built package)
context add https://example.com/[email protected]

# From local file
context add ./my-package.db

3. Configure your AI agent

Context works with any MCP-compatible agent. Choose your setup below:

Claude Code
claude mcp add context -- context serve
Claude Desktop

Add to your config file:

  • Linux: ~/.config/claude/claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "context": {
      "command": "context",
      "args": ["serve"]
    }
  }
}

Restart Claude Desktop to apply changes.

Cursor

Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project-specific):

{
  "mcpServers": {
    "context": {
      "command": "context",
      "args": ["serve"]
    }
  }
}

Or use Settings > Developer > Edit Config to add the server through the UI.

VS Code (GitHub Copilot)

Requires VS Code 1.102+ with GitHub Copilot

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

{
  "servers": {
    "context": {
      "type": "stdio",
      "command": "context",
      "args": ["serve"]
    }
  }
}

Click the Start button that appears in the file, then use Agent mode in Copilot Chat.

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

  • Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json
{
  "mcpServers": {
    "context": {
      "command": "context",
      "args": ["serve"]
    }
  }
}

Or access via Windsurf Settings > Cascade > MCP Servers.

Zed

Add to your Zed settings (cmd+, or ctrl+,):

{
  "context_servers": {
    "context": {
      "command": {
        "path": "context",
        "args": ["serve"]
      }
    }
  }
}

Check the Agent Panel settings to verify the server shows a green indicator.

Goose

Run goose configure and select Command-line Extension, or add directly to ~/.config/goose/config.yaml:

extensions:
  context:
    type: stdio
    command: context
    args:
      - serve
    timeout: 300

4. Start using it

That's it! Now just ask your AI agent:

"How do I create middleware in Next.js?"

The agent automatically uses the get_docs tool when relevant.

:books: CLI Reference

context add <source>

Install a documentation package. The source type is auto-detected.

From git repository:

Works with GitHub, GitLab, Bitbucket, Codeberg, or any git URL:

# HTTPS URLs
context add https://github.com/vercel/next.js
context add https://gitlab.com/org/repo
context add https://bitbucket.org/org/repo

# Specific tag or branch
context add https://github.com/vercel/next.js/tree/v16.0.0

# SSH URLs
context add [email protected]:user/repo.git
context add ssh://[email protected]/user/repo.git

# Custom options
context add https://github.com/vercel/next.js --path packages/docs --name nextjs

From local directory:

Build a package from documentation in a local folder:

# Auto-detects docs folder (docs/, documentation/, doc/)
context add ./my-project

# Specify docs path explicitly
context add /path/to/repo --path docs

# Custom package name and version
context add ./my-lib --name my-library --pkg-version 1.0.0
Option Description
--pkg-version <version> Custom version label
--path <path> Path to docs folder in repo/directory
--name <name> Custom package name
--save <path> Save a copy of the package to the specified path

Saving packages for sharing:

# Save to a directory (auto-names as [email protected])
context add https://github.com/vercel/next.js --save ./packages/

# Save to a specific file
context add ./my-docs --save ./my-package.db

From URL:

context add https://cdn.example.com/[email protected]

From local file:

context add ./[email protected]

Finding the right documentation repository:

Many popular projects keep their documentation in a separate repository from their main codebase. If you see a warning about few sections found, the docs likely live elsewhere:

# Example: React's docs are in a separate repo
context add https://github.com/facebook/react
# ⚠️  Warning: Only 45 sections found...
# The warning includes a Google search link to help find the docs repo

# The actual React docs repository:
context add https://github.com/reactjs/react.dev

Common patterns for documentation repositories:

  • project-docs (e.g., prisma/docs)
  • project.dev or project.io (e.g., reactjs/react.dev)
  • project-website (e.g., expressjs/expressjs.com)

When the CLI detects few documentation sections, it will show a Google search link to help you find the correct repository.

context list

Show installed packages.

$ context list

Installed packages:

  [email protected]              4.2 MB    847 sections
  react@18                 2.1 MB    423 sections

Total: 2 packages (6.3 MB)

context remove <name>

Remove a package.

context remove nextjs

context serve

Start the MCP server (used by Claude Desktop).

context serve

context query <library> <topic>

Query documentation directly from the command line. Useful for testing and debugging.

# Query a package (use name@version format from 'context list')
context query '[email protected]' 'middleware authentication'

# Returns the same JSON format as the MCP get_docs tool

:gear: How It Works

┌─────────────────────────────────────────────────────┐
│                   Your Machine                      │
│                                                     │
│  ┌──────────┐     ┌────────────┐     ┌───────────┐ │
│  │  Claude  │────▶│ MCP Server │────▶│ ~/.context│ │
│  │          │     │ (get_docs) │     │  /packages│ │
│  └──────────┘     └────────────┘     └───────────┘ │
│                          │                         │
│                          ▼                         │
│                   ┌────────────┐                   │
│                   │   SQLite   │                   │
│                   │   FTS5     │                   │
│                   └────────────┘                   │
└─────────────────────────────────────────────────────┘

When you add a package:

  1. Repository is cloned (for git URLs) or read (for local directories)
  2. Documentation is parsed and split into sections
  3. Sections are indexed with FTS5 full-text search
  4. The package is stored in ~/.context/packages/

When Claude queries:

  1. FTS5 finds relevant sections by keyword matching
  2. Results are filtered by relevance score
  3. Token budget ensures responses stay concise
  4. Claude receives focused, relevant documentation

:package: Package Format

Packages are SQLite databases (.db files) containing pre-indexed documentation.

~/.context/packages/
├── [email protected]
├── [email protected]
└── [email protected]

You can:

  • Build from any git repository (GitHub, GitLab, Bitbucket, etc.)
  • Build from local directories
  • Download pre-built packages from URLs
  • Share packages via releases or any file host

:mortar_board: Tutorial: Create, Share, and Reuse Packages

Documentation packages are portable .db files that anyone can build once and reuse everywhere. This tutorial walks through the full workflow.

Step 1: Create a package from your docs

Build a package from a git repository or a local directory:

# From a git repository
context add https://github.com/your-org/your-library

# From a local directory with docs
context add ./my-project

Context auto-detects docs/, documentation/, or doc/ folders. Override with --path if your docs live elsewhere:

context add ./my-project --path content/api-reference

Customize the package name and version:

context add ./my-project --name my-lib --pkg-version 2.0

Step 2: Export the package for sharing

Use --save to write a copy of the .db file you can distribute:

# Save to a directory (auto-named as [email protected])
context add ./my-project --name my-lib --pkg-version 2.0 --save ./packages/

# Save to a specific file path
context add ./my-project --save ./my-lib-docs.db

You can also export an already-installed package. The .db files live in ~/.context/packages/—just copy the one you need:

cp ~/.context/packages/[email protected] ./shared-packages/

Step 3: Share with your team

Share the .db file however your team distributes artifacts:

  • Git repository: Commit the .db file to a shared repo or release assets
  • File host / CDN: Upload to any HTTP server, S3, or internal CDN
  • Direct transfer: Send the file via Slack, email, or shared drive

Step 4: Reuse a shared package

Teammates install the shared package with a single command:

# From a URL (CDN, GitHub release, internal server, etc.)
context add https://cdn.example.com/[email protected]

# From a local file (downloaded or checked into a repo)
context add ./shared-packages/[email protected]

No build step needed—pre-built packages install instantly.

Putting it all together

A typical team workflow:

# Maintainer: build and export the package
context add https://github.com/your-org/design-system \
  --name design-system --pkg-version 3.1 --save ./packages/

# Maintainer: upload [email protected] to your team's file host

# Teammate: install from the shared URL
context add https://internal-cdn.example.com/[email protected]

# Everyone: query the docs through any MCP-compatible agent
# "How do I use the DataTable component?"

:wrench: Development

# Install dependencies
pnpm install

# Build
pnpm build

# Test
pnpm test

# Lint
pnpm lint

:page_facing_up: License

Apache-2.0

MCP Server · Populars

MCP Server · New