Skip to main content
Glama

Context7 MCP — актуальная документация по коду для любого запроса

Веб-сайт значок кузнеца

中文文档 한국어 문서 Документация на испанском языке Документация на французском языке Документация в Португалии (Бразилия) Documentazione на итальянском Документы на индонезийском языке Документация на немецком языке Документация на английском языке Türkçe Doküman Документация на арабском языке

❌ Без контекста7

LLM полагаются на устаревшую или общую информацию о библиотеках, которые вы используете. Вы получаете:

  • ❌ Примеры кода устарели и основаны на данных обучения годичной давности

  • ❌ Галлюцинаторных API даже не существует

  • ❌ Общие ответы для старых версий пакетов

Related MCP server: docs-mcp-server

✅ С Context7

Context7 MCP извлекает актуальную документацию и примеры кода для конкретной версии прямо из источника и помещает их прямо в командную строку.

Добавьте use context7 в приглашение в Cursor:

Create a basic Next.js project with app router. use context7
Create a script to delete the rows where the city is "" given PostgreSQL credentials. use context7

Context7 загружает актуальные примеры кода и документацию прямо в ваш контекст LLM.

  • 1️⃣ Пишите подсказку естественно

  • 2️⃣ Скажите LLM use context7

  • 3️⃣ Получите рабочие ответы кода

Никаких переключений между вкладками, никаких несуществующих API-интерфейсов, никаких генераций устаревшего кода.

🛠️ Начало работы

Требования

  • Node.js >= v18.0.0

  • Cursor, Windsurf, Claude Desktop или другой MCP-клиент

Установка через Smithery

Чтобы автоматически установить Context7 MCP Server для Claude Desktop через Smithery :

npx -y @smithery/cli install @upstash/context7-mcp --client claude

Установить в курсоре

Перейдите в: Settings -> Cursor Settings -> MCP -> Add new global MCP server

Вставка следующей конфигурации в файл Cursor ~/.cursor/mcp.json является рекомендуемым подходом. Вы также можете установить в определенном проекте, создав .cursor/mcp.json в папке вашего проекта. См. документацию Cursor MCP для получения дополнительной информации.

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"]
    }
  }
}
{
  "mcpServers": {
    "context7": {
      "command": "bunx",
      "args": ["-y", "@upstash/context7-mcp"]
    }
  }
}
{
  "mcpServers": {
    "context7": {
      "command": "deno",
      "args": ["run", "--allow-env", "--allow-net", "npm:@upstash/context7-mcp"]
    }
  }
}

Установить в виндсерфинг

Добавьте это в файл конфигурации Windsurf MCP. Для получения дополнительной информации см. документацию Windsurf MCP .

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"]
    }
  }
}

Установить в VS Code

Добавьте это в файл конфигурации VS Code MCP. Для получения дополнительной информации см. документацию VS Code MCP.

{
  "servers": {
    "Context7": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"]
    }
  }
}

Установить в Zed

Его можно установить через Zed Extensions или добавить в Zed settings.json . Для получения дополнительной информации см. документацию Zed Context Server.

{
  "context_servers": {
    "Context7": {
      "command": {
        "path": "npx",
        "args": ["-y", "@upstash/context7-mcp"]
      },
      "settings": {}
    }
  }
}

Установить в коде Клода

Запустите эту команду. Подробнее см. в документации Claude Code MCP .

claude mcp add context7 -- npx -y @upstash/context7-mcp

Установить на рабочий стол Клода

Добавьте это в файл Claude Desktop claude_desktop_config.json . Для получения дополнительной информации см. документацию Claude Desktop MCP .

{
  "mcpServers": {
    "Context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"]
    }
  }
}

Установить в BoltAI

Откройте страницу «Настройки» приложения, перейдите в раздел «Плагины» и введите следующий JSON-код:

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"]
    }
  }
}

После сохранения введите в чате get-library-docs , а затем идентификатор вашей документации Context7 (например, get-library-docs /nuxt/ui ). Более подробная информация доступна на сайте документации BoltAI . Для BoltAI на iOS см. это руководство .

Использование Докера

