agentrank-mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,40 @@
1
+ # Ficha de listagem — AgentRank MCP (copiar/colar nos registros)
2
+
3
+ **Nome:** AgentRank — Real Business Index
4
+ **Slug/pacote:** agentrank-mcp
5
+ **Uma linha (≤80 char):** Find real, verifiable businesses with provenance — for AI agents.
6
+
7
+ **Descrição curta (≤200 char):**
8
+ An MCP server that lets your agent search a verified index of real businesses (Brazil,
9
+ US, Europe) and read profiles with source URLs — so it never invents phone numbers or
10
+ addresses.
11
+
12
+ **Descrição longa:**
13
+ AgentRank is an agent-first index of real, verifiable businesses. Every result carries
14
+ its source URL and a trust score, so agents can act on facts instead of hallucinations.
15
+ This MCP server exposes two tools — `search_businesses` (natural-language search) and
16
+ `get_business_profile` (contacts, location, hours, evidence). Free self-service key at
17
+ agentsafepath.com. ~2.7M businesses and growing, covering Brazil, the US (SEC EDGAR) and
18
+ Europe (GLEIF).
19
+
20
+ **Categorias/tags:** business, search, data, verification, local-search, companies,
21
+ provenance, agents, index
22
+
23
+ **Ferramentas:**
24
+ - `search_businesses(intent, limit=10)` — busca por intenção em linguagem natural.
25
+ - `get_business_profile(company_id)` — perfil completo com proveniência.
26
+
27
+ **Config necessária:** `AGENTRANK_API_KEY` (grátis em https://agentsafepath.com/registrar.html)
28
+
29
+ **Prompts de exemplo:**
30
+ - "Find a pharmacy in Copacabana, Rio, with a phone number."
31
+ - "List software companies in California."
32
+ - "Hotel em São Paulo com WhatsApp."
33
+
34
+ **Links:**
35
+ - Site: https://agentsafepath.com
36
+ - Registro de agente: https://agentsafepath.com/registrar.html
37
+ - API docs (agent-readable): https://api.agentrank.intelligenceofcode.com/api/agent/docs
38
+ - Termos: https://api.agentrank.intelligenceofcode.com/api/agent/terms
39
+
40
+ **Licença:** MIT (servidor MCP). Dados sob licenças das fontes (CC0/públicas).
@@ -0,0 +1,86 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentrank-mcp
3
+ Version: 0.1.0
4
+ Summary: MCP server for AgentRank / AgentIndex — search real, verifiable businesses for AI agents.
5
+ Author: AgentRank
6
+ License: MIT
7
+ Keywords: agentrank,agents,business,index,mcp
8
+ Requires-Python: >=3.10
9
+ Requires-Dist: httpx>=0.27
10
+ Requires-Dist: mcp>=1.2.0
11
+ Description-Content-Type: text/markdown
12
+
13
+ # AgentRank MCP server
14
+
15
+ Give your AI agent access to **real, verifiable businesses** — with provenance and
16
+ source URLs, so it never invents phone numbers or addresses.
17
+
18
+ This is an [MCP](https://modelcontextprotocol.io) server that exposes the
19
+ [AgentRank / AgentIndex](https://agentsafepath.com) search to any MCP client
20
+ (Claude Desktop, Cursor, and others).
21
+
22
+ ## Tools
23
+
24
+ - **`search_businesses(intent, limit=10)`** — find businesses by a natural-language
25
+ intent (e.g. `"farmácia em Copacabana com telefone"`, `"software company in California"`).
26
+ Returns ranked results with `fit_score`, `trust_score`, justification, risks and the
27
+ **source URL** of each fact.
28
+ - **`get_business_profile(company_id)`** — full profile of a result: location, contact
29
+ channels, hours, offers, policies and evidence, each with provenance and source.
30
+
31
+ ## 1. Get an API key
32
+
33
+ Register your agent (free, no invite) at
34
+ **https://agentsafepath.com/registrar.html** — you receive a key once. It identifies
35
+ your agent and is sent as `Authorization: Bearer <key>`.
36
+
37
+ ## 2. Add it to your MCP client
38
+
39
+ ### Claude Desktop
40
+
41
+ Edit `claude_desktop_config.json` (Settings → Developer → Edit Config) and add:
42
+
43
+ ```json
44
+ {
45
+ "mcpServers": {
46
+ "agentrank": {
47
+ "command": "uvx",
48
+ "args": ["agentrank-mcp"],
49
+ "env": { "AGENTRANK_API_KEY": "ak_your_key_here" }
50
+ }
51
+ }
52
+ }
53
+ ```
54
+
55
+ Restart Claude Desktop. You'll see `search_businesses` and `get_business_profile`
56
+ available. (`uvx` comes with [uv](https://docs.astral.sh/uv/); or use the "From source"
57
+ option below.)
58
+
59
+ ### Cursor
60
+
61
+ Add the same block under `mcpServers` in your Cursor MCP settings.
62
+
63
+ ### From source (no packaging)
64
+
65
+ ```bash
66
+ pip install -r requirements.txt
67
+ AGENTRANK_API_KEY=ak_your_key_here python -m agentrank_mcp.server
68
+ ```
69
+
70
+ And point your client's `command` at `python` with `args`
71
+ `["-m", "agentrank_mcp.server"]` and the folder on `PYTHONPATH`.
72
+
73
+ ## Environment variables
74
+
75
+ | Var | Required | Default |
76
+ |---|---|---|
77
+ | `AGENTRANK_API_KEY` | yes | — |
78
+ | `AGENTRANK_BASE_URL` | no | `https://api.agentrank.intelligenceofcode.com` |
79
+
80
+ The key is never logged.
81
+
82
+ ## How agents should use the data
83
+
84
+ Every result carries `sources` (source URLs). **Verify provenance before acting** —
85
+ data without a source should not be used. `trust_score` (0–100) reflects how safe the
86
+ entity is to commit to; `fit_score` reflects match to the intent.
@@ -0,0 +1,71 @@
1
+ # Publicar o AgentRank MCP (passo a passo)
2
+
3
+ Objetivo: fazer o servidor ser **descoberto** — publicando no PyPI (para `uvx
4
+ agentrank-mcp` funcionar) e no **registro oficial de MCP** (de onde agregadores como
5
+ PulseMCP e Glama puxam automaticamente).
6
+
7
+ > Substitua `SEU_USUARIO_GITHUB` pelo seu usuário do GitHub em todos os lugares.
8
+ > O nome no registro será `io.github.SEU_USUARIO_GITHUB/agentrank-mcp` — por isso o
9
+ > repo precisa estar no SEU GitHub (a autenticação prova que o namespace é seu).
10
+
11
+ ## 1. Repositório no GitHub
12
+ ```bash
13
+ cd agentrank-mcp
14
+ git init && git add -A && git commit -m "AgentRank MCP server 0.1.0"
15
+ git branch -M main
16
+ git remote add origin https://github.com/SEU_USUARIO_GITHUB/agentrank-mcp.git
17
+ git push -u origin main
18
+ ```
19
+
20
+ ## 2. Publicar no PyPI (habilita `uvx agentrank-mcp`)
21
+ Precisa de conta em https://pypi.org e um token de API (Account settings → API tokens).
22
+ ```bash
23
+ cd agentrank-mcp
24
+ python -m pip install --upgrade build twine
25
+ python -m build # gera dist/*.whl e dist/*.tar.gz
26
+ python -m twine upload dist/* # usuário: __token__ | senha: seu token pypi-...
27
+ ```
28
+ Verifique em https://pypi.org/project/agentrank-mcp/ . A partir daqui, qualquer um
29
+ roda `uvx agentrank-mcp` (com AGENTRANK_API_KEY no ambiente).
30
+
31
+ ## 3. Publicar no registro oficial de MCP
32
+ O registro guarda só metadados; o pacote (passo 2) precisa existir antes.
33
+
34
+ Instale o CLI:
35
+ ```bash
36
+ # macOS/Linux (Homebrew): brew install mcp-publisher
37
+ # ou baixe o binario da release em github.com/modelcontextprotocol/registry
38
+ ```
39
+ Gere e edite o `server.json` (já deixei um pronto neste repo — ajuste SEU_USUARIO_GITHUB
40
+ e a versão):
41
+ ```bash
42
+ mcp-publisher init # gera/atualiza server.json a partir do projeto
43
+ # confira: name = io.github.SEU_USUARIO_GITHUB/agentrank-mcp ; packages[0].registryType = "pypi"
44
+ ```
45
+ > Validação de posse (PyPI): o registro confere que o pacote é seu. Se o `publish`
46
+ > reclamar de "validation failed for package", siga a página oficial de tipos de
47
+ > pacote (https://modelcontextprotocol.io/registry/package-types) — ela indica o campo
48
+ > de verificação a incluir no pacote PyPI. O `mcp-publisher init` costuma já preparar isso.
49
+
50
+ Autentique e publique:
51
+ ```bash
52
+ mcp-publisher login github # abre github.com/login/device, cole o código
53
+ mcp-publisher publish
54
+ curl "https://registry.modelcontextprotocol.io/v0.1/servers?search=agentrank"
55
+ ```
56
+
57
+ ## 4. Agregadores (automático + submissão)
58
+ - **PulseMCP** (https://www.pulsemcp.com) e **Glama** (https://glama.ai/mcp/servers)
59
+ indexam servidores públicos do GitHub / registro oficial. Depois dos passos 1–3, eles
60
+ tendem a listar sozinhos; se houver formulário de "submit server", informe a URL do
61
+ repo GitHub + a descrição do LISTING.md.
62
+
63
+ ## 5. Smithery (opcional — servidor stdio local = bundle MCPB)
64
+ Para stdio local, o Smithery distribui um **bundle MCPB** (não `smithery.yaml`):
65
+ 1. Gere um `.mcpb` do servidor (guia: https://claude.com/docs/connectors/building/mcpb).
66
+ 2. Em https://smithery.ai/new, escolha "Local (MCPB Bundle)" e publique o bundle.
67
+ É mais trabalhoso; priorize PyPI + registro oficial (passos 2–3), que já dão descoberta.
68
+
69
+ ## 6. Anúncio
70
+ Use o `LAUNCH_POST.md` (na raiz do projeto): Show HN, Reddit r/mcp, dev.to e X.
71
+ E adicione o link do MCP na landing (`desenvolvedores.html`).
@@ -0,0 +1,74 @@
1
+ # AgentRank MCP server
2
+
3
+ Give your AI agent access to **real, verifiable businesses** — with provenance and
4
+ source URLs, so it never invents phone numbers or addresses.
5
+
6
+ This is an [MCP](https://modelcontextprotocol.io) server that exposes the
7
+ [AgentRank / AgentIndex](https://agentsafepath.com) search to any MCP client
8
+ (Claude Desktop, Cursor, and others).
9
+
10
+ ## Tools
11
+
12
+ - **`search_businesses(intent, limit=10)`** — find businesses by a natural-language
13
+ intent (e.g. `"farmácia em Copacabana com telefone"`, `"software company in California"`).
14
+ Returns ranked results with `fit_score`, `trust_score`, justification, risks and the
15
+ **source URL** of each fact.
16
+ - **`get_business_profile(company_id)`** — full profile of a result: location, contact
17
+ channels, hours, offers, policies and evidence, each with provenance and source.
18
+
19
+ ## 1. Get an API key
20
+
21
+ Register your agent (free, no invite) at
22
+ **https://agentsafepath.com/registrar.html** — you receive a key once. It identifies
23
+ your agent and is sent as `Authorization: Bearer <key>`.
24
+
25
+ ## 2. Add it to your MCP client
26
+
27
+ ### Claude Desktop
28
+
29
+ Edit `claude_desktop_config.json` (Settings → Developer → Edit Config) and add:
30
+
31
+ ```json
32
+ {
33
+ "mcpServers": {
34
+ "agentrank": {
35
+ "command": "uvx",
36
+ "args": ["agentrank-mcp"],
37
+ "env": { "AGENTRANK_API_KEY": "ak_your_key_here" }
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ Restart Claude Desktop. You'll see `search_businesses` and `get_business_profile`
44
+ available. (`uvx` comes with [uv](https://docs.astral.sh/uv/); or use the "From source"
45
+ option below.)
46
+
47
+ ### Cursor
48
+
49
+ Add the same block under `mcpServers` in your Cursor MCP settings.
50
+
51
+ ### From source (no packaging)
52
+
53
+ ```bash
54
+ pip install -r requirements.txt
55
+ AGENTRANK_API_KEY=ak_your_key_here python -m agentrank_mcp.server
56
+ ```
57
+
58
+ And point your client's `command` at `python` with `args`
59
+ `["-m", "agentrank_mcp.server"]` and the folder on `PYTHONPATH`.
60
+
61
+ ## Environment variables
62
+
63
+ | Var | Required | Default |
64
+ |---|---|---|
65
+ | `AGENTRANK_API_KEY` | yes | — |
66
+ | `AGENTRANK_BASE_URL` | no | `https://api.agentrank.intelligenceofcode.com` |
67
+
68
+ The key is never logged.
69
+
70
+ ## How agents should use the data
71
+
72
+ Every result carries `sources` (source URLs). **Verify provenance before acting** —
73
+ data without a source should not be used. `trust_score` (0–100) reflects how safe the
74
+ entity is to commit to; `fit_score` reflects match to the intent.
@@ -0,0 +1,2 @@
1
+ """AgentRank MCP server package."""
2
+ __version__ = "0.1.0"
@@ -0,0 +1,142 @@
1
+ """Servidor MCP do AgentRank / AgentIndex.
2
+
3
+ Expõe o índice agent-first de empresas reais e verificáveis como ferramentas MCP,
4
+ para que qualquer agente (Claude Desktop, Cursor, etc.) possa buscar empresas e ler
5
+ perfis com proveniência — sem inventar dados.
6
+
7
+ Configuração por variáveis de ambiente:
8
+ AGENTRANK_API_KEY (obrigatória) -> chave do agente (Authorization: Bearer)
9
+ AGENTRANK_BASE_URL (opcional) -> padrão https://api.agentrank.intelligenceofcode.com
10
+
11
+ A chave NUNCA é logada. Obtenha a sua em https://agentsafepath.com/registrar.html
12
+ """
13
+ from __future__ import annotations
14
+
15
+ import os
16
+
17
+ import httpx
18
+ from mcp.server.fastmcp import FastMCP
19
+
20
+ BASE_URL = os.environ.get(
21
+ "AGENTRANK_BASE_URL", "https://api.agentrank.intelligenceofcode.com"
22
+ ).rstrip("/")
23
+ API_KEY = os.environ.get("AGENTRANK_API_KEY", "").strip()
24
+ USER_AGENT = "agentrank-mcp/0.1"
25
+
26
+ mcp = FastMCP("agentrank")
27
+
28
+
29
+ def _headers() -> dict:
30
+ h = {"User-Agent": USER_AGENT, "Content-Type": "application/json"}
31
+ if API_KEY:
32
+ h["Authorization"] = f"Bearer {API_KEY}"
33
+ return h
34
+
35
+
36
+ def _need_key_msg() -> dict:
37
+ return {
38
+ "error": "missing_api_key",
39
+ "message": (
40
+ "Defina AGENTRANK_API_KEY no ambiente do servidor MCP. "
41
+ "Cadastre seu agente em https://agentsafepath.com/registrar.html para obter uma."
42
+ ),
43
+ }
44
+
45
+
46
+ @mcp.tool()
47
+ def search_businesses(intent: str, limit: int = 10) -> dict:
48
+ """Busca empresas reais e verificáveis por uma intenção em linguagem natural.
49
+
50
+ Use quando o usuário quiser encontrar um negócio (ex.: "farmácia em Copacabana
51
+ com telefone", "hotel em São Paulo", "software company in California"). Retorna
52
+ empresas ranqueadas com fit_score, trust_score, justificativa, riscos e as FONTES
53
+ (source_url) de cada dado — verifique a proveniência antes de agir. Nunca invente
54
+ telefone, endereço ou e-mail: use apenas o que vier nas fontes.
55
+
56
+ Args:
57
+ intent: a intenção em linguagem natural (ex.: "restaurante em Pinheiros").
58
+ limit: número máximo de resultados (1 a 50; padrão 10).
59
+ """
60
+ if not API_KEY:
61
+ return _need_key_msg()
62
+ limit = max(1, min(int(limit or 10), 50))
63
+ try:
64
+ r = httpx.post(
65
+ f"{BASE_URL}/api/agent/search",
66
+ headers=_headers(),
67
+ json={"intent": intent, "limit": limit},
68
+ timeout=30,
69
+ )
70
+ except httpx.HTTPError as exc:
71
+ return {"error": "connection", "message": str(exc)[:200]}
72
+ if r.status_code == 401:
73
+ return {"error": "unauthorized", "message": "Chave inválida ou ausente."}
74
+ if r.status_code == 429:
75
+ return {"error": "rate_limited",
76
+ "message": "Limite de uso atingido. Tente novamente mais tarde.",
77
+ "retry_after": r.headers.get("Retry-After")}
78
+ if r.status_code != 200:
79
+ return {"error": f"http_{r.status_code}", "message": r.text[:200]}
80
+ body = r.json()
81
+ recs = body.get("recommendations", [])
82
+ return {
83
+ "intent": body.get("intent", intent),
84
+ "results_count": body.get("results_count", len(recs)),
85
+ "query_id": body.get("query_id"),
86
+ "warnings": body.get("warnings", []),
87
+ "results": [
88
+ {
89
+ "company_id": rec.get("company_id"),
90
+ "name": rec.get("name"),
91
+ "domain": rec.get("domain"),
92
+ "category": rec.get("category"),
93
+ "region": rec.get("region"),
94
+ "fit_score": rec.get("fit_score"),
95
+ "trust_score": rec.get("trust_score"),
96
+ "justification": rec.get("justification"),
97
+ "risks": rec.get("risks", []),
98
+ "sources": rec.get("sources", []),
99
+ }
100
+ for rec in recs
101
+ ],
102
+ "note": "Verifique as 'sources' (source_url) antes de agir. Dados sem fonte não devem ser usados.",
103
+ }
104
+
105
+
106
+ @mcp.tool()
107
+ def get_business_profile(company_id: int) -> dict:
108
+ """Retorna o perfil completo de uma empresa (por company_id de uma busca anterior).
109
+
110
+ Traz localização, canais de contato, horários, ofertas, políticas e evidências —
111
+ cada afirmação com proveniência e source_url. Use para obter o telefone/endereço
112
+ verificável de um resultado antes de agir sobre ele.
113
+
114
+ Args:
115
+ company_id: o id retornado por search_businesses.
116
+ """
117
+ if not API_KEY:
118
+ return _need_key_msg()
119
+ try:
120
+ r = httpx.get(
121
+ f"{BASE_URL}/api/agents/company/{int(company_id)}.json",
122
+ headers=_headers(),
123
+ timeout=30,
124
+ )
125
+ except httpx.HTTPError as exc:
126
+ return {"error": "connection", "message": str(exc)[:200]}
127
+ if r.status_code == 401:
128
+ return {"error": "unauthorized", "message": "Chave inválida ou ausente."}
129
+ if r.status_code == 404:
130
+ return {"error": "not_found", "message": f"Empresa {company_id} não encontrada."}
131
+ if r.status_code != 200:
132
+ return {"error": f"http_{r.status_code}", "message": r.text[:200]}
133
+ return r.json()
134
+
135
+
136
+ def main() -> None:
137
+ """Ponto de entrada (stdio). Usado por 'uvx agentrank-mcp' ou 'python -m agentrank_mcp.server'."""
138
+ mcp.run()
139
+
140
+
141
+ if __name__ == "__main__":
142
+ main()
@@ -0,0 +1,23 @@
1
+ [project]
2
+ name = "agentrank-mcp"
3
+ version = "0.1.0"
4
+ description = "MCP server for AgentRank / AgentIndex — search real, verifiable businesses for AI agents."
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = { text = "MIT" }
8
+ authors = [{ name = "AgentRank" }]
9
+ keywords = ["mcp", "agents", "business", "index", "agentrank"]
10
+ dependencies = [
11
+ "mcp>=1.2.0",
12
+ "httpx>=0.27",
13
+ ]
14
+
15
+ [project.scripts]
16
+ agentrank-mcp = "agentrank_mcp.server:main"
17
+
18
+ [build-system]
19
+ requires = ["hatchling"]
20
+ build-backend = "hatchling.build"
21
+
22
+ [tool.hatch.build.targets.wheel]
23
+ packages = ["agentrank_mcp"]
@@ -0,0 +1,2 @@
1
+ mcp>=1.2.0
2
+ httpx>=0.27
@@ -0,0 +1,33 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.SEU_USUARIO_GITHUB/agentrank-mcp",
4
+ "description": "Search real, verifiable businesses (Brazil, US, Europe) with provenance and source URLs — for AI agents.",
5
+ "repository": {
6
+ "url": "https://github.com/SEU_USUARIO_GITHUB/agentrank-mcp",
7
+ "source": "github"
8
+ },
9
+ "version": "0.1.0",
10
+ "packages": [
11
+ {
12
+ "registryType": "pypi",
13
+ "identifier": "agentrank-mcp",
14
+ "version": "0.1.0",
15
+ "transport": { "type": "stdio" },
16
+ "environmentVariables": [
17
+ {
18
+ "name": "AGENTRANK_API_KEY",
19
+ "description": "Your AgentRank agent API key (register at https://agentsafepath.com/registrar.html).",
20
+ "isRequired": true,
21
+ "isSecret": true,
22
+ "format": "string"
23
+ },
24
+ {
25
+ "name": "AGENTRANK_BASE_URL",
26
+ "description": "API base URL (optional).",
27
+ "isRequired": false,
28
+ "format": "string"
29
+ }
30
+ ]
31
+ }
32
+ ]
33
+ }