Gotify MCP
README.md
# Gotify MCP
[](https://github.com/visibilityspots/dockerfile-gotify-mcp/actions/workflows/trivy.yml)
[](https://github.com/visibilityspots/dockerfile-gotify-mcp/actions/workflows/docker-hub-description.yml)
[](https://github.com/visibilityspots/dockerfile-gotify-mcp/actions/workflows/main.yml)
[](https://github.com/visibilityspots/dockerfile-gotify-mcp/releases)
[](https://hub.docker.com/r/visibilityspots/gotify-mcp)
[](https://hub.docker.com/r/visibilityspots/gotify-mcp/)
[](https://opensource.org/licenses/MIT)
a read-only [MCP](https://modelcontextprotocol.io) server for a [Gotify](https://gotify.net)
notification server, so an AI agent can read the notifications you receive.
Gotify has no read-only token: a client token can read, delete and manage everything of its
user. This server is the boundary instead. It can only send `GET` requests to three fixed
paths, and its tools return only whitelisted fields, so the application tokens that
`GET /application` returns never reach the model. There is no tool to send, delete or
manage anything.
It is a single Python file on top of the MCP Python SDK, serving streamable HTTP on `/mcp`
and running as a non-root user.
## run
```
$ docker run -d --name gotify-mcp -p 8080:8080 \
-e GOTIFY_URL=https://gotify.example.com \
-e GOTIFY_CLIENT_TOKEN=<client token> \
-e MCP_ALLOWED_HOSTS=gotify-mcp.example.com \
visibilityspots/gotify-mcp:latest
$ claude mcp add --transport http gotify https://gotify-mcp.example.com/mcp
```
### Client token
Create a dedicated client in the Gotify web UI (Clients, Create client), so you can revoke
the MCP's access without touching your other clients. It sees the messages of every
application of that user.
The token is sent in the `X-Gotify-Key` header only, never in a URL, so it does not end up
in proxy access logs. Error messages carry the HTTP status, never the URL, headers or
Gotify's response body.
### Authentication
`/mcp` has no authentication of its own: put it on an internal network or behind a reverse
proxy that restricts access. Anyone who reaches it can read your notifications.
## Tools
| tool | arguments | returns |
|---|---|---|
| `list_messages` | `limit` (1-100, default 20), `app_id`, `before_id`, `after_id`, `min_priority` | messages newest first: `id`, `app_id`, `app`, `date`, `priority`, `title`, `message`, `truncated` |
| `list_applications` | | `id`, `name`, `description` of each application |
- `before_id` pages back in time: pass the previous result's `next_before_id`. Gotify's own
`since` parameter works this way (ids lower than the value), which the name makes explicit.
- `after_id` keeps only messages newer than the given id, e.g. the highest id seen last time.
It filters within the fetched page; `more_after: true` means there may be more, so raise
`limit` or page with `before_id`.
- Message `extras` (click URLs, markdown hints) are dropped, and bodies are cut at
`GOTIFY_MESSAGE_MAX_CHARS`.
Titles and bodies are written by whatever sends you notifications. The server tells the
client to treat them as data, never as instructions; tell your agent the same.
## Configuration
| variable | default | |
|---|---|---|
| `GOTIFY_URL` | | base url of the Gotify server (required) |
| `GOTIFY_CLIENT_TOKEN` | | Gotify client token (required) |
| `MCP_ALLOWED_HOSTS` | | comma-separated host names the server answers to, see below |
| `MCP_HOST` | `0.0.0.0` | listen address |
| `MCP_PORT` | `8080` | listen port |
| `GOTIFY_MESSAGE_MAX_CHARS` | `2000` | longer message bodies are truncated |
The MCP SDK protects against DNS rebinding and allows only `localhost` and `127.0.0.1` by
default. Behind a reverse proxy the `Host` header is the public name, and without
`MCP_ALLOWED_HOSTS` every request is answered `421 Misdirected Request`. A name also
matches with any port. `*` turns the protection off.
The server runs stateless (`stateless_http`), so clients keep working after a restart.
## build
```
$ docker build -t visibilityspots/gotify-mcp:latest .
```
### buildx
```
$ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
$ docker buildx build -t visibilityspots/gotify-mcp:latest --platform linux/amd64,linux/arm64 --push .
```
### dgoss
The tests in goss.yaml run the real entrypoint without a Gotify behind it: they check the
MCP handshake under a proxied `Host` header, the 421 for any other host and the path guard.
`goss_wait.yaml` waits until the port listens:
```
$ dgoss run -e MCP_ALLOWED_HOSTS=gotify-mcp.example.com -e GOTIFY_URL=http://127.0.0.1:1 -e GOTIFY_CLIENT_TOKEN=test visibilityspots/gotify-mcp:dev
...
Count: 12, Failed: 0, Skipped: 0
INFO: Deleting container
```
### act
using [act](https://github.com/nektos/act#overview----) for local testing of the written github actions makes my life and commit history a lot easier;
```
Stage Job ID Job name Workflow name Workflow file Events
0 update update docker-hub-description docker-hub-description.yml push
0 main main CI main.yml push,pull_request
0 scan scan trivy trivy.yml workflow_dispatch,push,schedule
```
### release
Images are built and pushed by the shared workflow in
[visibilityspots/github-workflows](https://github.com/visibilityspots/github-workflows) when
a tag is pushed. Pushing to `main` builds nothing; a pull request only builds and runs dgoss.
## License
Distributed under the [MIT license](https://github.com/visibilityspots/dockerfile-gotify-mcp/blob/main/LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues