Skip to content
Open

Docs #927

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,5 @@ dist
# Finder (MacOS) folder config
.DS_Store
package-lock.json

prompt.txt
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

[![Website](https://img.shields.io/badge/Website-context7.com-blue)](https://context7.com) [![smithery badge](https://smithery.ai/badge/@upstash/context7-mcp)](https://smithery.ai/server/@upstash/context7-mcp) [![NPM Version](https://img.shields.io/npm/v/%40upstash%2Fcontext7-mcp?color=red)](https://www.npmjs.com/package/@upstash/context7-mcp) [![MIT licensed](https://img.shields.io/npm/l/%40upstash%2Fcontext7-mcp)](./LICENSE)

[![繁體中文](https://img.shields.io/badge/docs-繁體中文-yellow)](./docs/README.zh-TW.md) [![简体中文](https://img.shields.io/badge/docs-简体中文-yellow)](./docs/README.zh-CN.md) [![日本語](https://img.shields.io/badge/docs-日本語-b7003a)](./docs/README.ja.md) [![한국어 문서](https://img.shields.io/badge/docs-한국어-green)](./docs/README.ko.md) [![Documentación en Español](https://img.shields.io/badge/docs-Español-orange)](./docs/README.es.md) [![Documentation en Français](https://img.shields.io/badge/docs-Français-blue)](./docs/README.fr.md) [![Documentação em Português (Brasil)](<https://img.shields.io/badge/docs-Português%20(Brasil)-purple>)](./docs/README.pt-BR.md) [![Documentazione in italiano](https://img.shields.io/badge/docs-Italian-red)](./docs/README.it.md) [![Dokumentasi Bahasa Indonesia](https://img.shields.io/badge/docs-Bahasa%20Indonesia-pink)](./docs/README.id-ID.md) [![Dokumentation auf Deutsch](https://img.shields.io/badge/docs-Deutsch-darkgreen)](./docs/README.de.md) [![Документация на русском языке](https://img.shields.io/badge/docs-Русский-darkblue)](./docs/README.ru.md) [![Українська документація](https://img.shields.io/badge/docs-Українська-lightblue)](./docs/README.uk.md) [![Türkçe Doküman](https://img.shields.io/badge/docs-Türkçe-blue)](./docs/README.tr.md) [![Arabic Documentation](https://img.shields.io/badge/docs-Arabic-white)](./docs/README.ar.md) [![Tiếng Việt](https://img.shields.io/badge/docs-Tiếng%20Việt-red)](./docs/README.vi.md)
[![繁體中文](https://img.shields.io/badge/docs-繁體中文-yellow)](./i18n/README.zh-TW.md) [![简体中文](https://img.shields.io/badge/docs-简体中文-yellow)](./i18n/README.zh-CN.md) [![日本語](https://img.shields.io/badge/docs-日本語-b7003a)](./i18n/README.ja.md) [![한국어 문서](https://img.shields.io/badge/docs-한국어-green)](./i18n/README.ko.md) [![Documentación en Español](https://img.shields.io/badge/docs-Español-orange)](./i18n/README.es.md) [![Documentation en Français](https://img.shields.io/badge/docs-Français-blue)](./i18n/README.fr.md) [![Documentação em Português (Brasil)](<https://img.shields.io/badge/docs-Português%20(Brasil)-purple>)](./i18n/README.pt-BR.md) [![Documentazione in italiano](https://img.shields.io/badge/docs-Italian-red)](./i18n/README.it.md) [![Dokumentasi Bahasa Indonesia](https://img.shields.io/badge/docs-Bahasa%20Indonesia-pink)](./i18n/README.id-ID.md) [![Dokumentation auf Deutsch](https://img.shields.io/badge/docs-Deutsch-darkgreen)](./i18n/README.de.md) [![Документация на русском языке](https://img.shields.io/badge/docs-Русский-darkblue)](./i18n/README.ru.md) [![Українська документація](https://img.shields.io/badge/docs-Українська-lightblue)](./i18n/README.uk.md) [![Türkçe Doküman](https://img.shields.io/badge/docs-Türkçe-blue)](./i18n/README.tr.md) [![Arabic Documentation](https://img.shields.io/badge/docs-Arabic-white)](./i18n/README.ar.md) [![Tiếng Việt](https://img.shields.io/badge/docs-Tiếng%20Việt-red)](./i18n/README.vi.md)

## ❌ Without Context7

Expand Down Expand Up @@ -43,7 +43,7 @@ No tab-switching, no hallucinated APIs that don't exist, no outdated code genera

## 📚 Adding Projects

Check out our [project addition guide](./docs/adding-projects.md) to learn how to add (or update) your favorite libraries to Context7.
Check out our [project addition guide](https://context7.com/docs/adding-libraries) to learn how to add (or update) your favorite libraries to Context7.

## 🛠️ Installation

Expand Down
160 changes: 160 additions & 0 deletions docs/adding-libraries.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
---
title: Library Owners
---

Context7 allows you to add your favorite libraries and frameworks so developers always receive current, trustworthy documentation inside their coding environment.

## Quick Submission

The fastest way to add a library is through our web interface:

**[Submit a Library ->](https://context7.com/add-library?tab=github)**

1. Paste the GitHub repository URL.
2. (Optional) Adjust folders and exclusions.
3. Submit and let Context7 parse and index the documentation.

You'll receive an email notification when parsing finishes. You can also monitor progress from the library detail page (e.g., `context7.com/owner/repo`).

## Advanced Configuration with `context7.json`

For more control over how Context7 parses and presents your library, you can add a `context7.json` file to the root of your repository. This file works similarly to `robots.txt` and tells Context7 how to handle your project.

### Configuration Fields

Here's an example `context7.json` file with all available options:

```json
{
"$schema": "https://context7.com/schema/context7.json",
"projectTitle": "Upstash Ratelimit",
"description": "Ratelimiting library based on Upstash Redis",
"folders": [],
"excludeFolders": ["src"],
"excludeFiles": [],
"rules": ["Use Upstash Redis as a database", "Use single region set up"],
"previousVersions": [
{
"tag": "v1.2.1"
}
]
}
```

<Note>
**Pro Tip**: Including the `$schema` field enables autocomplete, validation, and helpful tooltips
in modern code editors like VS Code, making it easier to create and maintain your configuration.
</Note>

## Field Descriptions

- **`projectTitle`** (string): Suggested display name for your project in Context7. Only used when the LLM cannot generate a name with high confidence.

- **`description`** (string): Suggested description for your project in Context7. Only used when the LLM cannot generate a description with high confidence.

- **`branch`** (string): The name of the git branch to parse. If not provided, the default branch will be used.

- **`folders`** (array): Specific folder paths to include when parsing. If empty, Context7 scans the entire repository. Root-level markdown files are always included.

- **`excludeFolders`** (array): Patterns to exclude from documentation parsing. Supports simple names, paths, and glob patterns (see Exclusion Patterns below).

- **`excludeFiles`** (array): Specific file names to exclude. Use only the filename, not the full path. Examples: `CHANGELOG.md`, license files, or non-documentation content.

- **`rules`** (array): Best practices or important guidelines that coding agents should follow when using your library. These appear as recommendations in the documentation context provided to coding agents.

- **`previousVersions`** (array): Information about previous versions of your library that should also be available in Context7.
- **`tag`**: The Git tag or version identifier

- **`branchVersions`** (array): Information about previous versions (branch-based) of your library that should also
be available in Context7.
- **`branch`**: The Git branch

### Exclusion Patterns

The `excludeFolders` parameter supports various pattern types for flexible exclusion:

- **Simple folder names**: `"node_modules"` - Excludes any folder named "node_modules" anywhere in the tree
- **Root-specific patterns**: `"./xyz"` - Excludes the folder only at repository root (e.g., excludes `/xyz` but not `/dist/xyz`)
- **Path patterns**: `"app-sdk/v2.3"` - Excludes specific paths and everything under them
- **Glob patterns**: `"*.test"`, `"temp*"` - Excludes folders matching the pattern
- **Globstar patterns**: `"**/dist"`, `"docs/**/internal"` - Advanced path matching
- **Complex patterns**: `"src/**/*.test.js"` - Exclude test files in the src directory

Examples:

- `"node_modules"` - Excludes all node_modules folders anywhere
- `"./build"` - Excludes the build folder only at root (not `src/build`)
- `"app-sdk/v2.3"` - Excludes the app-sdk/v2.3 path and all its contents
- `"*.test"` - Excludes folders ending with .test
- `"docs/**/internal"` - Excludes any "internal" folder under docs
- `"**/temp"` - Excludes any folder named "temp" anywhere

### Default Exclusions

If you don't specify `excludeFiles` or `excludeFolders` in your `context7.json` file, Context7 uses these default patterns:

#### Default Excluded Files

```
CHANGELOG.md, changelog.md, CHANGELOG.mdx, changelog.mdx
LICENSE.md, license.md
CODE_OF_CONDUCT.md, code_of_conduct.md
```

#### Default Excluded Folders

```
*archive*, *archived*, old, docs/old, *deprecated*, *legacy*
*previous*, *outdated*, *superseded*
i18n/zh*, i18n/es*, i18n/fr*, i18n/de*, i18n/ja*, i18n/ko*
i18n/ru*, i18n/pt*, i18n/it*, i18n/ar*, i18n/hi*, i18n/tr*
i18n/nl*, i18n/pl*, i18n/sv*, i18n/vi*, i18n/th*
zh-cn, zh-tw, zh-hk, zh-mo, zh-sg
```

These defaults help coding agents avoid irrelevant, outdated, and non-technical content.

## Who Can Manage Configuration?

- **Library authors**: Add `context7.json` directly to your repository
- **Contributors**: Submit pull requests to add or update the configuration
- **Community members**: Propose improvements to the way popular libraries are parsed

## Best Practices

1. **Keep descriptions concise**: One sentence explaining your library's purpose. Example: "Serverless Redis SDK for edge and browser environments."
2. **Exclude irrelevant folders**: Use `excludeFolders` to skip source code, tests, or build artifacts. Example: `["src", "test", "dist", "node_modules"]`
3. **Add helpful rules**: Include common gotchas or best practices. Example: "Always call `.close()` on Redis connections" or "Use environment variables for API keys, never hardcode them"
4. **Maintain version history**: Keep important previous versions accessible. Users on v1.x still need v1.x documentation, not just the latest v2.x

## Adding a Version

To add a new version to your existing library:

1. **Add version to the `context7.json` file**: Update the `previousVersions` array with your new version:

```json
"previousVersions": [
{
"tag": "v2.0.0",
"title": "version 2.0.0"
}
]
```

<Note>The `tag` value must exactly match an existing Git tag in your GitHub repository.</Note>

2. **Refresh your library**: Go to your library page on Context7 and trigger a refresh to index the new version.
3. **Confirm availability**: Search for the new version or run `resolve-library-id` from an MCP client to confirm it appears in results.

## Monitor Parsing and Quality

Keep documentation helpful for agents:

- Review the rendered documentation after each release
- Trim noisy sections (e.g., large changelogs) with `excludeFiles` or `excludeFolders`
- Update `rules` when best practices change, so AI assistants surface current guidance

## Need Help?

If you encounter issues or need assistance adding your project, please [open an issue](https://github.com/upstash/context7/issues/new/choose) or reach out to our community.
155 changes: 0 additions & 155 deletions docs/adding-projects.md

This file was deleted.

Loading