Files
Flypaper/docs/mcp.md
T
TomandClaude Sonnet 5.5 302b40c172 Put signposts back into the trap into the fake files
.env, JSON, YAML, SQL and Git config carry URLs marked with the serving
catch, so a later request shows where the address came from. MCP exposes
the marker. Switch: Flypaper__Drip__Signposts.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-26 21:24:04 +01:00

73 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# MCP access for AI assistants
Flypaper includes a [Model Context Protocol](https://modelcontextprotocol.io) server, so AI
assistants such as Claude can query your catches: "Which countries hit the trap most this week?",
"What do we know about 203.0.113.9?". All tools only read; nothing can be changed or deleted
over MCP.
- Endpoint: `http://<host>:8081/mcp` (Streamable HTTP, dashboard port only; on the trap port
`8080` the path is just another trap)
- Authentication: `Authorization: Bearer <token>`; without a valid token the answer is `401`
**LAN only.** The MCP endpoint lives on the dashboard port and must stay as internal as the
dashboard: never forward port `8081` from your public proxy.
## Create a token
Dashboard → **Einstellungen** → **MCP-Zugriff**: enter a name (e.g. *Claude Code*) and create
the token. It is shown exactly once, so copy it right away; Flypaper stores only its SHA-256
hash. The list shows each token's name, creation date and last use, and lets you revoke it.
Alternatively, set a fixed token with the environment variable `Flypaper__Mcp__Token` (useful
for automated setups). It works in addition to the tokens created in the dashboard.
## Connect Claude Code
```bash
claude mcp add --transport http flypaper http://192.168.1.10:8081/mcp \
--header "Authorization: Bearer fpm_your_token"
```
## Connect Claude Desktop
Claude Desktop's custom connectors are reached from Anthropic's cloud and can't see your LAN.
Use the local [`mcp-remote`](https://www.npmjs.com/package/mcp-remote) bridge instead (needs
Node.js), in `claude_desktop_config.json`:
```json
{
"mcpServers": {
"flypaper": {
"command": "npx",
"args": [
"mcp-remote",
"http://192.168.1.10:8081/mcp",
"--allow-http",
"--header",
"Authorization: Bearer ${FLYPAPER_TOKEN}"
],
"env": { "FLYPAPER_TOKEN": "fpm_your_token" }
}
}
}
```
`--allow-http` is needed because the dashboard port speaks plain HTTP.
## Tools
All tools return structured JSON (with an output schema); times are ISO 8601 UTC, durations in
seconds. A *period* is a number with `m`, `h`, `d` or `w` (e.g. `1h`, `24h`, `7d`) or `all`.
| Tool | Parameters | Returns |
|---|---|---|
| `list_active` | – | Bots held in the trap right now with origin, URL, user agent, strategy, time held and bytes sent (memory only) |
| `get_stats` | `period` (default `24h`) | Catches, rejected connections, unique IPs, total and average hold time, traps active now, longest catch |
| `list_catches` | `since`, `until` (ISO 8601), `country` (ISO code), `provider` (`AS4134` or part of the name), `ip`, `target_contains`, `limit` (default 50, max 500), `marker` (12 hex characters from a signpost URL) | Events, newest first, including rejected ones; each carries its `marker` |
| `top` | `dimension` (`ips`, `countries`, `providers`, `targets`, `user_agents`), `period` (default `24h`), `limit` (default 10) | Most frequent values by number of catches, with total hold time |
| `longest_catches` | `period` (default `7d`), `limit` (default 10) | Catches that held a bot the longest |
| `lookup_ip` | `ip` | Origin, provider, totals, first and last seen, and its events (newest first, at most 500); local data only |
Catches from private networks appear only if they are stored, i.e. if the setting *Fänge aus
privaten Netzen nicht speichern* is off.