Put docs on the shelf. Your agent knows where to look.
Local-first library documentation for AI agents—offline, instant, private.
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.
AgentShelf 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.
Add docs for your entire tech stack in one command. Your AI assistant becomes an expert in the exact versions you're using:
# Auto-discover and install docs for all your dependencies
agentshelf init
# Or add individual libraries
agentshelf add https://github.com/vercel/next.js
agentshelf add https://github.com/prisma/prisma
agentshelf add https://github.com/tailwindlabs/tailwindcssNow 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 an internal library? Package your documentation once, share it with your team:
# Build docs from your repo
agentshelf 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?"AgentShelf works 100% offline. Download docs once, query forever—no internet required.
Cloud documentation services see your queries. AgentShelf runs entirely on your machine. Your questions about internal APIs stay internal.
| Context7 | Deepcon | AgentShelf | |
|---|---|---|---|
| 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 | ❌ | ❌ | ✅ |
| Privacy | Queries sent to cloud | Queries sent to cloud | 100% local |
| Private repos | $15/1M tokens | ❌ | Free |
| Cross-library search | ❌ | ❌ | ✅ |
- Two tools -
get_docsfor targeted search,search_allfor cross-library discovery - Cross-library search - Don't know which library has the answer?
search_allsearches everywhere at once - Token-aware - Smart relevance filtering with per-library score normalization, 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
npm install -g @michelemarri/agentshelfAuto-discover from your project (recommended):
# Reads package.json, resolves repos via npm, installs docs automatically
agentshelf initOr add individual packages:
# From any git repository (GitHub, GitLab, Bitbucket, etc.)
agentshelf add https://github.com/vercel/next.js
agentshelf add https://gitlab.com/org/repo
agentshelf add git@github.com:user/repo.git
# From a local directory
agentshelf add ./my-project
agentshelf add /path/to/docs
# From URL (pre-built package)
agentshelf add https://example.com/react@18.db
# From local file
agentshelf add ./my-package.dbAgentShelf works with any MCP-compatible agent. Choose your setup below:
Claude Code
claude mcp add agentshelf -- agentshelf serveClaude 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": {
"agentshelf": {
"command": "agentshelf",
"args": ["serve"]
}
}
}Restart Claude Desktop to apply changes.
Cursor
Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project-specific):
{
"mcpServers": {
"agentshelf": {
"command": "agentshelf",
"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": {
"agentshelf": {
"type": "stdio",
"command": "agentshelf",
"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": {
"agentshelf": {
"command": "agentshelf",
"args": ["serve"]
}
}
}Or access via Windsurf Settings > Cascade > MCP Servers.
Zed
Add to your Zed settings (cmd+, or ctrl+,):
{
"context_servers": {
"agentshelf": {
"command": {
"path": "agentshelf",
"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:
agentshelf:
type: stdio
command: agentshelf
args:
- serve
timeout: 300That's it! Now just ask your AI agent:
"How do I create middleware in Next.js?"
The agent automatically uses the get_docs tool for targeted queries and search_all when a topic might span multiple libraries.
You can also search from the command line:
agentshelf query 'nextjs@16.0' 'middleware' # single library
agentshelf search-all 'authentication middleware' # all librariesAuto-discover project dependencies and install their documentation. Reads package.json, resolves GitHub repositories via the npm registry, and installs docs for libraries that have a docs/ folder.
# Auto-install docs for all dependencies in the current project
agentshelf init
# Specify a different project directory
agentshelf init --path ./my-project
# Choose which packages to install interactively
agentshelf init --interactive| Option | Description |
|---|---|
--path <dir> |
Project directory (default: current directory) |
--interactive |
Select which packages to install via checkbox |
Libraries without a detectable docs/ folder are skipped. Packages already installed in AgentShelf are also skipped. Duplicate repos (e.g., @eslint/js and eslint both pointing to the same GitHub repo) are deduplicated automatically.
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
agentshelf add https://github.com/vercel/next.js
agentshelf add https://gitlab.com/org/repo
agentshelf add https://bitbucket.org/org/repo
# Specific tag or branch
agentshelf add https://github.com/vercel/next.js/tree/v16.0.0
# SSH URLs
agentshelf add git@github.com:user/repo.git
agentshelf add ssh://git@github.com/user/repo.git
# Custom options
agentshelf add https://github.com/vercel/next.js --path packages/docs --name nextjsFrom local directory:
Build a package from documentation in a local folder:
# Auto-detects docs folder (docs/, documentation/, doc/)
agentshelf add ./my-project
# Specify docs path explicitly
agentshelf add /path/to/repo --path docs
# Custom package name and version
agentshelf 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 name@version.db)
agentshelf add https://github.com/vercel/next.js --save ./packages/
# Save to a specific file
agentshelf add ./my-docs --save ./my-package.dbFrom URL:
agentshelf add https://cdn.example.com/react@18.dbFrom local file:
agentshelf add ./nextjs@15.0.dbFinding 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
agentshelf 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:
agentshelf add https://github.com/reactjs/react.devCommon patterns for documentation repositories:
project-docs(e.g.,prisma/docs)project.devorproject.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.
Show installed packages.
$ agentshelf list
Installed packages:
nextjs@16.0 4.2 MB 847 sections
react@18 2.1 MB 423 sections
Total: 2 packages (6.3 MB)Remove a package.
agentshelf remove nextjsStart the MCP server (used by AI agents).
agentshelf serveQuery a single package from the command line. Useful for testing and debugging.
# Query a package (use name@version format from 'agentshelf list')
agentshelf query 'nextjs@16.0' 'middleware authentication'
# Returns the same JSON format as the MCP get_docs toolSearch across all installed packages at once. Results are ranked by relevance with per-library score normalization.
# Search everywhere — don't know which library has the answer?
agentshelf search-all 'authentication middleware'
# Returns results from any matching package, ranked by relevance
agentshelf search-all 'error handling retry' Your Machine
┌─────────────────────────────────────────────────────┐
│ │
│ ┌──────────┐ ┌─────────────┐ ┌────────────┐ │
│ │ AI │────▶│ MCP Server │──▶│~/.agentshelf│ │
│ │ Agent │ │ │ │ /packages │ │
│ └──────────┘ │ get_docs │ └────────────┘ │
│ │ search_all │ │ │
│ └─────────────┘ ▼ │
│ ┌──────────┐ │
│ │ SQLite │ │
│ │ FTS5 │ │
│ └──────────┘ │
└─────────────────────────────────────────────────────┘
Two MCP tools:
| Tool | Use when... |
|---|---|
get_docs |
You know which library to search (e.g., "Next.js middleware") |
search_all |
You don't know which library has the answer, or the topic spans multiple libraries (e.g., "authentication middleware") |
search_all normalizes BM25 scores per-library so no single package dominates results.
When you add a package:
- Repository is cloned (for git URLs) or read (for local directories)
- Documentation is parsed and split into sections
- Sections are indexed with FTS5 full-text search
- The package is stored in
~/.agentshelf/packages/
When the agent queries:
- FTS5 finds relevant sections by keyword matching
- Results are filtered by relevance score
- Token budget ensures responses stay concise
- The agent receives focused, relevant documentation
Packages are SQLite databases (.db files) containing pre-indexed documentation.
~/.agentshelf/packages/
├── nextjs@16.0.db
├── react@18.db
└── typescript@5.5.db
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
Documentation packages are portable .db files that anyone can build once and reuse everywhere. This tutorial walks through the full workflow.
Build a package from a git repository or a local directory:
# From a git repository
agentshelf add https://github.com/your-org/your-library
# From a local directory with docs
agentshelf add ./my-projectAgentShelf auto-detects docs/, documentation/, or doc/ folders. Override with --path if your docs live elsewhere:
agentshelf add ./my-project --path content/api-referenceCustomize the package name and version:
agentshelf add ./my-project --name my-lib --pkg-version 2.0Use --save to write a copy of the .db file you can distribute:
# Save to a directory (auto-named as my-lib@2.0.db)
agentshelf add ./my-project --name my-lib --pkg-version 2.0 --save ./packages/
# Save to a specific file path
agentshelf add ./my-project --save ./my-lib-docs.dbYou can also export an already-installed package. The .db files live in ~/.agentshelf/packages/—just copy the one you need:
cp ~/.agentshelf/packages/my-lib@2.0.db ./shared-packages/Share the .db file however your team distributes artifacts:
- Git repository: Commit the
.dbfile 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
Teammates install the shared package with a single command:
# From a URL (CDN, GitHub release, internal server, etc.)
agentshelf add https://cdn.example.com/my-lib@2.0.db
# From a local file (downloaded or checked into a repo)
agentshelf add ./shared-packages/my-lib@2.0.dbNo build step needed—pre-built packages install instantly.
A typical team workflow:
# Maintainer: build and export the package
agentshelf add https://github.com/your-org/design-system \
--name design-system --pkg-version 3.1 --save ./packages/
# Maintainer: upload design-system@3.1.db to your team's file host
# Teammate: install from the shared URL
agentshelf add https://internal-cdn.example.com/design-system@3.1.db
# Everyone: query the docs through any MCP-compatible agent
# "How do I use the DataTable component?"# Install dependencies
pnpm install
# Build
pnpm build
# Test
pnpm test
# Lint
pnpm lintAgentShelf is a fork of neuledge/context with cross-library search and rebranding. Licensed under Apache-2.0.
