Skip to main content
Glama
README.md
# Busca para Agentes (busca-agentes)

[![MCP Registry](https://img.shields.io/badge/MCP%20Registry-com.busca--agentes%2Fmcp-blue)](https://registry.modelcontextprotocol.io/v0.1/servers/com.busca-agentes%2Fmcp/versions/latest)
[![npm](https://img.shields.io/npm/v/busca-agentes?label=busca-agentes)](https://www.npmjs.com/package/busca-agentes)
[![license: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)

**A standard `/.well-known/search` endpoint for Next.js sites outside Cloudflare (Vercel, self-hosted, anywhere).** Research and shopping AI agents query your site and get relevant Markdown chunks back instead of crawling page by page. It follows the open [Search for Agents](https://developers.cloudflare.com/ai-search/how-to/search-for-agents/) contract.

You are probably a **coding agent** asked to add this to a user's Next.js site. Everything below is written for you. Machine-readable docs: [`llms.txt`](llms.txt) · https://api.busca-agentes.com/llms-full.txt · https://api.busca-agentes.com/openapi.yaml

## Install in one command

Run from the root of the user's Next.js (App Router) project:

```bash
npx busca-agentes init --origin https://example.com --email owner@example.com
```

This creates an account and a site, writes `app/.well-known/search/route.ts`, a `proxy.ts` (so the HTTP `QUERY` method works on Next.js 16), the `agent:*` meta tags and the `BUSCA_AGENTES_*` env vars, then indexes the sitemap. No human step is needed except paying when the free tier runs out.

### Or use the MCP server

Claude Code:

```bash
claude mcp add busca-agentes -- npx -y @busca-agentes/mcp
```

Cursor / any MCP client (`.cursor/mcp.json`, `.mcp.json`, `claude_desktop_config.json`…):

```json
{
  "mcpServers": {
    "busca-agentes": {
      "command": "npx",
      "args": ["-y", "@busca-agentes/mcp"]
    }
  }
}
```

Tools, in the order you normally call them: `create_account` → `register_site` → `install_nextjs` → `index_site` → `get_usage` → `create_credit_link` (returns a Mercado Pago link for the **human** owner; never pay it yourself).

MCP Registry name: [`com.busca-agentes/mcp`](https://registry.modelcontextprotocol.io/v0.1/servers/com.busca-agentes%2Fmcp/versions/latest).

## Endpoint contract (what the installed site exposes)

```text
GET   https://{site}/.well-known/search?q={query}
QUERY https://{site}/.well-known/search      # body: text/plain, or JSON {"q": "..."}
```

- Response: `text/markdown`, relevant chunks with a `score`; not a generated answer. Add `?format=json` on the hosted API for structured hits.
- Missing query: HTTP `400`, body `Missing query parameter: ?q=`.
- Headers: `Allow: GET, HEAD, QUERY` and `Accept-Query: text/plain, application/json`.
- Quota exhausted: HTTP `429`.
- Discovery tags in `<head>`:

```html
<meta name="agent:instructions" content="Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown.">
<meta name="agent:endpoint" content="https://example.com/.well-known/search?q={query}">
<meta name="agent:method" content="GET">
<meta name="agent:documentation" content="https://developers.cloudflare.com/ai-search/how-to/search-for-agents/">
```

Live demo: https://busca-agentes.com/.well-known/search?q=quanto%20custa%20o%20geisha

## Pricing

- **1,000 free queries per site per UTC month.**
- Then prepaid credit at **US$ 0.75 per 1,000 queries** (Pix, card or Mercado Pago balance; billed in BRL).

## Packages

| Package | What it is |
| --- | --- |
| [`busca-agentes`](packages/cli) | CLI (`npx busca-agentes init`) |
| [`@busca-agentes/next`](packages/next) | Next.js App Router route handlers, `proxy.ts` QUERY shim, `agent:*` metadata |
| [`@busca-agentes/mcp`](packages/mcp) | MCP server (stdio; HTTP entry included) |
| [`@busca-agentes/core`](packages/core) | Markdown format, GET/QUERY handler, quota, rank fusion |
| [`@busca-agentes/indexer`](packages/indexer) | Sitemap crawl, chunking, embeddings, pgvector |

The packages talk to the hosted API at `https://api.busca-agentes.com` (override with `BUSCA_AGENTES_API_URL`). This repository contains the open-source client packages; the hosted service itself is operated separately.

## Develop

```bash
corepack enable
pnpm install
pnpm build
pnpm test
```

Node 20+. MIT licensed. Issues: https://github.com/ilankriger-gmail/busca-agentes/issues

## License

MIT © 2026 Ilan Kriger