# LNSearch: guide for AI agents

LNSearch (https://lnsearch.com) is a read-only explorer for the public Bitcoin Lightning Network graph.
This guide explains how an agent can find nodes, read their data and send users to the right page.

## Ground rules

- Everything is **read-only and public**. There is no auth for the MCP server or the JSON endpoints below.
- Only **active** nodes are returned: a node must appear in our latest graph sync *and* have at least one open channel. If a node is missing, tell the user it is unknown or no longer active. Don't guess.
- Please stay under **~120 requests per minute** per client. Over that, the MCP endpoint returns HTTP 429.
- Anything that needs an account (`/dashboard`, `/login`, monitoring jobs, payments) is for humans and is out of scope for agents.
- Capacities are in satoshis (`_sats`) or bitcoin (`_btc`); 1 BTC = 100,000,000 sats. Fee rates are in ppm (parts per million).

## Option 1: MCP server (recommended)

- Endpoint: `https://lnsearch.com/mcp`
- Transport: Streamable HTTP (stateless; JSON responses; no SSE stream, no session id)
- Protocol versions: 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05

Connect:

```bash
# Claude Code
claude mcp add --transport http lnsearch https://lnsearch.com/mcp
```

```json
// Generic MCP client config
{ "mcpServers": { "lnsearch": { "type": "http", "url": "https://lnsearch.com/mcp" } } }
```

Tools (all read-only):

| Tool | Arguments | Returns |
|---|---|---|
| `search_nodes` | `query` (alias text or pubkey prefix), `limit` ≤ 50 | Matching active nodes with rank, channels, capacity, `url` |
| `get_node` | `pubkey` | Profile: alias, capacity, channels, addresses, `connection_strings`, ranking, `url` |
| `get_node_channels` | `pubkey`, `limit` ≤ 200 | Channels largest-first with peer and both fee policies |
| `get_top_nodes` | `limit` ≤ 100, `offset` | Top-ranked active nodes |
| `get_network_stats` | none | Active nodes/channels, total capacity, avg/median channel size |
| `get_site_pages` | none | Main page URLs and URL patterns for linking |

Typical flow: `search_nodes("ACINQ")` → take the `pubkey` → `get_node` / `get_node_channels` → give the user the `url`.

Raw example:

```bash
curl -s https://lnsearch.com/mcp -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search_nodes","arguments":{"query":"acinq","limit":3}}}'
```

## Option 2: plain HTTP

| URL | Description |
|---|---|
| `GET https://lnsearch.com/api/search-nodes?alias={text}` | Alias search → `[{ pubKey, alias }]` |
| `GET https://lnsearch.com/api/node-lookup?pubkey={pubkey}` | One node → `{ found, node: { pubKey, alias, color, addresses, channelCount, totalCapacity } }` |
| `GET https://lnsearch.com/api/node-rankings?limit=50&offset=0` | Ranked active nodes, paginated |
| `GET https://lnsearch.com/node/{pubkey}` | Human-readable HTML node page (server-rendered) |

## Navigating the site for a user

- Node page: `https://lnsearch.com/node/{pubkey}`
- Rankings: `https://lnsearch.com/nodes`
- Reachability test for a node: `https://lnsearch.com/tools/test-connection`
- Uptime monitoring signup: `https://lnsearch.com/monitoring`

## More

- LLM summary: https://lnsearch.com/llms.txt (full version with live data: https://lnsearch.com/llms-full.txt)
- Sitemap of every active node: https://lnsearch.com/sitemap.xml
