Skip to main content
Glama
publiq UiTdatabank MCP server

publiq UiTdatabank MCP server

README.md
# publiq UiTdatabank MCP server

[![CI](https://github.com/t-Geels-Volkstoneel/publiq-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/t-Geels-Volkstoneel/publiq-mcp/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?logo=buy-me-a-coffee&logoColor=black)](https://buymeacoffee.com/taurgis)

A local [MCP](https://modelcontextprotocol.io) server (stdio) for managing events in publiq's
[UiTdatabank](https://docs.publiq.be/docs/uitdatabank/entry-api/introduction) through the Entry
API. It can search, create, update, publish, cancel and delete events, upload images, and
find or create organizers.

By default it runs against a **built-in mock** of the publiq APIs, so it works without a
publiq account. Point it at the test or production environment once you have client
credentials.

## What is this, in plain words?

- **UiTdatabank** is publiq's database of cultural, leisure and sports activities in Flanders
  and Brussels. Events entered there show up on UiTinVlaanderen.be and many other calendars.
- **MCP** (Model Context Protocol) is an open standard that lets an AI assistant, such as
  Claude, use tools. An _MCP server_ is a small program that offers those tools.
- **This project** is such an MCP server. Once it is connected, you can ask your assistant
  things like _"Create a draft concert in the Ancienne Belgique on 21 June at 20:00"_, and the
  assistant calls the right UiTdatabank APIs for you.

The server runs on your own computer. Your assistant starts it and talks to it over
stdin/stdout ("stdio"), so you do not have to host anything.

## Tools

| Tool                | What it does                                                                |
| ------------------- | --------------------------------------------------------------------------- |
| `search_events`     | Search events (Search API), including drafts via `workflowStatus`.          |
| `get_event`         | Read one event (Entry API).                                                 |
| `search_places`     | Find the venue to use as an event's location.                               |
| `search_organizers` | Find an existing organizer by website or name.                              |
| `list_event_types`  | List event type and theme terms (Taxonomy API).                             |
| `create_event`      | Create an event, as a draft unless `publish` is true.                       |
| `update_event`      | Change properties, cancel, postpone, mark sold out, add or remove images.   |
| `publish_event`     | Publish a draft.                                                            |
| `delete_event`      | Delete an event. Irreversible.                                              |
| `upload_image`      | Upload a PNG, JPEG or GIF from a public URL or a local file (max. 21 MB).   |
| `create_organizer`  | Create an organizer, after checking that none exists with the same website. |

The server also exposes a usage guide, as the resource `uitdatabank://guide` and the prompt
`uitdatabank_guide`. It is the same text as the
[`publiq-uitdatabank-events` skill](skills/publiq-uitdatabank-events/SKILL.md).

## Quick start (no publiq account needed)

You need [Node.js](https://nodejs.org) 22.12 or newer, so Node 22 or 24 (`node --version` shows
yours), and
[Git](https://git-scm.com).

1. Download the code and go into its folder:

   ```bash
   git clone https://github.com/t-Geels-Volkstoneel/publiq-mcp.git
   ```

   ```bash
   cd publiq-mcp
   ```

2. Install the dependencies:

   ```bash
   npm ci
   ```

3. Build the server. This compiles the TypeScript in `src/` to JavaScript in `dist/`:

   ```bash
   npm run build
   ```

4. Connect it to your assistant (see the next section). Use the **absolute** path to
   `dist/index.js`; `pwd` prints the folder you are in.

5. Ask your assistant to _"list the UiTdatabank event types"_. Without further configuration
   the server uses the built-in mock: nothing is sent to publiq, and the data is gone when the
   server stops.

## Connecting it to an assistant

### Claude Code

```bash
claude mcp add --transport stdio publiq-uitdatabank -- node /absolute/path/to/publiq-mcp/dist/index.js
```

To use a real environment, add `--env` options before `--transport`, for example
`--env UITDATABANK_ENV=test --env UITDATABANK_CLIENT_ID=... --env UITDATABANK_CLIENT_SECRET=...`.
Everything after `--` is the command that starts the server
([Claude Code MCP docs](https://code.claude.com/docs/en/mcp)).

### Claude Desktop and other clients

Add the server to the client's MCP configuration (for Claude Desktop:
`claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "publiq-uitdatabank": {
      "command": "node",
      "args": ["/absolute/path/to/publiq-mcp/dist/index.js"],
      "env": {
        "UITDATABANK_ENV": "test",
        "UITDATABANK_CLIENT_ID": "your-client-id",
        "UITDATABANK_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}
```

Leave out `env` to use the mock. On Windows, write the path with forward slashes or doubled
backslashes, e.g. `C:/Users/you/publiq-mcp/dist/index.js`.

### Install the guide as a skill

```bash
npx forward-nexus add t-Geels-Volkstoneel/publiq-mcp --skill publiq-uitdatabank-events
```

## Using real publiq data

**Step-by-step guide: [Getting publiq credentials](docs/getting-credentials.md).** It covers
requesting test credentials, configuring the server, publiq's review before production access,
and switching to production.

In short:

1. Register an integration for the **UiTdatabank Entry API** on
   [publiq platform](https://platform.publiq.be). You get a client id and a client secret for
   the **test** environment right away, for free.
2. Set `UITDATABANK_ENV=test` together with the two credentials, as in the examples above.
3. Create at least 5 good test events, then ask publiq to review your integration. After
   approval you receive separate credentials for `production`.

Tip: start with `UITDATABANK_READ_ONLY=true` to explore real data without any risk of changing it.

**Already entering events on uitdatabank.be with your own account?** Events this server creates
belong to your integration, not to you. Read
[Editing MCP events on uitdatabank.be](docs/editing-in-uitdatabank.md) to make them editable in
the web interface (link them to your organisation), and why the server cannot edit the events you
created yourself by default.

## Configuration

| Variable                                                                                              | Default         | Meaning                                                  |
| ----------------------------------------------------------------------------------------------------- | --------------- | -------------------------------------------------------- |
| `UITDATABANK_ENV`                                                                                     | `mock`          | `mock`, `test` or `production`.                          |
| `UITDATABANK_CLIENT_ID`                                                                               |                 | Client id from publiq. Required for `test`/`production`. |
| `UITDATABANK_CLIENT_SECRET`                                                                           |                 | Client secret. Required for `test`/`production`.         |
| `UITDATABANK_READ_ONLY`                                                                               | `false`         | `true` registers only the five read tools.               |
| `UITDATABANK_AUTH_URL`, `UITDATABANK_ENTRY_URL`, `UITDATABANK_SEARCH_URL`, `UITDATABANK_TAXONOMY_URL` | per environment | Override a service URL (origin only, no path).           |

Rules the server checks at start-up, so mistakes fail loudly instead of silently:

- Setting `UITDATABANK_CLIENT_ID` without `UITDATABANK_ENV` is an error. Otherwise you would be
  working against the mock while believing you are on publiq.
- URL overrides must use `https`, except for `localhost`/`127.0.0.1` (e.g. the standalone mock).
- An empty variable (`""`) counts as not set.

## Security

- Credentials are obtained with the OAuth2 client-credentials flow and cached until shortly
  before they expire. They are never written to logs or tool output, and never sent over plain
  `http` to another machine.
- Every request to publiq times out after 30 seconds. A timed-out write may still have been
  applied; the error says so, so the assistant checks before retrying.
- Event names and descriptions are written by third parties. The tool descriptions tell the
  model to treat them as data, never as instructions.
- `upload_image` can read a file on your computer. It only sends files whose content is a PNG,
  JPEG or GIF image of at most 21 MB, so it cannot be used to send other files to publiq. Uploaded
  images are public and cannot be deleted, only unlinked. Check the path when your assistant asks
  to upload a file.
- Keep your client secret out of Git. `.env` is already in `.gitignore`.

## Troubleshooting

| Symptom                                               | Likely cause and fix                                                                    |
| ----------------------------------------------------- | --------------------------------------------------------------------------------------- |
| The assistant does not show the tools                 | The path in the config is not absolute, or `npm run build` was not run.                 |
| `Invalid configuration` at start-up                   | A variable has a wrong value; the message names it.                                     |
| `Could not obtain an access token ... invalid_client` | Wrong client id or secret, or credentials for the other environment (test/production).  |
| `Could not reach <host>`                              | No network, a proxy blocks the host, or a URL override is wrong.                        |
| `publiq API error 403: Forbidden`                     | Your client may not edit that event, e.g. because another organisation created it.      |
| Search finds nothing in mock mode                     | The mock only has a few sample places and types, and starts empty. Create events first. |

The server logs to stderr; most MCP clients show that output in their MCP or server log.

## The mock

In `mock` mode the server starts the mock in-process. To run it separately, for example to
point another tool at it:

```bash
npm run mock
```

It listens on port 4100 (override with `PORT`) and prints the environment variables to use.
The mock follows the documented Entry, Search and Taxonomy API behaviour. It validates request
bodies, returns RFC 7807 problem responses, and produces event documents shaped like those of
the real io-test environment. Where the documentation and the live API differ, it accepts both
forms. `test/compatibility.test.ts` lists those cases.

## How the code is organised

| Folder            | Contents                                                                               |
| ----------------- | -------------------------------------------------------------------------------------- |
| `src/index.ts`    | Start-up: reads the configuration, connects the MCP server to stdio, handles shutdown. |
| `src/config.ts`   | Reads and validates the environment variables.                                         |
| `src/http`        | Talking HTTP to publiq: OAuth tokens, timeouts, turning errors into `PubliqApiError`.  |
| `src/uitdatabank` | One small class per publiq API, plus the zod schemas that describe valid event data.   |
| `src/mcp`         | The MCP layer: tool definitions, compact summaries of results, the usage guide.        |
| `src/mock`        | A fake publiq that runs in memory, used by default and by the tests.                   |
| `test`            | Vitest tests. Most start the mock and the MCP server and call tools end to end.        |
| `skills`          | The usage guide, served to the model and installable as a skill.                       |

A tool call flows like this: `src/mcp/tools/*` validates the input with zod, calls a class in
`src/uitdatabank`, which sends HTTP requests through `src/http`. The answer is reduced to a
compact summary before it goes back to the model.

## Development

| Command                 | What it does                                                        |
| ----------------------- | ------------------------------------------------------------------- |
| `npm run dev`           | Run the server from source.                                         |
| `npm test`              | Unit and end-to-end tests against the mock.                         |
| `npm run test:contract` | Validate the request bodies against publiq's official JSON schemas. |
| `npm run lint`          | oxlint, including type-aware rules.                                 |
| `npm run lint:health`   | Coverage plus fallow (dead code, duplication, complexity).          |
| `npm run check`         | Typecheck, lint, format check, tests with coverage and fallow.      |
| `npm run changeset`     | Record a change for the changelog (see `.changeset/README.md`).     |
| `npm run inspector`     | Open the built server in the MCP Inspector.                         |

A pre-commit hook runs prettier and oxlint on staged files, followed by a fallow audit of the
changes. See [`.github/instructions/development.instructions.md`](.github/instructions/development.instructions.md)
for the coding standards.

## Support

If this server is useful to you, you can buy me a coffee.

[![Buy Me a Coffee](https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png)](https://buymeacoffee.com/taurgis)

TDQS

A4.2/5.0

Scored across 11 tools

Disambiguation5/5

Each tool targets a distinct resource+action pair: searching places vs organizers vs events vs taxonomy terms are clearly separated, and the event lifecycle verbs (create/update/publish/delete/get) are unambiguous. Descriptions explicitly route agents between tools (e.g. search_events for summaries, get_event for full detail), leaving no realistic misselection.

Naming Consistency5/5

All names follow a uniform snake_case verb_noun pattern (search_places, create_event, get_event, upload_image). Verb choice is predictable per action, with no camelCase or stylistic mixing.

Tool Count5/5

11 tools is squarely in the well-scoped range for a domain with three entities (events, organizers, places) plus taxonomy and media. Each tool maps to a real operation; nothing looks like filler.

Completeness4/5

Event lifecycle is fully covered (create, get, search, update, publish, delete) plus organizer creation/search and image upload. Minor gaps remain: no get_organizer/update_organizer and no get_place detail fetch, so agents must work around those when inspecting or correcting existing records.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues