Skip to main content

Register an MCP server

Tell LumoAuth about your MCP server: its address, its scopes and who may connect. Then read what a client reads.

RecipeReadyView source
Works with
lumo CLIPlain HTTP

What it shows​

  1. Register the server with its resource URI: the exact address that clients connect to.
  2. Choose the scopes, and the basic scopes that every client asks for first.
  3. Say whether tokens must be bound with DPoP.
  4. Read the security posture: 12 checks with a result for each.
  5. 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:read and admin:agents:write. Create it in the portal under Applications & developer tools, API keys.
  • curl and jq. 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.

VariableValue
LUMOAUTH_URLThe address of LumoAuth: https://app.lumoauth.dev, or https://eu.app.lumoauth.dev for the EU region.
LUMOAUTH_ORG_IDYour organization, for example acme-corp.
LUMOAUTH_API_KEYAn API key with the scopes admin:agents:read and admin:agents:write. The curl version reads it.
LUMO_API_KEYThe same API key, for the lumo CLI. Leave it out when you signed in with lumo login.
LUMO_ORGYour organization, for the lumo CLI. Leave it out when you signed in with lumo login.
MCP_RESOURCE_URIOptional. 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.

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

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-Authenticate header of the 401 answer:
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 for localhost, 127.0.0.1 and [::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.