Если вы предпочитаете запустить сервер MCP в контейнере Docker:

  1. Создайте образ Docker:

    Сначала создайте Dockerfile в корне проекта (или в любом другом месте по вашему усмотрению):

    FROM node:18-alpine
    
    WORKDIR /app
    
    # Install the latest version globally
    RUN npm install -g @upstash/context7-mcp
    
    # Expose default port if needed (optional, depends on MCP client interaction)
    # EXPOSE 3000
    
    # Default command to run the server
    CMD ["context7-mcp"]

    Затем соберите образ, используя тег (например, context7-mcp ). Убедитесь, что Docker Desktop (или демон Docker) запущен. Выполните следующую команду в том же каталоге, где вы сохранили Dockerfile :

    docker build -t context7-mcp .
  2. Настройте свой MCP-клиент:

    Обновите конфигурацию клиента MCP для использования команды Docker.

    Пример для cline_mcp_settings.json:

    {
      "mcpServers": {
        "Сontext7": {
        "autoApprove": [],
        "disabled": false,
        "timeout": 60,
          "command": "docker",
          "args": ["run", "-i", "--rm", "context7-mcp"],
          "transportType": "stdio"
        }
      }
    }

    Примечание: Это пример конфигурации. Пожалуйста, обратитесь к конкретным примерам для вашего клиента MCP (например, Cursor, VS Code и т. д.) ранее в этом README, чтобы адаптировать структуру (например, mcpServers vs servers ). Также убедитесь, что имя образа в args соответствует тегу, используемому во время команды docker build .

Установить в Windows

Конфигурация в Windows немного отличается по сравнению с Linux или macOS ( в примере используется Cline ). Тот же принцип применим и к другим редакторам; см. конфигурацию command и args .

{
  "mcpServers": {
    "github.com/upstash/context7-mcp": {
      "command": "cmd",
      "args": [
        "/c",
        "npx",
        "-y",
        "@upstash/context7-mcp"
      ],
      "disabled": false,
      "autoApprove": []
    }
  }
}

Переменные среды

  • DEFAULT_MINIMUM_TOKENS : Установите минимальное количество токенов для поиска документации (по умолчанию: 10000).

Примеры:

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"],
      "env": {
        "DEFAULT_MINIMUM_TOKENS": "10000"
      }
    }
  }
}

Доступные инструменты

  • resolve-library-id : преобразует общее имя библиотеки в идентификатор библиотеки, совместимый с Context7.

    • libraryName (обязательно)

  • get-library-docs : извлекает документацию для библиотеки, используя идентификатор библиотеки, совместимый с Context7.

    • context7CompatibleLibraryID (обязательно)

    • topic (необязательно): сосредоточить документы на определенной теме (например, «маршрутизация», «хуки»).

    • tokens (необязательно, по умолчанию 10000): Максимальное количество возвращаемых токенов. Значения, меньшие настроенного значения DEFAULT_MINIMUM_TOKENS или значения по умолчанию 10000, автоматически увеличиваются до этого значения.

Разработка

Клонируйте проект и установите зависимости:

bun i

Строить:

bun run build

Пример локальной конфигурации

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"]
    }
  }
}

Тестирование с помощью MCP Inspector

npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp

Поиск неисправностей

ERR_MODULE_NOT_FOUND

Если вы видите эту ошибку, попробуйте использовать bunx вместо npx .

{
  "mcpServers": {
    "context7": {
      "command": "bunx",
      "args": ["-y", "@upstash/context7-mcp"]
    }
  }
}

Это часто решает проблемы с разрешением модулей, особенно в средах, где npx неправильно устанавливает или разрешает пакеты.

Вопросы разрешения ESM

Если вы столкнулись с такой ошибкой: Error: Cannot find module 'uriTemplate.js' попробуйте запустить с флагом --experimental-vm-modules :

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": [
        "-y",
        "--node-options=--experimental-vm-modules",
        "@upstash/context7-mcp"
      ]
    }
  }
}

Проблемы с TLS/сертификатом

Используйте флаг --experimental-fetch с npx , чтобы обойти проблемы, связанные с TLS:

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": [
        "-y",
        "--node-options=--experimental-fetch",
        "@upstash/context7-mcp"
      ]
    }
  }
}

Ошибки клиента MCP

  1. Попробуйте добавить @latest к имени пакета.

  2. Попробуйте использовать bunx в качестве альтернативы.

  3. Попробуйте использовать deno в качестве альтернативы.

  4. Убедитесь, что вы используете Node v18 или выше, чтобы иметь встроенную поддержку выборки с помощью npx .

Отказ от ответственности

