MCP Setup Guide: Give Claude Code Structured Codebase Context

6 min read

The Model Context Protocol (MCP) lets AI coding tools like Claude Code request structured data from external servers. Instead of reading your files one by one, Claude Code can ask Scope for exactly the context it needs — entities, endpoints, conventions, file paths — in a single call.

This guide walks you through setting up MCP with Claude Code and Scope.

Prerequisites

  • A Scope account with a project
  • A codebase — either a connected GitHub repo or a local codebase you'll sync via MCP
  • Claude Code installed (npm install -g @anthropic-ai/claude-code)
  • Node.js 18 or later

Step 1: Get your API key

In Scope, go to Settings → API Keys and generate a new key. It will look like scope_sk_.... Copy it — you'll need it in the next step.

Step 2: Install the MCP server

Scope provides a standalone MCP server package:

npm install -g scope-mcp

Step 3: Configure Claude Code

Add Scope's MCP server to your Claude Code configuration. Create or edit~/.claude/claude_desktop_config.json:

{
  "mcpServers": {
    "scope": {
      "command": "scope-mcp",
      "env": {
        "SCOPE_API_KEY": "scope_sk_your_key_here"
      }
    }
  }
}

Step 4: Verify the connection

Start Claude Code in your project directory. You should see Scope's tools available. Test it with:

Ask Claude Code: "Use the list tool to show my projects"

If it returns your Scope projects, the connection is working.

Step 5: Sync your codebase

There are two ways to get your codebase into Scope:

  • GitHub — Connect a repo from your project settings. Scope fetches and analyzes automatically.
  • Local sync via MCP — Call scope_sync to send your local file contents directly. Works with any codebase, no GitHub required.

Step 6: Start using structured context

Now instead of Claude Code reading your files to understand the codebase, it can:

# Get the next ticket with full context
start_ticket()

# Get specific entity details
get_context(scope: "entities:User+Order")

# Search for patterns
search(query: "authentication flow", type: "context")

# Complete a ticket — saves learnings back as context for future tickets
complete_ticket(summary: "Added user endpoint", files_modified: ["src/routes/users.ts"],
  learnings: [{ type: "pattern", title: "Auth middleware", content: "Use withAuth() wrapper" }])

# Generate feature tickets from natural language
analyze({ type: "generate_feature", description: "Add Facebook OAuth login" })
# → Returns preview with proposed tickets, affected entities, file paths
# → Then apply: analyze({ type: "apply_feature", preview_id: "fp_xxx", approvals: { "0": true } })

How it changes the workflow

Without MCP, a typical Claude Code session looks like:

  1. Read 15–30 files to understand the codebase (30,000+ tokens)
  2. Plan the implementation
  3. Write code

With Scope's MCP integration:

  1. Call start_ticket() — get ticket, entities, conventions, file paths (1,500 tokens)
  2. Write code immediately
  3. Call complete_ticket() — log work, save learnings, get next action

The agent skips the entire file-reading phase because it already has structured context about your codebase. And each completed ticket feeds learnings back — patterns, gotchas, conventions — that improve context for the next ticket.

Generate features from natural language

Beyond executing tickets, Scope can create them. Describe a feature in plain English and Scope generates implementation-ready tickets grounded in your codebase:

analyze({ type: "generate_feature", description: "Add Stripe subscription billing" })
# → Preview: proposed tickets with file paths, affected entities, milestone placement
# → Review and approve, then apply to create the tickets

This is the bridge between PM thinking ("we need billing") and developer execution (specific files, migrations, endpoints). The AI agent or PM can trigger it via MCP.

What context is available

Scope exposes 13 MCP tools covering:

  • Workflowstart_ticket, complete_ticket (saves learnings back as context)
  • Contextget_context, search
  • Managementupdate_ticket, review_milestone, list
  • Learningsave_learning (patterns, gotchas, decisions, conventions)
  • Analysisanalyze (includes generate_feature + apply_feature)
  • Setupscope_discover, scope_init, scope_sync, scope_sync_status

For the full tool reference, see the MCP Tools documentation.

Next steps