Configuration

GitHub token setup and configuration options for snippets-mcp.

Configure snippets-mcp through a GitHub Personal Access Token and optional environment variables.

GitHub Token

The server requires a GitHub token with gist scope to access your GitHub Gists.

Creating a Token

  1. Go to GitHub Token Settings
  2. Select the gist scope
  3. Click Generate token
  4. Copy the token (starts with ghp_)

Storing the Token

Option A: System Keychain (recommended)

snippets-mcp --set-credential

The command prompts for your token, validates it with the GitHub API, and stores it securely in your system keychain.

Option B: Environment Variable

export GITHUB_TOKEN=ghp_your_token_here

Add to your shell profile (~/.zshrc or ~/.bashrc) to persist across sessions.

Resolution order: Environment variable takes precedence over keychain.

Platform-Specific Keychain Commands

macOS (Keychain)

# Store token
security add-generic-password -s "snippets-mcp" -a "GITHUB_TOKEN" -w "ghp_your_token"

# View stored token
security find-generic-password -s "snippets-mcp" -a "GITHUB_TOKEN" -w

# Delete token
security delete-generic-password -s "snippets-mcp" -a "GITHUB_TOKEN"

Linux (Secret Service / GNOME Keyring)

Requires libsecret-tools package (apt install libsecret-tools on Debian/Ubuntu).

# Store token
secret-tool store --label="GITHUB_TOKEN" service snippets-mcp account GITHUB_TOKEN

# Retrieve token
secret-tool lookup service snippets-mcp account GITHUB_TOKEN

# Delete token
secret-tool clear service snippets-mcp account GITHUB_TOKEN

Windows (Credential Manager)

# Store token
cmdkey /generic:"snippets-mcp:GITHUB_TOKEN" /user:"GITHUB_TOKEN" /pass:"ghp_your_token"

# List stored credentials
cmdkey /list:snippets-mcp*

# Delete token
cmdkey /delete:"snippets-mcp:GITHUB_TOKEN"

Environment Variables

VariableDescriptionDefault
GITHUB_TOKENGitHub PAT with gist scope(required)
SNIPPETS_LOG_LEVELLogging level: debug, info, warn, errorinfo
SNIPPETS_TIMEOUTAPI request timeout30s
SNIPPETS_CACHE_TTLCache time-to-live for snippet data5m

MCP Client Configuration

Snippets-mcp works with any MCP-compatible AI client. Below are setup instructions for popular clients.

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "snippets": {
      "command": "/usr/local/bin/snippets-mcp"
    }
  }
}

Restart Claude Desktop to load the server.

With environment variables:

{
  "mcpServers": {
    "snippets": {
      "command": "/usr/local/bin/snippets-mcp",
      "env": {
        "SNIPPETS_LOG_LEVEL": "debug",
        "SNIPPETS_TIMEOUT": "60s"
      }
    }
  }
}

Claude Desktop MCP Documentation

Claude Code (CLI)

Add the server using the CLI:

claude mcp add snippets /usr/local/bin/snippets-mcp

Claude Code Documentation

VS Code (GitHub Copilot)

Add to your VS Code settings.json:

{
  "github.copilot.chat.mcp.servers": {
    "snippets": {
      "command": "/usr/local/bin/snippets-mcp"
    }
  }
}

Or configure via Settings UI: search “MCP” and add the server.

VS Code MCP Documentation

Cursor

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "snippets": {
      "command": "/usr/local/bin/snippets-mcp"
    }
  }
}

Cursor MCP Documentation

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "snippets": {
      "command": "/usr/local/bin/snippets-mcp"
    }
  }
}

Windsurf MCP Documentation

Other MCP Clients

Any MCP-compatible client can use snippets-mcp. The configuration typically requires:

  • command: Path to the snippets-mcp binary
  • env (optional): Environment variables for the server

Consult your client’s documentation for the specific configuration format.

Managing Keychain Credentials

Use the platform-specific commands above to view, update, or delete stored credentials. On macOS, you can also use Keychain Access.app:

  1. Open Keychain Access
  2. Search for “snippets-mcp”
  3. Double-click to view/edit, or right-click to delete

Tips

  • Use keychain storage for local development to keep credentials out of config files
  • Use environment variables for CI/CD and automated deployments
  • Set SNIPPETS_LOG_LEVEL=debug when troubleshooting connection issues
  • Increase SNIPPETS_TIMEOUT for slow network connections