All images, scripts and skills

Claude Code: connect to Context7 (MCP)

sh

Registers Context7 as a user-scoped HTTP MCP server for Claude Code, giving the agent access to current library and framework documentation. If `context7` is already registered, the script leaves it untouched. Requires the `claude` CLI on PATH. After it runs: restart Claude Code to use Context7.

What it runs

The whole script, exactly as it will execute in your workspace. Nothing is hidden — read it before you run it.

#!/usr/bin/env sh
set -eu

log() { printf '[claude-context7] %s\n' "$*"; }
die() { printf '[claude-context7] ERROR: %s\n' "$*" >&2; exit 1; }

command -v claude >/dev/null 2>&1 \
    || die "the 'claude' CLI is not on PATH — run this in a workspace that has Claude Code installed"

# This script body is piped to sh -s on stdin, so prevent the CLI from reading it.
if claude mcp get context7 >/dev/null 2>&1; then
    log "MCP server 'context7' already registered — skipping"
else
    claude mcp add --transport http --scope user context7 https://mcp.context7.com/mcp </dev/null \
        || die "claude mcp add context7 failed"
    log "added MCP server 'context7'"
fi

log "done. Restart Claude Code to use Context7."

How to get it

Open your DevGrail workspace, go to Scripts → Official scripts, and choose Download. It is copied into your own library, where you can edit it, run it, or set it as a workspace default — the copy is yours, and later changes here do not touch it.