Skip to main content
Glama
GlanosMCP

GlanosMCP

Official
by Glanos
README.md
# GlanosMCP

> [!IMPORTANT]
> **License / Access Required**
>
> To use the Glanos anonymization.ai MCP server, you need a valid **API token** and **Base URL**.
>
> To obtain your credentials, please contact **license@glanos.de**.
>
> Once you have received your token and Base URL, you can proceed with the installation and usage instructions below.
> Further information can be found at https://www.glanos.de/anonymization-ai/

A multi-tenant MCP server, built with [FastMCP](https://gofastmcp.com), that
exposes the tools of the `glanos_anonymization.tool` module
(`GlanosAnonymizationTools`, library version 2.24+) as MCP tools. The tools are
taken from the library's `definitions()`, so new library tools show up here
automatically after a version bump.

This server is meant to be hosted centrally for several users, each with
their own Glanos API token and base url. Credentials are **not** configured
server-side - every request carries its own:

| Header | Required | Description |
|---|---|---|
| `X-Glanos-Token` | yes | The calling customer's Glanos API token |
| `X-Glanos-Base-Url` | yes | The calling customer's Glanos base url |

A request without both headers is rejected with a clear MCP tool error.

## Tools

| Tool | Purpose |
|---|---|
| `anonymize` | Anonymize a text or a document (`file_base64` + `file_name`: docx, pdf, pptx, xlsx, txt, html, ...). Returns the anonymized text/document and the `session` needed to restore it, or a `fetch_key` if the document is not ready yet |
| `anonymize_with_review` | Anonymize a text or document and send it for review in the Glanos dashboard (`assignee` or `assigned_group`). Returns a `fetch_key` |
| `fetch` | Collect a document that was not ready yet (or is in review) with its `fetch_key` |
| `deanonymize` | Restore a text/document with the `session` it was anonymized with |
| `list_settings`, `get_setting`, `add_setting`, `update_setting`, `remove_setting` | Manage stored anonymization settings (mode, excluded entity types, ...) |
| `add_session`, `get_session`, `extend_session`, `remove_session` | Sessions give the same placeholders across several `anonymize` calls and allow restoring with the session alone |

The tools are stateless: sessions and settings live at Glanos and belong to the
customer's token, so customers are isolated from each other and this server
keeps no per-customer state. It only caches one HTTP client per
`(token, base_url)`, evicted after `GLANOS_TENANT_IDLE_SECONDS`. The library's
usage guide is delivered to MCP clients as the server `instructions`.

## Configuration (operator-side)

All of these apply uniformly to every tenant. Anonymization behavior (mode,
excluded fields, ...) is configured via stored settings
(`add_setting` / `settings_id`) or a session.

| Variable | Required | Description |
|---|---|---|
| `GLANOS_NO_SSL_VERIFY` | no | `true` to disable TLS verification |
| `GLANOS_TENANT_IDLE_SECONDS` | no | How long an idle tenant's cached HTTP client is kept (default: 24h) |
| `MCP_TRANSPORT` | no | `http` (default) or `sse` |
| `MCP_HOST` | no | Bind host (default: `0.0.0.0`) |
| `MCP_PORT` | no | Bind port (default: `8000`) |
| `MCP_PATH` | no | URL path of the MCP endpoint (default: `/mcp`) |

## Run locally with uv

```bash
uv sync
uv run glanosmcp
```

With the default `http` transport, the server is reachable at
`http://localhost:8000/mcp`. Each client request must include the
`X-Glanos-Token` / `X-Glanos-Base-Url` headers.

## Run in Docker

```bash
docker build -t glanosmcp .
docker run --rm -p 1995:8000 glanosmcp
```

The server is then reachable at `http://localhost:1995/mcp`.

Or with docker-compose (maps host port `1995` -> container port `8000`,
see `docker-compose.yml`):

```bash
docker compose up -d --build
```

The server is then reachable at `http://localhost:1995/` (docker-compose sets
`MCP_PATH` to `/`). `-d` runs it in the background; drop it to see logs
directly, or use `docker compose logs -f` afterwards.


## Customer-side usage

Customers point their MCP client at `https://<your-host>/mcp` and configure
it to send their own credentials as headers on every request, e.g. for a
client that supports custom headers in its MCP server config:

```json
{
  "mcpServers": {
    "glanos": {
      "url": "https://<your-host>/mcp",
      "headers": {
        "X-Glanos-Token": "<customer's Glanos token>",
        "X-Glanos-Base-Url": "<customer's Glanos base url>"
      }
    }
  }
}
```

## Notes

- Since credentials travel as plain HTTP headers, deploy this behind TLS
  (terminate HTTPS in front of the container, e.g. via a reverse proxy or
  load balancer) - never expose it over plain HTTP in production.
- The server takes credentials only from the `X-Glanos-*` request headers.
  There is no server-side fallback (env vars, `.env`) and no `stdio`
  transport, so requests without headers are always rejected.

## License

See [LICENSE](LICENSE).