···12122. **backend** indexes content into SQLite FTS5 via [Turso](https://turso.tech), serves search API
13133. **site** static frontend on Cloudflare Pages
14141515+## MCP server
1616+1717+search is also exposed as an MCP server for AI agents like Claude Code:
1818+1919+```bash
2020+claude mcp add-json leaflet '{"type": "http", "url": "https://leaflet-search-by-zzstoatzz.fastmcp.app/mcp"}'
2121+```
2222+2323+see [mcp/README.md](mcp/README.md) for local setup and usage details.
2424+1525## api
16261727```
+19-45
mcp/README.md
···2233MCP server for [Leaflet](https://leaflet.pub) - search decentralized publications on ATProto.
4455-## installation
66-77-```bash
88-uv add leaflet-mcp
99-```
1010-115## usage
1261313-### as a CLI
77+### hosted (recommended)
148159```bash
1616-leaflet-mcp
1010+claude mcp add-json leaflet '{"type": "http", "url": "https://leaflet-search-by-zzstoatzz.fastmcp.app/mcp"}'
1711```
18121919-### with Claude Code
1313+### local
20142121-Add to your `.claude/settings.json`:
1515+run the MCP server locally with `uvx`:
22162323-```json
2424-{
2525- "mcpServers": {
2626- "leaflet": {
2727- "command": "uvx",
2828- "args": ["leaflet-mcp"]
2929- }
3030- }
3131-}
1717+```bash
1818+uvx --from git+https://github.com/zzstoatzz/leaflet-search#subdirectory=mcp leaflet-mcp
3219```
33203434-## tools
3535-3636-- `search(query, tag, limit)` - search documents and publications
3737-- `get_document(uri)` - get full document content by AT-URI
3838-- `find_similar(uri, limit)` - find semantically similar documents
3939-- `get_tags()` - list available tags with counts
4040-- `get_stats()` - get index statistics
4141-- `get_popular(limit)` - get popular search queries
2121+to add it to claude code as a local stdio server:
42224343-## example
2323+```bash
2424+claude mcp add leaflet -- uvx --from 'git+https://github.com/zzstoatzz/leaflet-search#subdirectory=mcp' leaflet-mcp
2525+```
44264545-```python
4646-from fastmcp.client import Client
4747-from fastmcp.client.transports import SSETransport
2727+## workflow
48284949-async with Client(transport=SSETransport("http://localhost:8000/sse")) as client:
5050- # search for python articles
5151- results = await client.call_tool("search", {"query": "python"})
2929+1. **search** for documents by query or tag
3030+2. **get_document** to retrieve full content by AT-URI
52315353- # get full content of first result
5454- if results.data:
5555- doc = await client.call_tool("get_document", {"uri": results.data[0].uri})
5656- print(doc.data.content)
3232+```
3333+search("space station") → [{uri: "at://...", title: "...", snippet: "..."}]
3434+get_document("at://...") → {title: "...", content: "full article text..."}
5735```
58365937## development
60386139```bash
6262-# install dev dependencies
6363-uv sync --group dev
6464-6565-# run tests
4040+git clone https://github.com/zzstoatzz/leaflet-search
4141+cd leaflet-search/mcp
4242+uv sync
6643uv run pytest
6767-6868-# format
6969-uv run ruff format
7044```