Summary
Linkr’s MCP server gives an agent the tools to act on a running instance: cohorts, datasets, dashboards, scripts, concept mapping, documentation. Each user connects with their own API key, created in Linkr, and the agent then acts as them, with their permissions. This page explains how to create the key, run the server and plug it into LibreChat or OpenCode.
What an MCP server is
MCP — Model Context Protocol — is an open protocol through which an assistant gets tools: look up a concept, create a cohort, add a widget. Linkr’s MCP server turns each of these tools into calls to Linkr’s API, as the app itself would.
It holds no language model and hosts no conversation. That is the client’s job — LibreChat, OpenCode or any other MCP-compatible assistant — which picks the model, shows the conversation and asks for your approval before acting.
LibreChat, OpenCode
The conversation, the model, the confirmation prompt.
:3940/mcpThe tools
Your API key, as a Bearer header.
:8000The API
Checks your rights, applies, notifies.
Step 1 — Create your API key
An API key lets an external client act as you without your password. You create it in Linkr:
Open API keys
Your account menu, top right → User settings → API keys tab.
Create the key
New API key. Name it after where it will be used — “LibreChat on my laptop” — and pick an expiration: 30 days, 90 days, one year or never.
Copy it right away
The key, which starts with lnk_, is shown only once. Paste it into your client; if you lose it, revoke it and create another.
User settings
API keys
Personal keys that let an external client — the Linkr MCP server in LibreChat or OpenCode — act as you, with your permissions, without your password.
| Name | Key | Created | Last used | Expires | Status | |
|---|---|---|---|---|---|---|
| LibreChat on my laptop | lnk_a41f9c… | 9/2/2026, 10:14 AM | 9/28/2026, 9:02 AM | 12/1/2026, 10:14 AM | Active | |
| OpenCode — project IDE | lnk_7d02be… | 8/15/2026, 4:40 PM | Never | Never | Active | |
| Old workstation | lnk_e19a33… | 3/3/2026, 8:55 AM | 5/12/2026, 5:21 PM | 6/1/2026, 8:55 AM | Expired |
The key list shows each key’s creation date, last use, expiration and status — Active, Expired or Revoked. Revoke cuts a key off for good: the Linkr API refuses it at once, and the MCP server, which briefly remembers keys it has already checked, at most a minute later.
A key is worth your identity
Anyone holding the key acts as you until it expires or is revoked. Do not share it, do not paste it into a conversation with an assistant, and create one per client so you can revoke them separately. Linkr keeps only a fingerprint of it: it cannot show it to you again.
A key has exactly your permissions, no more, no less. It cannot, however, create, list or revoke keys: even stolen, it cannot mint others or prevent its own revocation.
Step 2 — Run the MCP server
This step belongs to the instance’s administrator, once for the whole institution: a single MCP server serves every user, each with their own key.
With Docker, the repository’s docker/docker-compose.yml file runs the MCP server as a separate service, mcp, beside the app: it listens on port 3940 and is already wired to the API. The docker/docker-compose.hub.yml file, the one a production install uses, runs it the same way from the image published on Docker Hub.
Without Docker, the server runs from a copy of the repository — the packages/linkr-mcp folder —, with Node.js, after an npm install at the root:
cd packages/linkr-mcp
echo "LINKR_API_URL=https://linkr.my-hospital.org" > .env # your Linkr instance's address
npm run start:http # → http://127.0.0.1:3940/mcp
LINKR_API_URL is the only setting needed: your instance’s address, or http://localhost:8000 when the MCP server runs on the same machine as the backend. If LibreChat runs in Docker on the same machine, add LINKR_MCP_HOST=0.0.0.0: it then reaches the server at http://host.docker.internal:3940/mcp. LINKR_MCP_PORT changes the port.
On a development install, npm run dev:all already starts the MCP server with the rest of Linkr — see Manual install.
Step 3 — Plug it into your client
Linkr works with any MCP-compatible client, but we recommend open-source tools, driven by a model hosted in the institution: the Agents page explains why.
LibreChat
In LibreChat, add an MCP server with:
- URL — the server’s address, for example
http://127.0.0.1:3940/mcp; - Transport — Streamable HTTP;
- Authentication — API key, Bearer format;
- Each user provides their own key — ticked. LibreChat then asks each user for their key, and the server acts as them.
LibreChat’s administrator must also allow the server’s address in librechat.yaml, under mcpSettings.allowedDomains. They can declare the server there for every user as well:
mcpSettings:
allowedDomains:
- "127.0.0.1"
mcpServers:
linkr:
type: streamable-http
url: http://127.0.0.1:3940/mcp
headers:
Authorization: "Bearer {{LINKR_API_KEY}}"
customUserVars:
LINKR_API_KEY:
title: "Linkr API key"
description: "User settings → API keys, in Linkr"
librechat.yaml is also where confirmation before a tool runs is set. Linkr’s tools state whether they read, modify or delete, so reads can be let through and the rest confirmed.
After a Linkr update
LibreChat remembers the tool list from the moment it connects. When new tools arrive, reinitialise the Linkr server in LibreChat. If you use a LibreChat agent, also tick the new tools in its configuration: otherwise the model does not see them.
OpenCode
OpenCode is an open-source agent that works in a terminal — including the project’s IDE one — and can use a local model. Declare the Linkr server in its configuration as a remote MCP server: the server’s address, and the Authorization: Bearer lnk_… header with your key.
Any other MCP-compatible client connects to the HTTP server the same way.
What the agent sees in Linkr
Once connected, the agent has over two hundred tools, grouped by area: warehouse, cohorts, concepts, datasets, dashboards, IDE and environments, concept mapping, quality, ETL, data catalog, wiki, documentation. The Agents page presents them with example requests.
Each change made by the agent refreshes the open Linkr tabs and is listed in the Notifications bell — “Added by MCP” —, with a link to the item and, for some, Undo.
The documentation, with no setup
Two tools let the agent search this documentation and read a page, to answer a question about how Linkr works while citing the source. The server reads the documentation published on this site and keeps it up to date on its own. Without internet access, it falls back to a copy shipped with it, and warns the agent that it may be less recent.
Going further
- Agents — what an agent can do, and how you stay in control.
- Skills — installing the concept-mapping skill in LibreChat.
- Deployment modes — why an install with a backend is needed.