ctx7 setup command configures Context7’s Model Context Protocol (MCP) server and installs the Context7 rule and skill for your AI coding agent.
Usage
Options
Agent Selection
--claude
Set up Context7 for Claude Code.
- MCP server in
~/.config/claude/mcp.json - Rule in
~/.config/claude/rules/context7.md - Skill in
~/.config/claude/skills/context7/SKILL.md
--cursor
Set up Context7 for Cursor.
- MCP server in
~/.cursor/mcp.json - Rule in
~/.cursor/rules/context7.md - Skill in
~/.cursor/skills/context7/SKILL.md
--opencode
Set up Context7 for OpenCode.
- MCP server in
~/.config/opencode/mcp.json - Rule in
~/.config/opencode/rules/context7.md - Skill in
~/.config/opencode/skills/context7/SKILL.md
Scope
-p, --project
Configure Context7 for the current project instead of globally.
.claude/mcp.json(for Claude Code).cursor/mcp.json(for Cursor).config/opencode/mcp.json(for OpenCode)
Project-level configuration overrides global configuration for that specific project.
Authentication
--api-key <key>
Use API key authentication instead of OAuth.
--oauth
Use OAuth endpoint where the IDE handles the authentication flow.
Other Options
-y, --yes
Skip confirmation prompts and use detected agents.
Interactive Mode
When run without options,ctx7 setup enters interactive mode:
Step 1: Agent Selection
The CLI detects installed agents and prompts you to select which ones to configure:Step 2: Authentication
The CLI automatically authenticates you with Context7:- Opens your browser to the login page
- You authenticate with Context7
- The CLI receives the authentication token
- Generates an API key for the MCP server
Step 3: Configuration
The CLI configures each selected agent:What Gets Configured
MCP Server
The MCP server entry is added to your agent’s configuration file:Rule File
A rule file is created that instructs your agent on how to use Context7:Skill File
A skill file is created that provides specialized instructions for using Context7:Examples
Global Setup for Claude Code
Project-Level Setup for Multiple Agents
Setup with Custom API Key
Automated Setup
Troubleshooting
Already Configured
If Context7 is already configured for an agent, it will be marked as such:Permission Errors
If you encounter permission errors:Authentication Failed
If authentication fails:- Check your internet connection
- Try again:
ctx7 setup - Use a custom API key:
ctx7 setup --api-key <key>
MCP Server Not Working
After setup, restart your AI coding agent to load the new MCP configuration.Configuration Files
Global Configuration Paths
Project Configuration Paths
Next Steps
After setup:- Restart your AI coding agent
- Test the Context7 MCP server by asking your agent to search for documentation
- Install additional skills:
ctx7 skills search <topic>