Проекты Context7 создаются сообществом, и хотя мы стремимся поддерживать высокое качество, мы не можем гарантировать точность, полноту или безопасность всей библиотечной документации. Проекты, перечисленные в Context7, разрабатываются и поддерживаются их соответствующими владельцами, а не Context7. Если вы столкнетесь с подозрительным, ненадлежащим или потенциально опасным контентом, используйте кнопку «Сообщить» на странице проекта, чтобы немедленно уведомить нас. Мы серьезно относимся ко всем сообщениям и оперативно рассмотрим помеченный контент, чтобы сохранить целостность и безопасность нашей платформы. Используя Context7, вы признаете, что делаете это по своему усмотрению и на свой риск.

Свяжитесь с нами

Оставайтесь в курсе событий и присоединяйтесь к нашему сообществу:

  • 📢 Подпишитесь на нас в X , чтобы быть в курсе последних новостей и обновлений

  • 🌐 Посетите наш сайт

  • 💬 Присоединяйтесь к нашему сообществу Discord (если применимо)

Контекст7 в СМИ

История Звезды

Звездная история диаграммы

Лицензия

Массачусетский технологический институт

Available Tools

2 tools
query-docsQuery DocumentationA
Read-only
Inspect

Retrieves and queries up-to-date documentation and code examples from Context7 for any programming library or framework.

You must call 'resolve-library-id' first to obtain the exact Context7-compatible library ID required to use this tool, UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.

IMPORTANT: Do not call this tool more than 3 times per question. If you cannot find what you need after 3 calls, use the best information you have.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesThe question or task you need help with. Be specific and include relevant details. Good: 'How to set up authentication with JWT in Express.js' or 'React useEffect cleanup function examples'. Bad: 'auth' or 'hooks'. IMPORTANT: Do not include any sensitive or confidential information such as API keys, passwords, credentials, or personal data in your query.
libraryIdYesExact Context7-compatible library ID (e.g., '/mongodb/docs', '/vercel/next.js', '/supabase/supabase', '/vercel/next.js/v14.3.0-canary.87') retrieved from 'resolve-library-id' or directly from user query in the format '/org/project' or '/org/project/version'.

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds behavioral context beyond the readOnlyHint annotation: the 3-call limit, prerequisite step, and warning against sensitive data. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short paragraphs each serving a distinct purpose: purpose, prerequisite, limitation. Front-loaded with the core action, no redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers prerequisite, usage limit, and parameter guidance. Lacks explicit description of output format, but since the tool retrieves documentation and code examples, the output type is reasonably inferable.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema provides 100% coverage with detailed descriptions for both parameters. The tool description reinforces the relationship between libraryId and resolve-library-id but adds little semantic meaning beyond what's already in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it retrieves and queries documentation and code examples from Context7 for any library, distinguishing it from the sibling 'resolve-library-id' tool which is for obtaining library IDs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly instructs to use 'resolve-library-id' first unless user provides library ID, and imposes a 3-call limit per question, providing clear guidance on when and how many times to use.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

resolve-library-idResolve Context7 Library IDA
Read-only
Inspect

Resolves a package/product name to a Context7-compatible library ID and returns matching libraries.

You MUST call this function before 'query-docs' to obtain a valid Context7-compatible library ID UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.

Selection Process:

  1. Analyze the query to understand what library/package the user is looking for

  2. Return the most relevant match based on:

  • Name similarity to the query (exact matches prioritized)

  • Description relevance to the query's intent

  • Documentation coverage (prioritize libraries with higher Code Snippet counts)

  • Source reputation (consider libraries with High or Medium reputation more authoritative)

  • Benchmark Score: Quality indicator (100 is the highest score)

Response Format:

  • Return the selected library ID in a clearly marked section

  • Provide a brief explanation for why this library was chosen

  • If multiple good matches exist, acknowledge this but proceed with the most relevant one

  • If no good matches exist, clearly state this and suggest query refinements

For ambiguous queries, request clarification before proceeding with a best-guess match.

