RedPlanetHQ/core

New Integration: Context7 MCP

开放

#536 创建于 2026年2月24日

 (1 条评论) (0 个反应) (0 位负责人)TypeScript (184 个派生)auto 404
enhancementgood first issueintegrationnew-featurenew-integration

仓库指标

星标
 (1,930 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Description

Add Context7 MCP integration to provide up-to-date, version-specific code documentation and examples directly into CORE via the Model Context Protocol.

Reference Implementations

Existing Integrations (use as templates)

  • integrations/github/ - Developer tooling integration
  • integrations/linear/ - For reference
  • integrations/slack/ - For reference

Required Files Structure

integrations/context7-mcp/
├── src/
│   ├── index.ts          # Main entry, MCP/API spec
│   ├── schedule.ts       # Sync logic
│   ├── utils.ts          # Context7 API utilities
│   ├── account-create.ts # Auth setup
│   └── create-activity.ts # Activity formatting (optional)
├── package.json
├── tsup.config.ts
└── README.md

Context7 MCP API Integration

OAuth Setup

  • Use API Key or OAuth 2.0 (MCP OAuth specification)
  • Context7 supports both:
    • API Key: Free key from https://context7.com/dashboard for higher rate limits
    • OAuth 2.0: MCP OAuth spec via /mcp/oauth endpoint
  • MCP Server Endpoint: https://mcp.context7.com/mcp
  • OAuth Endpoint: https://mcp.context7.com/mcp/oauth
  • NPX-based local server: npx -y @upstash/context7-mcp

Key Endpoints / MCP Tools

Context7 operates as an MCP (Model Context Protocol) server and exposes tools rather than traditional REST endpoints:

  • resolve-library-id - Search for a library by name and get its Context7-compatible ID
  • get-library-docs - Fetch up-to-date documentation for a specific library using its Context7 ID

HTTP API (if applicable)

  • POST /mcp - MCP protocol endpoint (JSON-RPC)
  • POST /mcp/oauth - OAuth-authenticated MCP endpoint

Events to Track

  1. Documentation Queries

    • Library documentation lookups
    • Library search queries
    • Version-specific doc retrievals
  2. Library Activity

    • New libraries indexed
    • Documentation updates detected
    • Popular libraries tracked
  3. Usage Patterns

    • Frequently queried libraries
    • Documentation coverage gaps
    • Query patterns and trends

Implementation Tasks

  • Set up basic integration structure following integrations/github/src/index.ts pattern
  • Implement API Key or MCP OAuth flow in account-create.ts
  • Create Context7 MCP client utilities in utils.ts
  • Implement sync logic in schedule.ts for documentation retrieval
  • Convert Context7 responses to CORE activity format
  • Add error handling and rate limiting
  • Create integration documentation
  • Add to integrations/README.md

Technical Notes

  • Context7 is built by Upstash and functions as an MCP (Model Context Protocol) server.
  • The MCP protocol uses JSON-RPC over HTTP or stdio transport.
  • Context7 fetches documentation from official sources in real-time, ensuring up-to-date content.
  • Free tier has rate limits; an API key from context7.com/dashboard provides higher limits.
  • The server can run locally via npx -y @upstash/context7-mcp or be accessed remotely at https://mcp.context7.com/mcp.
  • Integration should support both remote HTTP and local stdio transports.
  • Context7 is primarily a read-only service (fetching docs), so write operations are minimal.
  • The MCP protocol is still evolving; keep dependencies updated for compatibility.
  • Available as a Docker container, VS Code extension, and npm package.

Resources

Labels

enhancement, integration, new-feature

贡献者指南