Skip to main content
Glama

openground

PyPI version

tldr: openground lets you give controlled access to documentation to AI agents. Everything happens on-device.

openground is an on-device RAG system that extracts documentation from git repos and sitemaps, embeds it for semantic search, and exposes it to AI agents via MCP. It uses a local embedding model, and local lancedb for storing embeddings and for hybrid vector similarity and BM25 full-text search.

Architecture

      ┌─────────────────────────────────────────────────────────────────────┐
      │                           OPENGROUND                                │
      ├─────────────────────────────────────────────────────────────────────┤
      │                                                                     │
      │       SOURCE                  PROCESS              STORAGE/CLIENT   │
      │                                                                     │
      │    ┌──────────┐      ┌───────────┐   ┌──────────┐   ┌──────────┐    │
      │    │ git repo ├─────>│  Extract  ├──>│  Chunk   ├──>│ LanceDB  │    │
      │    |   -or-   |      │ (raw_data)│   │   Text   │   │ (vector  │    │
      │    │ sitemap  │      └───────────┘   └──────────┘   │  +BM25)  │    │
      │    │   -or-   │                           │         └────┬─────┘    │
      │    │ local dir│                           │              │          │
      │    └──────────┘                           │              │          │
      │                                           ▼              │          │
      │                                    ┌───────────┐         │          │
      │                                    │   Local   |<────────┘          │
      │                                    │ Embedding │         │          │
      │                                    │   Model   │         ▼          │
      │                                    └───────────┘  ┌─────────────┐   │
      │                                                   │ CLI / MCP   │   │
      │                                                   │  (hybrid    │   │
      |                                                   |   search)   |   |
      │                                                   └─────────────┘   │
      │                                                                     │
      └─────────────────────────────────────────────────────────────────────┘

Related MCP server: tech-doc-mcp

Quick Start

Install

uv tool install openground                    # sentence-transformers (GPU/MPS/CPU)
uv tool install 'openground[fastembed-cpu]'   # also installs fastembed (or fastembed-gpu)

fastembed is optional; select it with "embedding_backend": "fastembed" in the config file below.

or pip install openground.

Add documentation

openground add NAME SOURCE figures out the source type from SOURCE:

# git repo (optionally a docs folder and a tag/branch)
openground add fastembed https://github.com/qdrant/fastembed.git -d docs -v v0.7.4

# sitemap (optionally only URLs containing a keyword)
openground add claude-code https://code.claude.com/docs/sitemap.xml -f /en/

# local directory
openground add my-docs ./docs

Git and local sources index .md, .rst, .txt, .mdx, .ipynb, .html and .htm files. GitHub/GitLab web URLs like https://github.com/o/r/tree/v1.0/docs also work; the tag and folder are picked up from the URL.

add adds; update refreshes. Each library has one source, remembered in sources.json next to the config file, and openground update re-extracts every stored version of every library from it (update NAME for one), re-embedding only pages that changed. Use add NAME -v VERSION to add another version from the same source. add NAME SOURCE with a different source than the one a stored library uses is an error: rm the library or pick another name. Adding a name and version that is already stored updates it in place.

Commands

Command

add NAME [SOURCE]

Add a library or another version of it (an existing name+version is updated in place). Without SOURCE, reuses the remembered one; without -v it will not create a second default version, use update. Options (each only valid for its source type): -d/--docs-path (git, repeatable), -v/--version (git tag or branch), -f/--filter (sitemap, repeatable)

update [NAME]

Refresh libraries from their remembered sources (all if no name)

ls

List libraries, versions, and whether a source is remembered

rm NAME

Delete a library version; the remembered source is forgotten once the last version is gone. -v is only needed when several versions are stored. -y skips the prompt

search QUERY

Hybrid search from the terminal. Options: -l, -v, -k

serve

Run the MCP server (same as openground-mcp). Options: --transport, --host, --port

install-mcp [CLIENT]

Configure claude-code, cursor or opencode; no client prints the JSON. --wsl launches the server through wsl.exe

config

Show the config file path, effective settings and data locations

stats

Library and chunk counts plus MCP tool call counts. --reset zeroes the call counts

reset

Delete embeddings, raw files and stats; config and remembered sources are kept. -y skips the prompt

Use with AI agents

openground install-mcp claude-code   # or cursor, opencode
openground install-mcp               # print JSON for any other client

Then ask your agent something like "What models are available in fastembed?" and it will search your local docs.

Share one MCP server over HTTP

Run one server for all local agent sessions. The server loads the embedding model on the first semantic search. Both openground-mcp and openground serve default to stdio.

openground-mcp --transport http

The endpoint is http://127.0.0.1:8765/mcp. Use --host and --port to override the bind address and port. The endpoint is unauthenticated, so keep it on loopback for local use. Requests must use a loopback address or the specific address passed to --host, with the configured port. Browser requests must also come from one of those HTTP origins.

For a persistent server on Linux, save this as ~/.config/systemd/user/openground-mcp.service. Set ExecStart to the absolute path reported by command -v openground-mcp if it differs from the example.

[Unit]
Description=OpenGround MCP server

[Service]
ExecStart=%h/.local/bin/openground-mcp --transport http
Restart=on-failure
RestartSec=5

[Install]
WantedBy=default.target
systemctl --user daemon-reload
systemctl --user enable --now openground-mcp.service

Run loginctl enable-linger "$USER" to keep the user service running after logout.

For Claude Code, replace the existing user-scoped stdio entry if you used openground install-mcp claude-code. If you registered it at another scope, use that scope for both commands.

