Built by Metorial, the integration platform for agentic AI.

Learn More

    Server Summary

    • Search library documentation

    • Retrieve filtered documentation

    • Access codebase context

    • Generate technical documentation

Context7 MCP Server

A Model Context Protocol (MCP) server that provides seamless access to Context7's comprehensive library documentation database. Search across thousands of libraries, retrieve focused documentation, and integrate up-to-date reference materials directly into your AI-assisted development workflow. Perfect for developers who want instant access to reliable, curated technical documentation without leaving their development environment.

Overview

The Context7 MCP server bridges the gap between your development tools and Context7's extensive documentation repository. Instead of manually searching for library documentation or copying code examples from multiple sources, this server enables your AI assistant to fetch exactly the documentation you need, when you need it. Whether you're exploring new libraries, debugging implementation details, or seeking best practices, Context7 provides filtered, relevant documentation that helps you write better code faster.

Context7 maintains a curated collection of documentation for popular libraries and frameworks, complete with trust scores, usage statistics, and token-aware content delivery. The server intelligently handles documentation retrieval, supports topic-based filtering, and respects token limits to ensure you get precisely the information you need without overwhelming your context window.

Features

  • Intelligent Library Search: Quickly find libraries and their documentation across Context7's database with natural language queries
  • Filtered Documentation Retrieval: Fetch documentation with optional topic filtering to zero in on specific functionality
  • Token-Aware Responses: Control the size of documentation responses to manage context window usage efficiently
  • Multiple Output Formats: Receive documentation in plain text or structured JSON format depending on your needs
  • Trust Scoring: Access metadata including community trust scores and star ratings to evaluate library quality
  • Resource Templates: Direct URI-based access to documentation and search results for flexible integration

Tools

search_libraries

Search for libraries and documentation across the Context7 platform. This tool helps you discover relevant libraries based on your search terms and provides essential metadata to help you evaluate options.

Parameters:

  • query (required, string): Your search term for finding libraries. Examples include "react hook form", "next.js ssr", "vue router", or any library name or technology you're looking for.

Returns: A list of matching libraries with comprehensive metadata including repository stars, community trust scores, total token counts, and direct paths for documentation retrieval.

Use Cases:

  • Discovering libraries for specific functionality
  • Comparing similar libraries before making implementation decisions
  • Finding official documentation paths for popular frameworks
  • Exploring alternatives to libraries you're currently using

get_documentation

Retrieve detailed documentation for a specific library or repository from Context7. This powerful tool supports advanced filtering to help you extract exactly the documentation segments you need.

Parameters:

  • library_path (required, string): The library identifier path, typically in the format "organization/repository" (e.g., "vercel/next.js", "react-hook-form/documentation", "vuejs/vue-router")
  • topic (optional, string): Filter documentation by specific topic areas such as "ssr", "hooks", "routing", "authentication", "api", or any other documentation section
  • format (optional, string): Choose response format - "txt" for plain text (default) or "json" for structured data with additional metadata
  • tokens (optional, number): Set a maximum token limit for the response to manage context window usage efficiently

Returns: Complete or filtered documentation content in your chosen format, ready to be integrated into your development context.

Use Cases:

  • Retrieving comprehensive library documentation for review
  • Extracting specific documentation sections using topic filters
  • Managing context window size with token limits
  • Obtaining structured documentation data for further processing

Resource Templates

library-docs

Direct access to library documentation through a URI-based resource template. This template provides a standardized way to reference documentation resources.

URI Template: context7://library/{library_path}/docs

Query Parameters:

  • format: Output format (txt or json)
  • topic: Topic filter for focused documentation
  • tokens: Maximum token count for the response

Example URIs:

  • context7://library/vercel/next.js/docs
  • context7://library/react-hook-form/documentation/docs?topic=validation
  • context7://library/tanstack/react-query/docs?format=json&tokens=5000

search-results

Access library search results as a resource, enabling persistent references to search queries.

URI Template: context7://search/{query}

Example URIs:

  • context7://search/typescript validation libraries
  • context7://search/react state management
  • context7://search/nextjs authentication

Typical Workflows

Exploring New Libraries: Start with search_libraries to discover options, review trust scores and popularity metrics, then use get_documentation to dive deep into the most promising candidates.

Focused Learning: When you need to understand a specific feature, use get_documentation with topic filtering to retrieve only the relevant sections, keeping your context clean and focused.

Implementation Reference: Retrieve documentation for libraries you're actively using, with token limits set appropriately to leave room for your code and other context.

Comparison Research: Search for multiple libraries solving similar problems, fetch their documentation, and compare approaches, APIs, and implementation patterns side by side.

Benefits

The Context7 MCP server transforms how you access documentation during development. Rather than context-switching to browsers, parsing through lengthy docs sites, or maintaining local documentation copies, you get instant, filtered access to curated content. The trust scoring helps you make informed decisions about library adoption, while token-aware delivery ensures you never overwhelm your AI assistant's context window with unnecessary information.

By integrating documentation retrieval directly into your AI-assisted workflow, you maintain focus, reduce friction, and spend more time writing code and less time hunting for information. The combination of search, filtered retrieval, and flexible formatting makes Context7 an essential tool for modern development workflows.