The server
The MCP server is at https://stackgrep.com/mcp (Streamable HTTP, protocol 2025-06-18; 2025-03-26 and 2024-11-05 clients work too). It signs in two ways: an API key in the Authorization header, or OAuth, where you approve the client in your browser. Every tool only reads, so clients can call them without asking you each time, and each one says what it costs in its description.
Claude Code
claude mcp add --transport http stackgrep https://stackgrep.com/mcp \
--header "Authorization: Bearer $STACKGREP_KEY"Claude.ai and Claude Desktop
Add a custom connector with the URL https://stackgrep.com/mcp. Claude opens a StackGrep page where you sign in and approve it; there's no key to paste. Other clients that support OAuth for remote MCP servers connect the same way (we support dynamic client registration and client metadata documents).
Cursor
{
"mcpServers": {
"stackgrep": {
"url": "https://stackgrep.com/mcp",
"headers": { "Authorization": "Bearer gw_..." }
}
}
}Codex
[mcp_servers.stackgrep]
url = "https://stackgrep.com/mcp"
bearer_token_env_var = "STACKGREP_KEY"Tools
| Tool | What it does | Credits |
|---|---|---|
list_collections | Your collections, with what was written to each. | 0 |
search_collection | Exact text or regex in one collection: collection, query, regex, filter, limit. | 1 |
count_collection | Count every matching document, with a sample of ids: collection, query, regex, filter. | 5 |
get_document | Read one document whole: collection, id. | 1 |
search_source | Websites whose HTML contains some text or matches a pattern, one per site: query, regex, limit, cursor, order. | 1 |
count_sites | How many pages and sites match: query, regex. | 5 |
filter_sites | Sites by technology stack: filter, limit. | 5 |
fetch_page | One live page as Markdown: url, all, max_age, max_chars. | 1 |
Tool results are the same JSON as the REST answers (search, count, web search, fetch). A failed call comes back with isError: true and the error message as its text, so the agent can read why and try again.
Calling it by hand
curl https://stackgrep.com/mcp -H "Authorization: Bearer $STACKGREP_KEY" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": {"name": "search_collection",
"arguments": {"collection": "contracts", "query": "net 30", "filter": "customer:acme"}}}'The server also gives agents short instructions when they connect: use plain text unless a pattern is needed, count for "how many" questions, and read a whole document with get_document.