claude mcp remove openground --scope user
claude mcp add --transport http --scope user openground http://127.0.0.1:8765/mcp

For OpenCode v2, replace the openground entry under mcp.servers in ~/.config/opencode/opencode.json (or your project config).

{
  "mcp": {
    "servers": {
      "openground": {
        "type": "remote",
        "url": "http://127.0.0.1:8765/mcp",
        "oauth": false
      }
    }
  }
}

For OpenCode v1, put the entry directly under mcp and allow extra time for the first search to load or download the model.

{
  "mcp": {
    "openground": {
      "type": "remote",
      "url": "http://127.0.0.1:8765/mcp",
      "enabled": true,
      "timeout": 120000
    }
  }
}

Both transports default to one math thread per library and disable tokenizer parallelism. Set OPENGROUND_MATH_THREADS=2 in the server environment to raise the default, including FastEmbed's ONNX Runtime thread count. Existing OMP_NUM_THREADS, MKL_NUM_THREADS, OPENBLAS_NUM_THREADS, and TOKENIZERS_PARALLELISM settings take precedence for their respective libraries. For a systemd service, add Environment=OPENGROUND_MATH_THREADS=2 under [Service].

Configuration

Defaults work out of the box. To change them, create config.json in the config directory: $XDG_CONFIG_HOME/openground if set, otherwise ~/.config/openground (Linux/macOS) or %USERPROFILE%\AppData\Roaming\openground (Windows). Every key is optional:

{
  "embedding_backend": "sentence-transformers",
  "embedding_model": "BAAI/bge-small-en-v1.5",
  "embedding_dimensions": 384,
  "batch_size": 32,
  "chunk_size": 800,
  "chunk_overlap": 200,
  "top_k": 5
}

embedding_backend is sentence-transformers or fastembed. embedding_dimensions can be omitted (or 0) for the common bge and MiniLM models, where it is filled in automatically and a different value is rejected; set it yourself for any other model. Unknown keys are rejected, chunk_size, batch_size and top_k must be positive, and chunk_overlap (may be 0) must be smaller than chunk_size. Delete the file to reset.

The database remembers the backend and model its embeddings were made with, and openground uses them automatically unless config.json sets embedding_backend or embedding_model. If those explicitly disagree with the stored ones, add and search refuse to run until you remove them or run openground reset and re-add your libraries. Data lives in $XDG_DATA_HOME/openground or ~/.local/share/openground (%USERPROFILE%\AppData\Local\openground on Windows); run openground config to see all paths.

Each MCP search reads the current config file, so settings changes take effect without restarting the server.

Upgrading from 0.14

Your existing setup is migrated automatically, with a notice, the first time openground needs it:

  • Config is rewritten in the flat format; the old file is kept as config.json.bak. db_path, raw_data_dir and table_name are no longer settings (you get a notice if you had customized a path). On Windows the config moves from Local to Roaming AppData.

  • Remembered sources from ~/.openground/sources.json are imported into the new sources.json. Project-level .openground/sources.json, --sources-file and the bundled catalog are gone.

  • Existing embeddings keep working. The default backend for new databases is now sentence-transformers, but an existing database keeps using the backend and model it was built with.

  • Commands changed. extract-*, embed, query, list-libraries, remove, nuke, config set|get|show|reset and stats show|clear are replaced by the commands above. Local directories are now stored under the version latest.

Claude Code Agent

Openground includes a custom Claude Code agent that searches official documentation without polluting your main conversation context. See docs/claude-code-agent.md for installation and usage instructions.

Development

To contribute or work on openground locally:

git clone https://github.com/poweroutlet2/openground.git
cd openground
uv sync .

License

MIT

Available Tools

3 tools
get_full_content_toolA

Retrieve the full content of a document by its URL and version.

Use this tool when you need to see the complete content of a page that was returned in search results. The URL and version are provided in the search result's tool hint.

Inputs: url (required), version (required). Returns: result

list_libraries_toolA

Retrieve a dictionary of available documentation libraries/frameworks with their versions.

Returns a dictionary mapping library names to lists of available versions. Use this tool to see what documentation is available before performing a search. If the desired library is not in the list, you may prompt the user to add it.

Inputs: no named parameters. Returns: object

search_documents_toolA

Search the official documentation knowledge base to answer user questions.

Always used this tool when a question might be answered or confirmed from the documentation.

First call list_libraries_tool to see what libraries and versions are available, then filter by library_name and version.

Inputs: query (required), version (required), library_name (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 3 tools

    Disambiguation5/5

    The three tools have clearly distinct purposes: listing available libraries, searching documents, and retrieving full document content by URL/version. An agent can easily choose between discovery, search, and retrieval without overlapping functionality.

    Naming Consistency5/5

    All tool names follow the same snake_case verb_noun_tool pattern: list_libraries_tool, search_documents_tool, get_full_content_tool. The convention is predictable and consistent across the entire set.

    Tool Count5/5

    Three tools are well-scoped for a documentation search and retrieval server. Each tool covers a necessary part of the workflow: discovering libraries, searching content, and reading full documents.

    Completeness5/5

    For a read-only documentation knowledge base, the surface covers discovery, search, and full-content retrieval. There are no obvious missing operations such as create/update/delete, which do not apply to this domain.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides up-to-date documentation for AI agents by locally querying a community-driven registry of pre-built docs packages.
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables agents to retrieve relevant context from local documents via MCP tools, supporting ingestion, semantic search, metadata filtering, and evidence inspection entirely on-device.
      MIT