> ## Documentation index
> Fetch the complete documentation index at: https://upstash-context7-git-ctx7-4280-helm-registry-login-c44ca5.docs7.io/llms.txt
> Ask it with GET https://upstash-context7-git-ctx7-4280-helm-registry-login-c44ca5.docs7.io/ask?q=<keywords or question>. Short keywords rank best.
> Use these to discover all available pages before exploring further.
> Feature requests: https://upstash-context7-git-ctx7-4280-helm-registry-login-c44ca5.docs7.io/resources/feature-requests.md lists what users asked for and how to vote for a request or add one.
> Page rating: `GET https://upstash-context7-git-ctx7-4280-helm-registry-login-c44ca5.docs7.io/feedback?path=/enterprise/on-premise&helpful={true|false}&comment={comment}` records whether this page helped. The `comment` (URL-encoded, at most 500 characters) says what helped, or what was missing or wrong; a `helpful=false` rating needs it. It is anonymous and needs no key. Comments hold no code, secrets or personal data.

# On-Premise Deployment

> Run the Context7 stack inside your infrastructure with your chosen AI and storage services

Context7 On-Premise keeps your repositories, generated documentation, application database, vector store, and MCP server in your infrastructure.

Two kinds of outside services receive data:

- **Your AI providers** receive the content needed for parsing, embedding, reranking, and source-code documentation.
- **Context7 Cloud** receives license checks, a daily usage report, and public library searches, but only with an online license. See [Network and data flow](#network-and-data-flow).

## What's Included

- Full Context7 parsing and indexing pipeline
- Local vector storage (no external vector DB required)
- Built-in MCP server. Works with any MCP-compatible AI client
- Web UI for managing indexed libraries and configuration
- REST API compatible with the public Context7 API
- Private GitHub and GitLab repository ingestion

<Frame>
  <img src="/images/on-premise-architecture.png" alt="On-Premise Architecture" />
</Frame>

## Language Support

Context7 indexes documentation in any human language. Which pages a library keeps depends on its source:

| Source | Languages indexed |
|---|---|
| Confluence, Google Drive, Notion | Every page, whatever its language. One library can mix languages. Requires 2.0.1 or later |
| Git repository | Every page, whatever its language. One library can mix languages. Requires 2.0.2 or later |
| Website, llms.txt | The language of the site, detected from its first page. Pages in other languages are skipped |
| OpenAPI | English |

For Google Drive and Notion libraries, Context7 detects the library language when you leave it empty.

<Note>
Before 2.0.1, a long document in a mixed-language Google Drive or Notion library could lose a section in another language. After you upgrade, sync each such library once with **Re-index all files** (Google Drive) or **Re-index all pages** (Notion) selected.

Before 2.0.2, Git repositories skipped pages that were not in the library's language. After you upgrade, refresh each Git library that mixes languages once, so that Context7 indexes those pages.
</Note>

If a repository keeps translated copies of its docs, such as `docs/en` and `docs/de`, exclude the folders you don't need in the repository settings to avoid duplicate results.

## Setup

<Steps>

<Step title="Request a trial">

Go to [context7.com/plans](https://context7.com/plans) and click **Learn More** on the Enterprise plan, then click **Request On-Premise Trial**. Fill out the request form. No credit card required. You'll receive a 30-day full-featured license key via email once approved.

</Step>

<Step title="Deploy">

Follow the deployment guide for your platform:

<CardGroup cols={2}>
  <Card title="Docker" icon="docker" href="/enterprise/deployment/docker">
    Deploy with Docker Compose
  </Card>
  <Card title="Kubernetes" icon="dharmachakra" href="/enterprise/deployment/kubernetes">
    Deploy on Kubernetes with raw manifests
  </Card>
</CardGroup>

</Step>

<Step title="Complete the setup wizard">

Open `http://localhost:3000` in your browser. On first launch, the setup wizard guides you through configuring:

1. **AI Provider** - Choose OpenAI, Anthropic, Google (Google AI Studio or Google Vertex AI), AWS Bedrock, or a custom OpenAI-compatible endpoint. Enter the provider credentials and model name.
2. **Embedding Provider** - Use the same provider as your LLM, or configure a separate one for embeddings.
3. **Git Tokens** - Add a GitHub and/or GitLab token for the platforms you use.

All configuration is stored locally in the embedded database and can be updated later in Workspace Settings.

</Step>

<Step title="Ingest your first repository">

From the dashboard, click **Add source**, choose **GitHub** or **GitLab**, and enter the repository URL. Once ingestion completes, your private docs are ready to query.

You can also add libraries via the REST API with a personal API key (see [Authentication](/enterprise/api/authentication)):

```bash
curl -X POST http://localhost:3000/api/parse \
  -H "Authorization: Bearer ctx7op-..." \
  -H "Content-Type: application/json" \
  -d '{"repoUrl": "https://github.com/your-org/your-repo"}'
```

</Step>

</Steps>

## Connecting Your AI Client

The Context7 CLI is the recommended way to connect an AI coding agent. Install it once on the machine that runs your client:

<Tabs>
  <Tab title="Public npm registry">
    ```bash
    npm install --global ctx7@latest
    ```
  </Tab>
  <Tab title="Internal npm registry">
    ```bash
    npm install --global ctx7 \
      --registry https://npm.internal.yourcompany.com
    ```
  </Tab>
</Tabs>

For restricted or air-gapped environments, mirror the `ctx7` package and its dependencies in your approved internal npm registry. Once installed, on-premise setup does not contact npm, GitHub, or Context7 Cloud. It uses bundled rule and skill content and contacts only your deployment to discover its MCP authentication setting.

Pass the root URL of your deployment (without `/mcp` or `/api`) and select the client:

<Tabs>
  <Tab title="Claude Code">
    ```bash
    ctx7 setup --mcp \
      --base-url https://context7.internal.yourcompany.com \
      --claude
    ```
  </Tab>
  <Tab title="Cursor">
    ```bash
    ctx7 setup --mcp \
      --base-url https://context7.internal.yourcompany.com \
      --cursor
    ```
  </Tab>
  <Tab title="VS Code">
    ```bash
    ctx7 setup --mcp \
      --base-url https://context7.internal.yourcompany.com \
      --vscode
    ```
  </Tab>
  <Tab title="Codex">
    ```bash
    ctx7 setup --mcp \
      --base-url https://context7.internal.yourcompany.com \
      --codex
    ```
  </Tab>
  <Tab title="OpenCode">
    ```bash
    ctx7 setup --mcp \
      --base-url https://context7.internal.yourcompany.com \
      --opencode
    ```
  </Tab>
</Tabs>

Setup reads the deployment's MCP authentication setting. When MCP authentication is disabled, no credential is written. When the deployment uses [OAuth sign-in](/enterprise/security/mcp-oauth), setup writes no key either: the client opens a browser on its first request, and the user signs in (SSO or password) and approves the client. With **OAuth and API keys**, setup chooses OAuth unless you pass `--api-key` or set `CONTEXT7_API_KEY` to a personal key (`ctx7op-`). With **OAuth only**, setup refuses `--api-key` and ignores `CONTEXT7_API_KEY`. `--api-key` takes precedence over `CONTEXT7_API_KEY`. Without `--api-key`, setup ignores a `CONTEXT7_API_KEY` that is not a personal key, such as a hosted Context7 key, and prints a warning. Keyless setup needs `ctx7` 0.13.0 or later: an older version asks for a key, and **OAuth only** refuses that key. The dashboard's Connect card shows the same keyless setup.

When the deployment accepts only personal API keys, the dashboard's Connect card presents two steps: sign in and click **Create API key**, then copy the command after the dashboard inserts the one-time-visible key. Select **Configure manually** to reveal the equivalent client-native configuration instead. If you run the base command without `--api-key`, the CLI requests the key with hidden input.

For non-interactive automation, provide the personal key through the environment:

```bash
CONTEXT7_API_KEY=ctx7op-... ctx7 setup --mcp --yes \
  --base-url https://context7.internal.yourcompany.com \
  --claude
```

You can use `--api-key ctx7op-...` instead, but command-line arguments may be retained in shell history. Setup writes the MCP client configuration, a Context7 rule, and a bundled `context7-mcp` skill. The bundled files mean the deployment does not need to expose Context7 Cloud's skill APIs.

<Note>
  Custom `--base-url` setup uses the deployment's Streamable HTTP endpoint. Local stdio transport and the CLI + Skills setup mode are not available for on-premise targets. OAuth sign-in needs `CONTEXT7_PUBLIC_URL` on the server. See [OAuth Sign-In for MCP Clients](/enterprise/security/mcp-oauth).
</Note>

### Query from the CLI

Without an MCP client, `ctx7 library` and `ctx7 docs` query the deployment directly. Set its root URL and a personal API key once:

```bash
export CONTEXT7_BASE_URL=https://context7.internal.yourcompany.com
export CONTEXT7_API_KEY=ctx7op-...

ctx7 library my-repo "How to configure the client"
ctx7 docs /my-org/my-repo "How to configure the client"
```

Use the root URL, without `/api`. `ctx7 search`, `ctx7 code` and `ctx7 get-upgrade-guide` are available only on hosted Context7.

### Manual configuration

If your client is not supported by `ctx7 setup`, point it at `<deployment-root>/mcp`.

With [OAuth sign-in](/enterprise/security/mcp-oauth), add only the URL. The client signs in on its first request:

```json
{
  "mcpServers": {
    "context7": {
      "url": "https://context7.internal.yourcompany.com/mcp"
    }
  }
}
```

With personal API keys, send the key as a standard bearer token:

```json
{
  "mcpServers": {
    "context7": {
      "url": "https://context7.internal.yourcompany.com/mcp",
      "headers": {
        "Authorization": "Bearer ctx7op-..."
      }
    }
  }
}
```

For other clients, see [All Clients](/resources/all-clients).

## Configuration

### Environment Variables

These are set in your `docker-compose.yml` or `.env` file before starting the container.

| Variable | Required | Description |
|---|---|---|
| `LICENSE_KEY` | Yes | License key issued by Upstash |
| `PORT` | No | HTTP port (default: `3000`) |
| `DATA_DIR` | No | Data directory inside the container (default: `/data`) |
| `DATABASE_URL` | No | Postgres connection string. Without it, the embedded SQLite database in `DATA_DIR` is used. See [Scaling](/enterprise/deployment/scaling) |
| `PG_POOL_MAX` | No | Postgres connection pool size per replica (default: `10`) |
| `ENCRYPTION_KEY` | No | 64 hex characters (`openssl rand -hex 32`) that encrypt stored secrets. Without it, a key is generated in `$DATA_DIR/.encryption-key`. The variable wins over the file |
| `VECTOR_STORE` | No | `auto` (default), `lancedb`, `pgvector`, or `milvus`. See [Vector Stores](/enterprise/deployment/vector-stores) |
| `VECTOR_DATABASE_URL` | No | Postgres connection string for pgvector, if it differs from `DATABASE_URL` |
| `PG_VECTOR_POOL_MAX` | No | pgvector connection pool size per replica (default: `5`) |
| `MILVUS_ADDRESS`, `MILVUS_TOKEN`, `MILVUS_USERNAME`, `MILVUS_PASSWORD`, `MILVUS_DATABASE` | No | Milvus connection settings |
| `CONTEXT7_PUBLIC_URL` | No | The origin users and MCP clients reach, such as `https://context7.internal.yourcompany.com`. Required for [OAuth sign-in for MCP clients](/enterprise/security/mcp-oauth) |
| `CONTEXT7_TRUSTED_PROXY_HOPS` | No | The number of reverse proxies or load balancers in front of the server, from `0` to `10` (default: `0`). Any other value counts as `0`. OAuth client registration limits use it to find the caller's address. See [Client registration](/enterprise/security/mcp-oauth#client-registration) |
| `CONTEXT7_API_URL` | No | Base URL for license checks, usage reports, and cloud library queries (default: `https://context7.com/api`) |
| `NODE_EXTRA_CA_CERTS` | No | Path to a PEM bundle of extra CA certificates. The server trusts it for all outbound HTTPS, and git uses it too |
| `GIT_TLS_INSECURE` | No | `true` or `1` turns off TLS verification for all outbound HTTPS and git. Use it only for testing |
| `AWS_REGION`, `AWS_DEFAULT_REGION`, `AWS_BEARER_TOKEN_BEDROCK`, standard AWS credential variables | No | AWS Bedrock authentication. See [AWS Bedrock](/enterprise/integrations/aws-bedrock) |
| `LOG_MAX_SIZE_MB` | No | Size of the log file before it rotates (default: `10`). Logs are JSONL in `$DATA_DIR/logs/context7.jsonl` |
| `LOG_MAX_FILES` | No | Number of rotated log files to keep (default: `3`) |
| `AZURE_DEVOPS_ALLOW_HTTP` | No | `true` allows an `http://` [Azure DevOps Server](/enterprise/integrations/azure-devops#connect-azure-devops) URL. Without it, Context7 requires `https://` |
| `NOTION_REQUESTS_PER_MINUTE` | No | Notion API rate (default: `180`). The only other accepted value is `600` |
| `MAX_FILES`, `PARSE_CONCURRENCY`, `PARSE_TIMEOUT`, `NOTION_MAX_PAGES`, `GOOGLE_DRIVE_MAX_FILES`, `AZURE_DEVOPS_MAX_WORK_ITEMS` | No | Default values for the [parsing settings](#parsing-settings). A value saved in the dashboard wins |

<Note>
Set AI providers, models, provider keys, and git tokens in the setup wizard. You can change them later in Workspace Settings. There are no environment variables for git tokens (such as `GITHUB_TOKEN` or `GITLAB_TOKEN`) or for provider API keys.

AWS Bedrock is the exception. It can also authenticate with `AWS_BEARER_TOKEN_BEDROCK`, the standard AWS credential variables, a mounted shared profile, or a workload IAM role. See [AWS Bedrock](/enterprise/integrations/aws-bedrock).
</Note>

### AI Provider Settings

Configured under **Workspace Settings › AI models** in the web UI.

| Setting | Description |
|---|---|
| LLM Provider | OpenAI, Anthropic, Google, AWS Bedrock, or custom. Google has two options: Google AI Studio (API key) and Google Vertex AI (Google Cloud project) |
| LLM API Key | API key for your chosen provider; optional for Bedrock with workload credentials; not used for Google Vertex AI |
| LLM Model | Model name, Bedrock model/inference-profile ID, or Vertex AI model ID |
| AWS Region | Region used for Bedrock LLM and embedding requests |
| Google Cloud project and location | Project and location used for Vertex AI LLM and embedding requests |
| Base URL / Bedrock endpoint | Custom OpenAI-compatible endpoint, or an optional Bedrock Runtime endpoint |

#### Examples

<Tabs>
  <Tab title="OpenRouter">
    ```
    Provider: custom
    Base URL: https://openrouter.ai/api/v1
    Model: openai/gpt-6-astra
    API Key: sk-or-v1-...
    ```
  </Tab>
  <Tab title="Local Model (Ollama, vLLM)">
    ```
    Provider: custom
    Base URL: http://host.docker.internal:11434/v1
    Model: llama3.2
    API Key: ollama
    ```
  </Tab>
</Tabs>

### Embedding Settings

By default, Context7 uses the same provider as your LLM for generating embeddings. Anthropic has no embedding models, so when the LLM provider is Anthropic, you must configure a separate embedding provider. With other providers, a separate embedding provider is optional.

| Setting | Description |
|---|---|
| Embedding Provider | OpenAI, Google (Google AI Studio or Google Vertex AI), AWS Bedrock, or custom |
| Embedding API Key | Separate key; inherits the LLM key only when both use the same provider |
| Embedding Model | Embedding model name, such as `text-embedding-3-small`, `amazon.titan-embed-text-v2:0`, or `gemini-embedding-001` |
| Embedding base URL / Bedrock endpoint | Custom embedding endpoint, or an optional Bedrock Runtime endpoint |

See [AWS Bedrock](/enterprise/integrations/aws-bedrock) for IAM, model, region, and private-network configuration, and [Google Vertex AI](/enterprise/integrations/google-vertex-ai) for Google Cloud credentials, Workload Identity, and models.

### Decision Model

Optionally, a decision model can classify pages, check for duplicate snippets, and rerank search results in place of the language model. It is faster and costs less for these yes/no decisions. See [Decision Models](/enterprise/decision-models) to turn it on.

### Parsing Settings

Change these in **Workspace Settings › Parsing**. Some settings also have an environment variable. The variable only sets the default; a value saved in the dashboard wins.

The four count limits also have a **No limit** option: files per library, Notion pages, Google Drive files, and Azure DevOps work items. Setting their environment variable to `0` does the same. Without a limit, a very large source can take a long time and make many LLM calls. File timeout and the concurrency settings always have a limit.

<Frame>
  <img src="/images/enterprise/settings/parsing-no-limit.png" alt="The Max files per library setting with its list open and No limit selected" />
</Frame>

When a change takes effect:

- **Settings with an environment variable:** at the next parse, on every replica.
- **Max concurrent parses, Max concurrent LLM requests, LLM timeout:** at once on the replica that saves them. In a [multi-replica deployment](/enterprise/deployment/scaling), other replicas use the new value after they restart.

| Setting | Default | Range | Env fallback | Description |
|---|---|---|---|---|
| Max concurrent parses | `1` | 1–10 | — | Parses each replica runs at the same time |
| Max concurrent LLM requests | `5` | 1–64 | — | Requests in flight to the language model, shared by parsing and search |
| LLM timeout | `120` s | 30–1800 s | — | How long to wait for one model call. Each part of a page takes up to four calls in a row (a page check, then code, API and info extraction), so it may run up to four times this value |
| Max files per library | `500` | 1–100000, or no limit | `MAX_FILES` | Documentation files a repository parse reads, or pages a website or llms.txt parse keeps. Extra files are skipped and logged |
| Files parsed in parallel | `5` | 1–64 | `PARSE_CONCURRENCY` | Files one parse processes at the same time |
| File timeout | `500` s | 30–3600 s | `PARSE_TIMEOUT` | How long one file may take. The parse skips a file that takes longer |
| Max pages per Notion library | `10000` | 1–100000, or no limit | `NOTION_MAX_PAGES` | A Notion selection with more pages is refused |
| Max files per Google Drive library | `10000` | 1–100000, or no limit | `GOOGLE_DRIVE_MAX_FILES` | A Google Drive selection with more Docs and Slides is refused |
| Max work items per Azure DevOps library | `20000` | 1–200000, or no limit | `AZURE_DEVOPS_MAX_WORK_ITEMS` | An Azure DevOps library indexes the newest matching work items up to this limit, and shows a warning |

<Frame>
  <img src="/images/enterprise/settings/parsing-settings.png" alt="The Parsing settings page with concurrency, timeout, and file limit settings" />
</Frame>

### Git Access Tokens

Configured under **Workspace Settings › GitHub**, **GitLab** and **Other Git** in the web UI.

| Setting | Description |
|---|---|
| GitHub Token | GitHub Personal Access Token. Required for GitHub repositories |
| GitLab Token | GitLab token. Required for GitLab repositories |
| GitLab **Server URL** | Your self-hosted GitLab host, such as `gitlab.your-company.com`. In the **GitLab** row, select **Self-managed**, then enter it in **Server URL** |

You only need tokens for the platforms you use. If you only parse GitLab repos, you don't need a GitHub token, and vice versa. Create tokens with `repo` scope (GitHub) or `read_repository` scope (GitLab) for private repository access.

The GitLab token is sent only to `gitlab.com` and the host in **Server URL**.

## Access Control

The server creates an `admin` account with the password `admin` at first boot. Change these credentials immediately after setup from **Personal settings > Password > Change password**.

Who can do what by default:

- **Admins** can do everything.
- **Signed-in members and their API keys** can parse and refresh libraries. To re-parse or replace an existing library, a member needs read access to it under the [library access rules](/enterprise/security/library-access).
- **Anonymous callers** (no session and no API key) can do none of these.

Delete, cancel parse, and support bundle downloads are for admins only. Use the switches in **Workspace Settings › Authorization** to open some actions to anonymous callers. The **MCP authentication** switch in **Workspace Settings › Authentication** requires authentication for MCP and API search.

<Frame>
  <img src="/images/enterprise/settings/non-admin-permissions.png" alt="The Non-admin permissions card with the anonymous parse, refresh, support bundle, and delete switches off" />
</Frame>

| Permission | Default | Description |
|---|---|---|
| Parse repositories | Off | Allow anonymous callers to trigger parsing. Source code indexing and CodeDocs generation always need a session or a personal API key |
| Refresh repositories | Off | Allow anonymous callers to refresh libraries. Notion, Google Drive, and Azure DevOps libraries stay admin-only, and a library with source code indexing needs a session or a personal API key |
| Delete repositories | Off | Allow anonymous callers and members to delete libraries and cancel parses |
| Download support bundle | Off | Allow anonymous callers and members to download the support bundle |
| MCP authentication | On for a new install | Require a session or personal API key for `/mcp`, `/api/v2`, and the library, log, and queue read endpoints. The mode chooses whether `/mcp` accepts personal API keys, OAuth access tokens, or both. See [Authentication](/enterprise/api/authentication#non-admin-permissions) and [OAuth Sign-In for MCP Clients](/enterprise/security/mcp-oauth) |

<Note>
Earlier versions allowed anonymous parse and refresh by default. If you never saved these switches, they are off after an upgrade. Scripts that call these endpoints without an API key then get `403`. Add a personal API key to the script, or turn the switch on.
</Note>

A fresh install with no users, no existing admin, and no libraries starts with MCP authentication on. An install you upgrade keeps the setting you saved, so if you never turned it on it stays off.

When MCP authentication is enabled, each user creates personal keys from **Personal settings > API keys**. Clients send the key as `Authorization: Bearer <key>`. With [OAuth sign-in](/enterprise/security/mcp-oauth), clients sign in through the browser instead, and users manage them under **Personal settings > Authorized apps**.

When MCP authentication is off, a client that sends a valid personal API key is still treated as that user for [library access](/enterprise/security/library-access), so it reads the restricted libraries the user can access. A client with no key, or an unknown key, is anonymous and reads only libraries that are open to everyone.

### Recover admin access

Lost the admin password, or locked out by a broken SSO setup? Run the `reset-password` script inside the container. It resets a local admin account and turns password sign-in back on. See [Docker](/enterprise/deployment/docker#recover-admin-access) or [Kubernetes](/enterprise/deployment/kubernetes#recover-admin-access).

## Policies

Policies let you control which public documentation from the Context7 cloud is accessible to your on-premise instance. They do not affect locally parsed on-premise content.

Open **Workspace Settings › Content policies**. Requires admin login and a valid `LICENSE_KEY`.

For details on source type toggles and library filters, see [Customizing What Is Retrieved](/security/data-privacy#customizing-what-is-retrieved).

## Network and Data Flow

Besides your AI providers, git hosts, and connected sources, an instance with an online license contacts Context7 Cloud:

| Call | When | What is sent |
|---|---|---|
| License check | Every hour | The license key |
| Usage report | Once a day | License key, call counts per endpoint, number of active API keys, app version, team size. No query text |
| Public library search | On each library search | The search text and library name, with secrets masked first |
| Public library context | On a context query for a library that is not on this instance | The query, with secrets masked first, and the public library ID |

A context query for one of your local libraries is answered on the instance and sends nothing. No local library content or ID is sent. Per-user usage stays on the instance.

An offline license (`ctx7off.` prefix) is checked locally and makes none of these calls.

For every destination the instance can contact, including AI providers, sources, and sign-in, see [Outbound connections](/enterprise/security/outbound-connections).

To send this traffic through a forward proxy, set `HTTPS_PROXY`, as [Egress proxy](/enterprise/deployment/docker#egress-proxy) describes. For the full egress list, `CONTEXT7_API_URL`, and private CA setup, see [Docker](/enterprise/deployment/docker#network-access) or [Kubernetes](/enterprise/deployment/kubernetes#networking-requirements).

## Hosting

- Serve Context7 at the root of a host name, such as `https://context7.internal.yourcompany.com`. Hosting under a sub-path is not supported.
- Behind a reverse proxy, Context7 uses `X-Forwarded-Host` and `X-Forwarded-Proto` to build SSO redirect URLs. Configure the proxy to set these headers and overwrite any values the client sends.

## Web UI

Open your deployment URL in a browser to access the dashboard. From here you can:

- Add and remove libraries
- Trigger re-indexing
- Monitor parsing status and logs
- Update AI provider settings, git tokens, and permissions
- Configure policies for public cloud documentation access
- Test MCP connectivity
- Change admin credentials

## Operations

For updating, health checks, and other operational tasks, see the deployment guide for your platform:

- [Docker Operations](/enterprise/deployment/docker#operations)
- [Kubernetes Operations](/enterprise/deployment/kubernetes#operations)

## Support

For license issues, upgrade requests, or deployment questions, contact [context7@upstash.com](mailto:context7@upstash.com).
