Skip to content

MCP Setup & Configuration

Configuration Guide

This guide walks you through setting up and configuring MCP (Model Context Protocol) servers for use with Claude Code in the astro-basics project.

Before setting up MCP servers, ensure you have:

  • Claude Code CLI installed and configured
  • Node.js 18+ (for JavaScript-based servers)
  • Python 3.8+ (for Python-based servers)
  • Git for cloning server repositories
  • API Keys for external services (detailed below)

Install MCP servers as npm packages:

Install via NPM
# Core MCP servers
npm install -g @anthropic/mcp-server-filesystem
npm install -g @anthropic/mcp-server-github
npm install -g @anthropic/mcp-server-postgres
# Specialized servers
npm install -g @astrojs/mcp-server-docs
npm install -g @supabase/mcp-server
npm install -g @clerk/mcp-server

Create a configuration file to register your MCP servers:

  1. Create configuration directory:

    Terminal window
    mkdir -p ~/.claude-code/mcp
  2. Create server configuration (~/.claude-code/mcp/servers.json):

    {
    "servers": {
    "astro-docs": {
    "command": "npx",
    "args": ["@astrojs/mcp-server"],
    "description": "Astro framework documentation search"
    },
    "playwright": {
    "command": "node",
    "args": ["~/.mcp-servers/playwright-mcp-server/dist/index.js"],
    "description": "Browser automation and testing",
    "env": {
    "PLAYWRIGHT_BROWSERS_PATH": "/usr/bin"
    }
    },
    "supabase": {
    "command": "npx",
    "args": ["@supabase/mcp-server"],
    "description": "Database operations and project management",
    "env": {
    "SUPABASE_ACCESS_TOKEN": "${SUPABASE_ACCESS_TOKEN}"
    }
    },
    "context7": {
    "command": "npx",
    "args": ["@context7/mcp-server"],
    "description": "Library documentation retrieval"
    },
    "figma": {
    "command": "node",
    "args": ["~/.mcp-servers/figma-mcp-server/dist/index.js"],
    "description": "Design-to-code generation",
    "env": {
    "FIGMA_ACCESS_TOKEN": "${FIGMA_ACCESS_TOKEN}"
    }
    },
    "clerk": {
    "command": "npx",
    "args": ["@clerk/mcp-server"],
    "description": "Authentication and user management",
    "env": {
    "CLERK_SECRET_KEY": "${CLERK_SECRET_KEY}"
    }
    },
    "ide": {
    "command": "npx",
    "args": ["@vscode/mcp-server"],
    "description": "IDE integration and diagnostics"
    },
    "netlify": {
    "command": "node",
    "args": ["~/.mcp-servers/netlify-mcp-server/dist/index.js"],
    "description": "Deployment and hosting management",
    "env": {
    "NETLIFY_ACCESS_TOKEN": "${NETLIFY_ACCESS_TOKEN}"
    }
    },
    "web-tools": {
    "command": "npx",
    "args": ["@anthropic/mcp-server-web"],
    "description": "Web search and content fetching"
    },
    "mcp-generic": {
    "command": "npx",
    "args": ["@anthropic/mcp-server-filesystem", "--root", "./"],
    "description": "Generic MCP resource operations"
    }
    }
    }
  3. Set file permissions:

    Terminal window
    chmod 600 ~/.claude-code/mcp/servers.json

Set up the required environment variables for authenticated services:

Environment Setup
# Create environment file
cat > ~/.claude-code/mcp/.env << 'EOF'
# Supabase Configuration
SUPABASE_ACCESS_TOKEN=sb_your_access_token_here
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your_anon_key_here
# Clerk Configuration
CLERK_SECRET_KEY=sk_test_your_secret_key_here
CLERK_PUBLISHABLE_KEY=pk_test_your_publishable_key_here
# Figma Configuration
FIGMA_ACCESS_TOKEN=figd_your_access_token_here
# Netlify Configuration
NETLIFY_ACCESS_TOKEN=netlify_your_access_token_here
# GitHub Configuration (if using)
GITHUB_TOKEN=ghp_your_personal_access_token_here
EOF
# Secure the environment file
chmod 600 ~/.claude-code/mcp/.env

Required for database operations

  1. Go to Supabase Dashboard
  2. Select your project
  3. Go to Settings > API
  4. Copy the URL and anon/public key
  5. For management operations, create an access token:
    • Go to Account > Access Tokens
    • Click Generate new token
    • Copy the token

Test your MCP server configuration:

  1. Check server status:

    Terminal window
    claude-code mcp list
  2. Test individual servers:

    Terminal window
    # Test Astro docs search
    claude-code mcp test astro-docs --function search_astro_docs --args '{"query": "components"}'
    # Test Supabase connection
    claude-code mcp test supabase --function list_projects
    # Test Playwright browser
    claude-code mcp test playwright --function browser_navigate --args '{"url": "https://example.com"}'
  3. Verify authentication:

    Terminal window
    # This should return your projects/resources
    claude-code mcp test supabase --function list_projects
    claude-code mcp test clerk --function get_user_count
    claude-code mcp test netlify --function get_sites

Problem: Server command not found

Solution: Use full paths or ensure executables are in PATH

{
"command": "/usr/local/bin/node",
"args": ["/full/path/to/server/dist/index.js"]
}
  • Environment Files: Keep .env files out of version control
  • File Permissions: Set restrictive permissions (600) on config files
  • Token Rotation: Regularly rotate API tokens and access keys
  • Least Privilege: Use tokens with minimal required permissions
  • Monitoring: Monitor server logs for unauthorized access attempts

With MCP servers configured, explore:

For advanced scenarios, see:

  • Custom server development
  • Load balancing multiple server instances
  • Server monitoring and logging
  • Integration with CI/CD pipelines