Skip to content

Context7 Platform -- Up-to-date docs for AI agents

docs: document what Context7 indexes (parsed file types and source-code fallback) (#2881)

Enes Gulesdc967fa330a7
diff --git a/docs/adding-libraries.mdx b/docs/adding-libraries.mdx
index 3ee7c6a9..95204909 100644
--- a/docs/adding-libraries.mdx
+++ b/docs/adding-libraries.mdx
@@ -30,6 +30,14 @@ The fastest way to add a library is through the web interface:
This page is for **public** libraries. To add internal or private documentation, see the [Private Sources](/howto/private-sources) guide (requires a Pro or Enterprise plan).
</Note>
+## What Gets Indexed
+
+Context7 parses documentation files — `.md`, `.mdx`, `.markdown`, `.rst`, `.txt`, and `.ipynb` — and extracts the code examples and explanations they contain. Raw source code files (`.py`, `.ts`, `.go`, and so on) are not indexed when documentation is present; a library's docs are expected to show the important usage examples.
+
+If a repository contains little or no documentation content, Context7 falls back to generating examples from the source code itself. For public repositories this fallback is automatic — there is no setting to turn it on or off. For [private repositories](/howto/private-sources), generating docs from source code is opt-in: check **Generate docs** when adding the source, or pass the `generateDocs` flag via the [API](/api-guide).
+
+To control which folders and files are scanned, set included folders when submitting, or commit a `context7.json` file to the repository (see [Library Owners](/library-owners)).
+
## Maintain the Library?
If you own or maintain the library, you can take control of how it appears in Context7 — configure parsing with `context7.json`, manage versions through a web admin panel, and get higher refresh limits.
diff --git a/docs/howto/private-sources.mdx b/docs/howto/private-sources.mdx
index 4cf6bc78..ba6f89ab 100644
--- a/docs/howto/private-sources.mdx
+++ b/docs/howto/private-sources.mdx
@@ -27,6 +27,9 @@ Add private sources to Context7 to make your internal documentation available to
<Step title="Authorize access">
Authorize Context7 to access your source (if required).
</Step>
+ <Step title="Configure LLM analysis (optional)">
+ For repositories with little or no written documentation, check **Generate docs** to have Context7 generate documentation from the source code. Also available as the `generateDocs` flag in the [API](/api-guide).
+ </Step>
<Step title="Submit for parsing">
Submit the source for parsing.
</Step>
diff --git a/docs/library-owners.mdx b/docs/library-owners.mdx
index 456a988b..b6d94675 100644
--- a/docs/library-owners.mdx
+++ b/docs/library-owners.mdx
@@ -27,6 +27,8 @@ If you're the library owner, you can claim your library on Context7 to unlock a
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.
+`context7.json` controls *where* Context7 looks, not *what kind* of files it reads — see [What Gets Indexed](/adding-libraries#what-gets-indexed) for the parsed file types and the source-code fallback for repositories without documentation.
+
### Configuration Fields
Here's an example `context7.json` file with all available options:
diff --git a/docs/openapi.json b/docs/openapi.json
index 1fa290b9..68f1f101 100644
--- a/docs/openapi.json
+++ b/docs/openapi.json
@@ -458,7 +458,11 @@
"/vercel/next.js"
],
"repoFilters": {
- "minStars": 100
+ "minStars": 100,
+ "allowedLicenses": [
+ "MIT",
+ "Apache-2.0"
+ ]
}
},
"select": {
@@ -587,6 +591,39 @@
}
}
},
+ "allowPermissiveLicenses": {
+ "summary": "Restrict public repos to permissive SPDX licenses",
+ "value": {
+ "libraryFilters": {
+ "quality": {
+ "repoFilters": {
+ "allowedLicenses": {
+ "add": [
+ "MIT",
+ "Apache-2.0",
+ "BSD-3-Clause",
+ "ISC"
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "clearLicenseRestriction": {
+ "summary": "Remove all license restrictions",
+ "value": {
+ "libraryFilters": {
+ "quality": {
+ "repoFilters": {
+ "allowedLicenses": {
+ "clear": true
+ }
+ }
+ }
+ }
+ }
+ },
"allowDomain": {
"summary": "Allow libraries from a specific domain (select mode)",
"value": {
@@ -891,6 +928,10 @@
"skipVersionFiltering": {
"type": "boolean",
"description": "Skip filtering out version-specific documentation pages"
+ },
+ "generateDocs": {
+ "type": "boolean",
+ "description": "Generate documentation from the repository source code. Applies to private repository submissions."
}
}
},
@@ -1998,6 +2039,10 @@
"skipVersionFiltering": {
"type": "boolean",
"description": "Skip filtering out version-specific documentation pages"
+ },
+ "generateDocs": {
+ "type": "boolean",
+ "description": "Generate documentation from the repository source code. Applies to private repository submissions."
}
}
},
@@ -2122,10 +2167,18 @@
"type": "integer",
"nullable": true,
"description": "Minimum GitHub stars required"
+ },
+ "allowedLicenses": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "SPDX license identifiers (e.g. 'MIT', 'Apache-2.0') that are allowed. Empty array means no license restriction. Applies to public repos only; non-repo source types pass through."
}
},
"required": [
- "minStars"
+ "minStars",
+ "allowedLicenses"
]
},
"websiteFilters": {
@@ -2223,6 +2276,34 @@
}
}
},
+ "LicenseListOperation": {
+ "type": "object",
+ "description": "Incremental add/remove operation on a list of SPDX license identifiers. Use 'clear' to remove all entries at once.",
+ "properties": {
+ "add": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "pattern": "^[A-Za-z0-9.+\\-_]+$",
+ "maxLength": 64
+ },
+ "description": "SPDX license identifiers to add (e.g. 'MIT', 'Apache-2.0', 'BSD-3-Clause')"
+ },
+ "remove": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "pattern": "^[A-Za-z0-9.+\\-_]+$",
+ "maxLength": 64
+ },
+ "description": "SPDX license identifiers to remove"
+ },
+ "clear": {
+ "type": "boolean",
+ "description": "Set to true to remove all entries. Cannot be used together with 'add' or 'remove'."
+ }
+ }
+ },
"PatchPoliciesRequest": {
"type": "object",
"description": "Incremental policy update. All fields are optional — only provided fields are modified. At least one of 'sourceTypes' or 'libraryFilters' must be provided.",
@@ -2314,6 +2395,9 @@
"nullable": true,
"minimum": 0,
"description": "Minimum stars threshold (null to clear)"
+ },
+ "allowedLicenses": {
+ "$ref": "#/components/schemas/LicenseListOperation"
}
}
},