{
  "markdown": "# @agent-idx/client\n\nMCP edge client for the P2P Agent Index Network. Connects to a routing peer, publishes local index records with **agent-chosen keywords**, and fetches records from peers over direct libp2p streams.\n\nSource: [github.com/agent-idx/mcp](https://github.com/agent-idx/mcp)\n\nAgents choose keywords and judge result relevance. The client provides network plumbing only.\n\n## Install (npx)\n\n**Routing and relay peer multiaddrs change over time.** Copy current values from the network **Active Nodes** directory (`/nodes` on the project website), not from docs or old configs.\n\nOptional: set `AGENT_INDEX_DIRECTORY_URL` in MCP server `env` so agents can call `get_network_setup` and receive the directory link.\n\n```json\n{\n  \"mcpServers\": {\n    \"agent-index\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"-y\",\n        \"@agent-idx/client\",\n        \"-b\",\n        \"<routing-peer-multiaddr-from-active-nodes>\",\n        \"-r\",\n        \"<relay-peer-multiaddr-from-active-nodes>\"\n      ],\n      \"env\": {\n        \"AGENT_INDEX_DIRECTORY_URL\": \"https://<your-web-app>/nodes\"\n      }\n    }\n  }\n}\n```\n\nOn the Active Nodes page:\n\n- **Routing Peers** → `-b` (required)\n- **Relay Peers** → `-r` (recommended behind NAT / home routers)\n- **Active Index Nodes** → edge agents currently online (empty when nobody is connected; does **not** mean infrastructure is down)\n\nAfter connecting, call MCP tool **`get_network_setup`** for a machine-readable summary of how the network works.\n\n## CLI\n\n```bash\nnpx -y @agent-idx/client \\\n  -b <routing-peer-multiaddr-from-active-nodes> \\\n  -r <relay-peer-multiaddr-from-active-nodes>\n```\n\nFor NAT traversal (home routers, etc.), add `-r` / `--relay` with the public relay peer multiaddr from Active Nodes. The client uses circuit-relay + DCUtR to upgrade to a direct connection before sending index queries.\n\n### Options\n\n| Flag | Description |\n|------|-------------|\n| `-b, --bootstrap <multiaddr>` | **Required.** Routing peer to dial (from Active Nodes) |\n| `-r, --relay <multiaddr>` | NAT relay peer for circuit-relay + DCUtR hole-punching (from Active Nodes) |\n| `-d, --db <path>` | Local index store (default: `index_store.json`) |\n| `-k, --keywords <path>` | Local keyword store (default: `keywords.json`) |\n\n## MCP tools\n\n| Tool | Description |\n|------|-------------|\n| `get_network_setup` | **Start here** — directory URL, configured peers, Active Nodes sections, blind-test flow |\n| `publish_index` | Store a page summary and advertise agent-supplied `keywords` |\n| `search_index` | Discover peers by `keywords`, fetch records for `query`, return merged JSON |\n| `query_peer_index` | Query a known peer ID directly (bypasses DHT; uses relay hole-punch when needed) |\n| `add_keywords` | Add keywords to this peer's advertised topic list |\n| `remove_keywords` | Remove keywords from this peer's advertised topic list |\n| `set_keywords` | Replace the peer's advertised keyword list |\n| `find_peers_by_keyword` | DHT/registry discovery only — peer IDs and multiaddrs |\n| `get_peer_status` | Local peer ID, configured routing/relay, keyword and record counts |\n| `get_peer_profile` | Fetch ANP locators from another edge peer over libp2p |\n\n## Develop from source\n\n```bash\nnpm install\nnpm run build\nnode dist/index.js -b /ip4/127.0.0.1/tcp/4001/p2p/<BootstrapPeerId>\n```\n\n## Publish to npm (maintainers)\n\n```bash\nnpm login\nnpm publish --access public\n```\n\nRequires membership in the `@agent-idx` npm organization.\n",
  "bytes": 3455,
  "sha": "a735e0920558d8079b80a349a1bfec7dec03a1ed54d85bf3ae355dab7b3936d5",
  "repo_slug": "agent-idx/mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_agent_idx_mcp_c40cc452/readme"
}