IMPORTANT: Do not call this tool more than 3 times per question. If you cannot find what you need after 3 calls, use the best result you have.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesThe user's original question or task. This is used to rank library results by relevance to what the user is trying to accomplish. IMPORTANT: Do not include any sensitive or confidential information such as API keys, passwords, credentials, or personal data in your query.
libraryNameYesLibrary name to search for and retrieve a Context7-compatible library ID.

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate readOnlyHint=true, which is consistent with the tool's purpose. The description adds important behavioral details beyond annotations, such as a 3-call limit per question, handling of ambiguous queries, and a warning not to include sensitive information in the 'query' parameter.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections, but it is somewhat lengthy. It front-loads the essential purpose and usage note, but the selection process details could be more succinct. Still, it remains clear and organized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given there is no output schema, the description adequately explains the response format. It covers edge cases like multiple matches, no matches, and ambiguous queries, providing complete guidance for the agent to handle various scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds value by explaining the role of each parameter: 'libraryName' is the name to search for, and 'query' is the user's original question used for ranking. It also includes a critical warning about sensitive data in 'query', which enhances understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states that the tool resolves a package/product name to a Context7-compatible library ID. It distinguishes itself from the sibling tool 'query-docs' by noting it must be called first, and includes specific details about selection criteria and response format.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly specifies when to call this tool: before 'query-docs' unless the user provides a library ID in a specific format. It also provides a detailed selection process and response format, guiding the agent on how to use the tool correctly.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 2 tool updatesv1.0.8
    • Addedquery-docs
    • Addedresolve-library-id
  2. 2 tool updatesv1.0.6
    • Removedquery-docs
    • Removedresolve-library-id
  3. 3 tool updatesv1.0.1
    • Removedget-library-docs
    • Addedquery-docs
    • Changedresolve-library-id2 fields changed
      • addedInput schema / properties / query
        Added value: +{
        +  "description": "The user's original question or task. This is used to rank library results by relevance to what the user is trying to accomplish. IMPORTANT: Do not include any sensitive or confidential information such as API keys, passwords, credentials, or personal data in your query.",
        +  "type": "string"
        +}
      • changedInput schema / required
        Previous value: -[
        -  "libraryName"
        -]New value: +[
        +  "query",
        +  "libraryName"
        +]
  4. 2 tool updatesv1.0.0
    • First observedget-library-docs
    • First observedresolve-library-id

TDQS

A4.6/5.0
Disambiguation5/5

Each tool has a distinct and complementary purpose: one resolves library names to IDs, the other queries documentation using that ID. There is no overlap.

Naming Consistency5/5

Both tools follow the same verb_noun pattern with snake_case: 'resolve-library-id' and 'query-docs'. Consistent and predictable.

Tool Count4/5

With only two tools, the surface is minimal but still covers the core workflow for querying documentation. It is slightly thin but appropriate for a focused server.

Completeness4/5

The two tools form a complete workflow: resolve then query. No obvious gaps for the stated purpose, though additional tools like list_libraries could enhance completeness.

Maintenance

ActivityActive
ResponsivenessResponsive

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • The Cortex MCP server provides read-only access to real-time engineering context from the Cortex developer portal, allowing AI coding assistants to answer natural language questions about your organization's catalog (microservices, libraries, domains, teams, infrastructure), scorecards (engineering standards and best practices), initiatives (goals and deadlines), and Engineering Intelligence metrics. It includes tools for querying documentation, tracking personal entities, and accessing AI-assisted insights across the entire Cortex ecosystem.

  • A Model Context Protocol server for Wix AI tools

  • The AWS Knowledge MCP server is a fully managed remote Model Context Protocol server that provides real-time access to official AWS content in an LLM-compatible format. It offers structured access to AWS documentation, code samples, blog posts, What's New announcements, Well-Architected best practices, and regional availability information for AWS APIs and CloudFormation resources. Key capabilities include searching and reading documentation in markdown format, getting content recommendations, listing AWS regions, and checking regional availability for services and features.

Related MCP Servers

  • F
    license
    B
    quality
    D
    maintenance
    An MCP server that fetches real-time documentation for popular libraries like Langchain, Llama-Index, MCP, and OpenAI, allowing LLMs to access updated library information beyond their knowledge cut-off dates.
    1
    3
    -
  • A
    license
    Not graded
    quality
    A
    maintenance
    A Model Context Protocol (MCP) server that scrapes, indexes, and searches documentation for third-party software libraries and packages, supporting versioning and hybrid search.
    3,262
    1,711
    MIT
  • A
    license
    C
    quality
    C
    maintenance
    A Model Context Protocol server that enables intelligent searching across documentation for 30+ programming libraries and frameworks, fetching relevant information from official sources.
    23
    8
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/upstash/context7'

If you have feedback or need assistance with the MCP directory API, please join our Discord server