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
- Go to GitHub Token Settings
- Select the gist scope
- Click Generate token
- 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
| Variable | Description | Default |
|---|---|---|
GITHUB_TOKEN | GitHub PAT with gist scope | (required) |
SNIPPETS_LOG_LEVEL | Logging level: debug, info, warn, error | info |
SNIPPETS_TIMEOUT | API request timeout | 30s |
SNIPPETS_CACHE_TTL | Cache time-to-live for snippet data | 5m |
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
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.
Cursor
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"snippets": {
"command": "/usr/local/bin/snippets-mcp"
}
}
}
Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"snippets": {
"command": "/usr/local/bin/snippets-mcp"
}
}
}
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:
- Open Keychain Access
- Search for “snippets-mcp”
- 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=debugwhen troubleshooting connection issues - Increase
SNIPPETS_TIMEOUTfor slow network connections