What you can do
- Search your own documents. Put them in a collection, by API or by syncing an S3 bucket, then search and count them by exact text or regex, filtered by metadata.
- Give it to your agent. The MCP server has the same calls as tools, for Claude, Cursor, Codex and any MCP client.
- Search the web's source. Find websites by what's in their HTML, count them, and filter them by the technologies they use (web search).
- Read a live page. Any URL as clean Markdown (fetch).
The basics
The base URL is https://stackgrep.com/api. Requests and responses are JSON, and every call needs an API key. Each call costs credits from your team's monthly pool.
It's search for agents, not a vector database: no embeddings to build or keep fresh. Agents look things up by names, ids, phrases and patterns, and get back the exact text that matched, quoted with its line.
Reading this as an agent? The whole API is in one Markdown file at /llms.txt.
Every page
QuickstartMake a collection, send it documents, search them. Every example works as written once you set STACKGREP_KEY.API keysEvery API call carries an API key. Make as many as you like, one per app or agent, and cap what each can spend.CollectionsA collection is a named set of documents: invoices, contracts, support tickets, a codebase. Each is searched on its own.DocumentsSend documents as JSON: an id, the text, and any metadata you want to filter on. A write is answered only once it's safely stored.SearchFind the documents that contain some text or match a pattern. Each result quotes the match and its line, so an agent can answer without reading the whole document.Count"How many contracts mention indemnity?" gets a number. Count reads every candidate, so the answer is exact, with a sample of ids.Query syntaxPlain text is matched literally, ignoring case. Set regex=1 for a pattern. Add a filter to narrow by metadata.S3 bucket syncInstead of sending documents, point a collection at a prefix in your S3 bucket. We list it every few minutes, read what's new or changed, and drop what's gone.MCP serverGive your agent the API as tools. StackGrep's MCP server works with Claude, Claude Code, Cursor, Codex and any client that speaks remote MCP.Search website codeBesides your own documents, the API searches the HTML of the public websites we've crawled: find sites by a script URL, a tag ID, a phrase or a pattern.Fetch a pageGive it a URL, get the page as Markdown: the text an agent needs, without navigation, scripts or styling.Errors and limitsEvery error is JSON with a message written for people: {"error": "..."}. Here's what each status means and what to do about it.Pricing and creditsOne pool of credits a month, shared by the website, the API and MCP, and by everyone in your team. Unlimited API keys.
Try it on your own documentsExact and regex search for your agents, from one API. Or see the engine on npm's source first.