Context7 MCP

Get documentation context

Retrieve intelligent, LLM-reranked documentation context for natural language queries. Returns the most relevant code snippets and documentation for your specific question.
1 min read
get/v2/context
Request example
Response
get/v2/context

Query parameters

libraryIdstringrequired#
Context7-compatible library ID — the URL path of the library on context7.com. Use /owner/repo for GitHub repositories, or /<source>/<id> for other sources (websites, llms.txt, GitLab/Bitbucket, etc.). Optionally suffix with /<version> or @<version> to pin a specific version. See Library ID format.

Length: 1–500Pattern: ^/[^/]+/[^/]+([/@][^/]+)?$

querystringrequired#
User's original question or task - used for intelligent relevance ranking

Length: 1–500

typeenum<string>#
Response format type

Default: "txt"

Options:jsontxt
fastenum<string>#
When true, skip LLM reranking and return top vector-search results directly. Trades relevance quality for lower latency.

Default: "false"

Options:truefalse

Responses

Documentation context
codeSnippetsobject[]required#
Relevant code snippets
Show child attributes
codeTitlestringrequired#
Title of the code snippet
codeDescriptionstringrequired#
Description of what the code does
codeLanguagestringrequired#
Primary programming language
codeTokensintegerrequired#
Token count for the snippet
codeIdstringrequired#
URL to source location
pageTitlestringrequired#
Title of the documentation page
codeListobject[]required#
Code examples in different languages
Show child attributes
languagestringrequired#
Programming language
codestringrequired#
The actual code content
isDynamicboolean#
Whether this snippet was recovered from the dynamic source-code index instead of the primary docs index
sourceFilestring#
Repo-relative source file path for dynamic snippets
infoSnippetsobject[]required#
Relevant documentation snippets
Show child attributes
pageIdstring#
URL to source page
breadcrumbstring#
Navigation breadcrumb path
contentstringrequired#
The documentation content
contentTokensintegerrequired#
Token count for the content
rulesobject#
Optional library-specific rules and guidelines
Show child attributes
globalstring[]#
Global team rules
libraryOwnstring[]#
Rules defined by the library owner
libraryTeamstring[]#
Library-specific rules from the team