Connecting an AI assistant to the MCP server
You know how an MCP client (Claude, Le Chat, a home-made tool) authenticates with the instance, how to renew the key, what bounds the rate and the attempts, how to get through an access proxy, and what never leaves toward the assistant. What the assistant can do once connected is in the MCP server tools; the organiser will find the essentials in the organiser’s tools.
The server answers on POST /mcp (streamable HTTP) and GET /mcp/sse (quarkus-mcp-server-http). Almost everything the administration does is exposed; the only substantive restriction is the confidentiality of animateur data.
Source: diagrammes/mcp.puml (external site).
Choosing the key or OAuth
Two doors, at the client’s choice (ADR 0097 (external site)). The key is presented in a configurable header (X-MCP-Api-Key by default, PLANNING_MCP_API_KEY_HEADER) or as Authorization: Bearer; it is the choice of clients without OAuth and of instances behind an access proxy that consumes Authorization. OAuth is added as soon as the identity provider is configured (OIDC_ENABLED, OIDC sign-in). While PLANNING_MCP_API_KEY is empty and no key has been generated, /mcp answers 401 to everyone: the server can wipe the database, a refusal to serve beats exposure without authentication.
The /mcp policy requires the mcp role, which only the identity built from the key carries: a browser admin session gets 403, because with an authenticated policy the form-login cookie would have let a signed-in browser reach /mcp without a key. When a client sends Authorization: Bearer, a value of three dot-separated segments is taken for an OAuth token: it does not count as a key attempt in the lockout below, otherwise an expired token would block the address.
Connecting through OAuth
With the provider configured, /mcp is a protected resource in the sense of the MCP authorization specification: the 401 carries WWW-Authenticate: Bearer resource_metadata=… and /.well-known/oauth-protected-resource names the provider, letting a client discover where to open the connection. OIDC_MCP_AUDIENCE (default planning-mcp) is the audience the token must carry, to be declared at the provider.
The token is valid only for an active account of the application holding an administrator or organiser right in force; its roles at the provider do not count. An unknown, disabled or stand-lead-only account gets 403.
- An administrator has the same tools as with the key.
- An organiser designates only the editions of their rights: another is refused as unknown. They lack the instance tools (creating, renaming, duplicating, activating, deleting and comparing editions, backups), and the job tools are limited to their editions.
McpEditionStructurelleTestrequires every tool without an edition to be@InstanceOnlyToolor argued. - A reader has only the tools with
readOnlyHint = truethat do not compute (@Computes: simulations, previews, repairs…), on their editions (ADR 0099 (external site)).
The action journal keeps the assistant as the author, as with the key.
Renewing the key without touching the server
The MCP screen offers Generate a new key. The action requires an administrator signed in less than 10 minutes ago (AUTH_RECENT_WINDOW, PT10M by default), a requirement shared with revealing the configuration key, in place of re-typing a password. Otherwise the server answers 409 with the code RECONNEXION_REQUISE_<mode> and the screen offers to sign in again:
| Mode | Re-login |
|---|---|
OIDC |
at the provider, called again with prompt=login and max_age=0, then back to the screen |
LOCAL |
login page: password and code |
BREAK_GLASS |
the emergency form |
The sign-in instant is the identity token’s auth_time: a provider that does not send it, or ignores max_age and prompt, does not allow the re-sign-in. For a form, it is the instant noted in memory by session-cookie fingerprint: a restart asks everyone to sign in again.
The key is shown only once: only its fingerprint (SHA-256) is kept. You choose how long the old one stays valid: none, 15 minutes, 1 hour or 24 hours on the screen, 7 days at most through the API (POST /api/mcp/cle/rotation). The journal keeps the action (CLE_MCP_ROTEE), never the key. PLANNING_MCP_API_KEY works while no key has been generated; at the first generation it becomes “the old one”, then opens nothing again: you can remove it from the deployment. A generated key can no longer be revealed (409 on POST /api/mcp/cle): if lost, generate another.
A named key, limited to a role and to editions
For an assistant that analyses without writing, a dashboard for a single edition or a read-only script, the instance key gives too much: it opens everything, reset included. Settings › MCP › Named API keys (administrator only) makes narrower ones (ADR 0136 (external site)): a name, a role, the editions seen, an optional expiry.
- Reader: reads in its editions, refuses writing and calculation like an account’s Reader right, through the same filters (
LecteurFilter, the MCP interceptor); it never sees a staff member’s space token; - Organiser: writes in its editions only, and meets neither the instance routes (
@InstanceOnly) nor the@InstanceOnlyTooltools; - a key is never an administrator: it does not create keys and touches neither accounts nor webhooks. No MCP tool creates or reads a key.
It is presented like the instance key on /mcp (X-MCP-Api-Key or Authorization: Bearer) and, on /api, in the X-Api-Key header. The value (apk_…) is shown only once, at creation or renewal, both of which require a recent sign-in like the MCP key; only its SHA-256 is kept. The screen shows only the prefix, the name, and the dates of creation, last use (written once a minute at most) and expiry. A renewal keeps the old value for the overlap chosen, seven days at most.
An unknown, expired or revoked key gets the answer of a request with no key (401), saying nothing of the reason, and counts in the lockout like a guessed key. An edition outside its scope is refused like a non-existent one. A revocation takes effect on the next request. With OIDC nothing changes for named accounts: a key’s header gives nothing of an account.
Bounding the rate
/mcp is the only authenticated surface whose credential is a long-lived shared key, with no session or second factor. McpRateLimiter counts all requests under /mcp, authenticated or not, by source address, in a fixed window opened at the first request. Past the ceiling (PLANNING_MCP_MAX_REQUESTS, 120; 0 disables), the answer is 429 with a Retry-After, even with the right key: a ceiling counting only failures would let a stolen key call at network speed. The window (PLANNING_MCP_RATE_WINDOW, PT1M) closes on the hour, a refused request does not push it back. PLANNING_MCP_TRUSTED_PROXIES (by default CONNEXION_PROXYS_FIABLES) lists the reverse proxies whose X-Forwarded-For is believed, addresses or CIDR blocks; the header is read from the right (rate limits).
A hundred and twenty requests a minute suffice for an assistant driven by one person; a script that walks the referential exceeds them: raise the ceiling then, and disable it only if /mcp is reachable from the machine alone. It does not replace the reverse proxy’s per-IP limit.
Behind a proxy, fill in
CONNEXION_PROXYS_FIABLESat the same time as the key. Without it, all calls that arrive through the proxy fall on a single counter, and an anonymous caller (the filter runs before authentication) keeps your MCP client at429there with two requests per second.
Locking out after refused keys
The ceiling does not limit guessing: 120 requests a minute make over seven thousand attempts an hour. The key’s entropy remains its protection; this second guard only makes a run of attempts cost time. Beyond PLANNING_MCP_MAX_FAILURES (5, 0 disables) consecutive refused keys, the address gets 429 for PLANNING_MCP_LOCKOUT_DURATION (PT10M), even with the right configuration key, otherwise waiting one’s turn would do. A key generated from the screen passes the lockout without clearing the run: 256 random bits need no braking, and the locked address may be a NAT shared with the guesser. The duration runs from the last failure. Named keys (above) count in it too, and the lockout is the same for the X-Api-Key header of /api.
- Configuring a client does not lock out: a request without a key gets its
401and counts nothing, and a request that authenticates clears the run. Only a presented and refused key counts. - An attempt is counted before it is made: a request presenting a key reserves its failure place before authentication and gives it back once the status is written; while those places are taken, the next one gets
429with aRetry-Afterof one second.
Getting past an access proxy
PLANNING_MCP_REQUIRED_HEADERS requires Name=value pairs in addition to the key, by exact constant-time comparison: defence in depth protecting the origin if it stays reachable without the proxy, optional and empty by default. On the client side, prefer the dedicated header to Authorization: Bearer, which an access proxy often consumes. Two traps:
- list only headers that the proxy forwards: a proxy that consumes them and removes them would make every request fail;
- an entry with no
=, or with an empty value, is never satisfied (fail closed, as for the key): it does not let you require the mere presence of a header.
The interface’s MCP page detects the proxy by the X-Pangolin response header, which Pangolin does not add itself: PangolinHeaderFilter returns on the response any X-Pangolin received on the request, so it is enough to declare it on the proxy side.
Connecting from a free plan
The MCP connector is paid at most consumer assistants. What separates the free offers is what the client can present as authentication: a client that sends neither a free header nor Authorization: Bearer cannot carry the key, and connects only through OAuth. Check what your client presents before relying on it.
A hosted client (Le Chat, Claude on the web) opens the connection from its servers: the instance must be reachable from the public Internet, which PLANNING_MCP_REQUIRED_HEADERS hardens. With no stable address, it is blocked by a proxy filtering by country, range or SSO: open /mcp with a rule on the path, not on the caller, and let the key stand guard. A local client (Claude Desktop with mcp-remote, VS Code) calls from the workstation: an instance open only on the organisation’s network stays reachable, at the price of one installation per person and a Node for the bridge.
What never leaves
A staff member’s last name, first name and date of birth never leave over MCP. What leaves is the id, the adult or minor status and under-16 status, derived from the date but never the date, and the non-identifying scheduling attributes.
The id says nothing about the person, structurally: the application assigns it (A1, A2… in each edition, ADR 0050 (external site)), never a caller or an import from the name. The creation tools (creer_animateur, creer_stand, creer_emplacement, creer_typologie, creer_contrainte_ad_hoc, creer_edition) therefore take no id and return the one they assigned. A stand, game category or location is created with an optional readable code, and the tools citing them accept the id as well as the code.
Three mechanisms hold the rule, and McpConfidentialiteStructurelleTest fails the build if a tool exposes Animateur or a personal field:
- Views, never the domain objects. Each tool returns a dedicated
recordwith no accessor to a personal field. - Anonymised breach messages.
ViolationFormatterwrites “First Last (id)” for the web interface;AnonymisationViolationsrewrites it as “animateur id” and removes an ad hoc constraint’s reason before any MCP output. It starts from the edition’s records: the exact label of each known animateur is replaced, whatever the name’s shape, then a shape-based recognition takes what the referential no longer knows. Its worst case is a damaged label, never a name leaking out. - Free texts leave as “filled in or not”. A swap’s reason, a declaration’s comment, the organisation’s answer, a lock’s or ad hoc constraint’s reason: that is where a name or a medical appointment comes back (“I’m replacing Marie D.”), and no filter tells it from an innocuous sentence. The views carry
motifRenseigne,commentaireRenseigne,raisonRenseignee. Writing stays open: refusing a request always takes the comment the animateur will read. A stand’s closure reason leaves as is.
modifier_animateur merges instead of replacing, unlike the REST PUT: an assistant that does not read name, first name and birth date cannot send them back, and a full replacement would erase them. The tools creating or modifying an animateur, a stand or a timeslot go through the same write* of ReferenceDataService as REST (record re-read, modified fields for the journal, consistency warnings), and those warnings travel as codes (INDISPONIBILITE_HORS_EVENEMENT, MINEUR_PENDANT_EVENEMENT…), never sentences: a minor’s would date their majority. LayeringStructuralTest forbids a bare create* or update* outside the facade.
A mistake, an omission? Fix this page on GitHub. (external site)