Register an MCP server
Tell LumoAuth about your MCP server: its address, its scopes and who may connect. Then read what a client reads.
What it shows
- Register the server with its resource URI: the exact address that clients connect to.
- Choose the scopes, and the basic scopes that every client asks for first.
- Say whether tokens must be bound with DPoP.
- Read the security posture: 12 checks with a result for each.
- Read the metadata document that an MCP client reads to find LumoAuth.
The other recipes of this group use the same server: Invoices, with the scopes invoices:read and invoices:refund.
Before you start
- An API key with the scopes
admin:agents:readandadmin:agents:write. Create it in the portal under Applications & developer tools, API keys. curlandjq. The second version also needs the lumo CLI.- Check the number of MCP servers that your plan includes in the plans matrix.
You can also register a server in the portal: open AI Agents, MCP servers and click Register MCP server.
| Variable | Value |
|---|---|
LUMOAUTH_URL | The address of LumoAuth: https://app.lumoauth.dev, or https://eu.app.lumoauth.dev for the EU region. |
LUMOAUTH_ORG_ID | Your organization, for example acme-corp. |
LUMOAUTH_API_KEY | An API key with the scopes admin:agents:read and admin:agents:write. The curl version reads it. |
LUMO_API_KEY | The same API key, for the lumo CLI. Leave it out when you signed in with lumo login. |
LUMO_ORG | Your organization, for the lumo CLI. Leave it out when you signed in with lumo login. |
MCP_RESOURCE_URI | Optional. The address of your MCP server. The default is http://localhost:3000/mcp. |
Code
Run each command from the recipes folder of the examples repository. Set the folder up once for your language. Every version below was run against a LumoAuth organization.
- lumo CLI
- curl
mcp-servers/register/cli/register.sh
#!/bin/sh
# Register an MCP server in LumoAuth with the lumo CLI, then read its security
# posture and the metadata that an MCP client reads.
#
# sh mcp-servers/register/cli/register.sh
#
# It needs the lumo CLI and jq. Sign in with `lumo login`, or set LUMO_API_KEY
# and LUMO_ORG. The API key needs the scopes admin:agents:read and
# admin:agents:write.
set -eu
# The resource URI is the exact address that clients connect to.
RESOURCE="${MCP_RESOURCE_URI:-http://localhost:3000/mcp}"
# 1. Register the server, unless an earlier run did. The CLI has no command
# that registers a server, so `lumo api` calls the Admin API.
SERVER_ID=$(lumo api GET /mcp/servers --query limit=100 -o json | jq -r --arg uri "$RESOURCE" '.data[] | select(.resource_uri == $uri) | .server_id')
if [ -z "$SERVER_ID" ]; then
SERVER_ID=$(lumo api POST /mcp/servers -o json --data "{
\"name\": \"Invoices\",
\"description\": \"Reads and refunds invoices.\",
\"resource_uri\": \"$RESOURCE\",
\"endpoint_url\": \"$RESOURCE\",
\"scopes_supported\": [\"invoices:read\", \"invoices:refund\"],
\"basic_scopes\": [\"invoices:read\"],
\"scope_descriptions\": {\"invoices:read\": \"Read invoices.\", \"invoices:refund\": \"Refund an invoice.\"},
\"require_dpop\": false,
\"token_lifetime\": 3600
}" | jq -r '.data.server_id')
fi
echo "server: $SERVER_ID"
# 2. The security posture: one result for each check.
lumo api GET "/mcp/servers/$SERVER_ID" -o json | jq -r '.data.posture
| "posture: \(.label), \(.passes) of \(.applicable) checks pass",
(.checks[] | select(.status != "pass") | " \(.status): \(.label)")'
# 3. The metadata that a client reads.
lumo mcp discovery "$SERVER_ID" | jq -r '
"resource: \(.resource)",
"authorization server: \(.authorization_servers[0])",
"scopes: \(.scopes_supported | join(" "))"'
sh mcp-servers/register/cli/register.sh
mcp-servers/register/http/register.sh
#!/bin/sh
# Register an MCP server in LumoAuth with curl, then read its security posture
# and the metadata that an MCP client reads.
#
# sh mcp-servers/register/http/register.sh
#
# It needs curl and jq. The API key needs the scopes admin:agents:read and
# admin:agents:write.
set -eu
API="$LUMOAUTH_URL/orgs/$LUMOAUTH_ORG_ID/api/v1"
# The resource URI is the exact address that clients connect to.
RESOURCE="${MCP_RESOURCE_URI:-http://localhost:3000/mcp}"
admin() {
curl --silent --show-error --header "X-API-Key: $LUMOAUTH_API_KEY" --header "Content-Type: application/json" "$@"
}
# 1. Register the server, unless an earlier run did. The resource URI cannot
# change later, and it is unique in the organization.
SERVER_ID=$(admin "$API/admin/mcp/servers?limit=100" | jq -r --arg uri "$RESOURCE" '.data[] | select(.resource_uri == $uri) | .server_id')
if [ -z "$SERVER_ID" ]; then
SERVER_ID=$(admin "$API/admin/mcp/servers" --data @- <<JSON | jq -r '.data.server_id'
{
"name": "Invoices",
"description": "Reads and refunds invoices.",
"resource_uri": "$RESOURCE",
"endpoint_url": "$RESOURCE",
"scopes_supported": ["invoices:read", "invoices:refund"],
"basic_scopes": ["invoices:read"],
"scope_descriptions": {"invoices:read": "Read invoices.", "invoices:refund": "Refund an invoice."},
"require_dpop": false,
"token_lifetime": 3600
}
JSON
)
fi
echo "server: $SERVER_ID"
# 2. The security posture: one result for each check.
admin "$API/admin/mcp/servers/$SERVER_ID" | jq -r '.data.posture
| "posture: \(.label), \(.passes) of \(.applicable) checks pass",
(.checks[] | select(.status != "pass") | " \(.status): \(.label)")'
# 3. The metadata that a client reads. It is public: no API key.
curl --silent --show-error "$API/.well-known/oauth-protected-resource/mcp/$SERVER_ID" | jq -r '
"resource: \(.resource)",
"authorization server: \(.authorization_servers[0])",
"scopes: \(.scopes_supported | join(" "))"'
sh mcp-servers/register/http/register.sh
Check the result
Output
server: mcp_938f3b0de554d1e98a96845b
posture: Needs attention, 9 of 12 checks pass
warn: Resource URI uses https
warn: Allowed clients
warn: DPoP required
resource: http://localhost:3000/mcp
authorization server: https://app.lumoauth.dev/orgs/acme-corp/api/v1
scopes: invoices:read
- Run the script again: it finds the server by its resource URI and registers nothing new.
- The portal shows the server under AI Agents, MCP servers, with the same posture.
- LumoAuth has a test address that answers as your server must answer. Call it without a token, and read the
WWW-Authenticateheader of the401answer:
curl -i "$LUMOAUTH_URL/orgs/$LUMOAUTH_ORG_ID/api/v1/mcp/<server-id>/challenge"
The three warnings belong to a server for local development. A production server has an https:// address, a list of allowed clients, and DPoP where every client can send proofs.
Limits
- The resource URI cannot change after registration. Register a second server for a second address.
- Plain
http://is accepted only forlocalhost,127.0.0.1and[::1]. - The Admin API registers and deletes a server. To change a registered server, use Edit on the page of the server in the portal.
- The registration does not protect anything by itself. Your server must check each token: see Protect a FastMCP server and Protect a server built on the MCP TypeScript SDK.