Add read-only MCP server with token access
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b8328f6998
commit
49a8fa1154
34 files changed
+1625
No files matched your search
@@ -16,6 +16,7 @@ All optional. Read at startup; list entries need an index (`__0`, `__1`, ...).
|
||||
| `Flypaper__Admin__Password` | Fixes the dashboard password and disables the first-visit setup and the password change | set on first visit |
|
||||
| `Flypaper__Http__TrustedProxies__0` | IP or CIDR of the reverse proxy allowed to set `X-Real-IP` / `X-Forwarded-For`; replaces the default | private networks |
|
||||
| `Flypaper__Http__KnownHosts__0` | Hosts that are caught only on trap paths (`*.example.com` allowed), see [reverse proxy](reverse-proxy.md#what-to-send-to-flypaper) | none |
|
||||
| `Flypaper__Mcp__Token` | Fixed bearer token for the [MCP endpoint](mcp.md), in addition to tokens created on the settings page | none |
|
||||
| `Flypaper__Ports__Trap` / `Flypaper__Ports__Dashboard` | Container ports | `8080` / `8081` |
|
||||
| `ConnectionStrings__Flypaper` | SQLite database | `Data Source=/data/flypaper.db` |
|
||||
| `Flypaper__DataProtection__KeysPath` | Keys for login cookies and forms | `/data/keys` |
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
# 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 |
|
||||
|---|---|---|
|
||||
| `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) | Events, newest first, including rejected ones |
|
||||
| `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.
|
||||
@@ -44,6 +44,8 @@ flowchart LR
|
||||
- **Retention**: old catches are deleted daily (90 days by default); catches from private
|
||||
networks are not stored by default; buttons to delete private or all catches
|
||||
- **One log line per catch**, so `docker logs` alone shows whether the trap works
|
||||
- **MCP server** on the dashboard port, so AI assistants can query the catches read-only
|
||||
([docs/mcp.md](mcp.md))
|
||||
- **Health endpoint** `/health` for container health checks (on the trap port it answers only
|
||||
to private addresses)
|
||||
- **No configuration needed to start**: one volume, two ports, the admin password is set on
|
||||
|
||||
Reference in new issue
Block a user