Skip to content

Latest commit

 

History

History
254 lines (162 loc) · 8.58 KB

File metadata and controls

254 lines (162 loc) · 8.58 KB

🌐 Context7 Integration Guide for Cesium

📖 Overview

Context7 is an MCP (Model Context Protocol) server that provides real-time access to up-to-date library documentation and code examples directly to AI coding assistants. It retrieves current documentation from source repositories instead of relying on potentially outdated LLM training data.

Repository: https://github.com/upstash/context7

💡 Why Context7 for Cesium Development

AI assistants often hallucinate non-existent APIs, incorrect parameters, and obsolete patterns when working with Cesium due to outdated training data. Context7 solves this by fetching current, version-specific documentation in real-time.

📚 Already Indexed Documentation/Website

The following Cesium-related documentation sources are available through Context7:

Documentation Original Context7 Context7 Library ID
CesiumJS API Reference CesiumJS API Context7 CesiumJS /websites/cesium_learn_cesiumjs
Cesium Repository GitHub cesium Context7 cesium /cesiumgs/cesium
Cesium for Unreal GitHub cesium-unreal Context7 cesium-unreal /cesiumgs/cesium-unreal
Cesium for Unity GitHub cesium-unity Context7 cesium-unity /cesiumgs/cesium-unity
3D Tiles Specification OGC 3D Tiles Context7 3D Tiles /websites/ogc_cs_22-025r4

⚙️ Setup Instructions

VS Code Configuration

Add to your MCP settings (.vscode/mcp.json):

Remote Server:

"mcp": {
  "servers": {
    "context7": {
      "type": "http",
      "url": "https://mcp.context7.com/mcp",
      "headers": {
        "CONTEXT7_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

Local NPX:

Use open source @upstash/context7-mcp library.

"mcp": {
  "servers": {
    "context7": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
    }
  }
}
Claude Code Configuration

Remote Server:

claude mcp add --header "CONTEXT7_API_KEY: YOUR_API_KEY" --transport http context7 https://mcp.context7.com/mcp

Local NPX:

claude mcp add context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY
Other MCP Clients

Context7 supports 30+ MCP clients beyond VS Code and Claude Desktop, including Cursor, Zed, Cline, and more. For a complete list of supported clients and their configuration instructions, see the All MCP Clients documentation.

🆓 Free Tier Limitations

The Free plan includes access to public repositories, basic access control, and 1,000 API calls per month.

Get your free API key: https://context7.com/dashboard

🚀 Usage with Cesium

📝 Basic Usage

Append use context7 to prompts when you need current Cesium documentation:

Create a Cesium Viewer with Bing Maps imagery. use context7

🎯 Library-Specific Queries

Example 1: CesiumJS API Reference

Create a Cesium Viewer with terrain enabled and Ion asset access.
use library /websites/cesium_learn_cesiumjs

Expected result: Current Viewer constructor with proper terrain configuration and Ion integration.

Example 2: Cesium Repository

How do I implement custom post-processing effects in CesiumJS?
use library /cesiumgs/cesium

Expected result: Source code examples and implementation patterns from the Cesium repository.

Example 3: Cesium for Unreal

Set up a Cesium3DTileset in Unreal Engine and configure georeference settings.
use library /cesiumgs/cesium-unreal

Expected result: Unreal-specific integration code using ACesium3DTileset and ACesiumGeoreference.

Example 4: Cesium for Unity

Add a Cesium3DTileset component to a GameObject and configure camera controls.
use library /cesiumgs/cesium-unity

Expected result: Unity-specific C# code with Cesium3DTileset and CesiumCameraController components.

Example 5: 3D Tiles Specification

Explain the tile refinement strategy for REPLACE and ADD in 3D Tiles 1.1.
use library /websites/ogc_cs_22-025r4

Expected result: Specification-compliant explanation of refinement strategies and schema details.

Example 6: Multiple Documents

Some questions require information from multiple sources. Make separate queries with different library IDs:

How does CesiumJS implement 3D Tiles batched content, and what are the specification requirements?
1. Query /cesiumgs/cesium for implementation details
2. Query /websites/ogc_cs_22-025r4 for specification requirements

Other examples requiring multiple documents:

  • Unreal + CesiumJS: "How do I load custom 3D Tiles in Unreal Engine?" (query both /cesiumgs/cesium-unreal and /websites/ogc_cs_22-025r4)
  • Cross-platform: "What are the differences in georeference setup between Unreal and Unity?" (query both /cesiumgs/cesium-unreal and /cesiumgs/cesium-unity)

🤖 Automation with Agent Skills (Recommended)

Agent Skills provide automatic activation based on context, without needing to type "use context7" or manually select instructions.

VS Code (GitHub Copilot)

Workspace-specific (recommended)
  1. Create the skill directory structure: .github/skills/cesium-context7

  2. Copy the skill content from SKILL.md to .github/skills/cesium-context7/SKILL.md

  3. Enable the chat.useAgentSkills setting in VS Code

The skill will automatically activate when you ask Cesium-related questions.

User profile (all workspaces)

To use Context7 across all your projects:

  1. Copy the skill to ~/.copilot/skills/cesium-context7/SKILL.md
  2. The skill will be available in all workspaces

See VS Code Agent Skills documentation for details.

Claude Code

Workspace-specific (recommended)
  1. Create the skill directory .claude/skills/cesium-context7

  2. Copy the skill content from SKILL.md to .claude/skills/context7/SKILL.md

The skill will automatically activate when relevant or can be invoked with /context7.

Personal (all projects)

Copy the skill to ~/.claude/skills/context7/SKILL.md for availability across all projects.

See Claude Code Skills documentation for details.

Alternative: Custom Instructions

For AI assistants that don't support Agent Skills, use custom instructions or predefined prompts instead.

🛠️ Context7 Available Tools

Context7 exposes two MCP tools:

1. resolve-library-id

Search for libraries and retrieve their Context7 library IDs.

Parameters:

  • libraryName (string): Name of the library to search
  • query (string, optional): Additional search context

Example:

Find the Context7 library ID for CesiumJS

2. query-docs

Retrieve documentation for a specific library and query.

Parameters:

  • libraryId (string): Context7 library ID (e.g., /CesiumGS/cesium)
  • query (string): Documentation query or topic
  • version (string, optional): Specific library version

Example:

Get documentation for Cesium Viewer initialization using library /CesiumGS/cesium

🔗 Resources