Make your MCP server work with Emblema
What a remote MCP server must do so that each member of an organization can connect their own account from Emblema.
This page is for people who build remote MCP servers. Emblema connects to an MCP server in three ways: with no access, with a shared key in headers, or with each member's own account through OAuth. For account access, Emblema follows the MCP authorization specification (version 2025-11-25). This page lists what your server must do for Emblema to detect it and use it.
Servers with no access or a shared key only need the rules in the first section. To see how an administrator adds the server, read Add a service.
Transport, redirects and size
- Transport. Emblema accepts
http(Streamable HTTP, recommended) andsse(the older transport). It does not accept local stdio servers. In a pasted configuration,typemay behttp,streamable-httporsse. - No redirects. Emblema refuses a 3xx answer to every request it makes from its server: the MCP endpoint, metadata, registration, token and revocation. Publish the final addresses. The sign-in page that opens in the member's browser may redirect as usual.
- Size. Each response may be at most 8 MB; on an SSE stream the limit applies to each event. The limit also applies to OAuth requests.
- Address. Use a public
https://address. Emblema cloud installations refuse private addresses and requirehttps://for any server that receives credentials.
1. Answer 401 with the right challenge
When a request arrives without a valid token, answer 401 to initialize or to tools/list. Add a WWW-Authenticate header that says where to read the protected-resource metadata:
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://mcp.example.com/.well-known/oauth-protected-resource/mcp"- The
resource_metadataURL must have the same origin (scheme, host and port) as the MCP server URL. A URL on another origin is refused. - If you send no header, Emblema tries
/.well-known/oauth-protected-resourcefollowed by the server's path, then/.well-known/oauth-protected-resource, on the MCP server's origin. The header is still the recommended way. - You can add
scope="…"to the challenge: Emblema requests those scopes. - If a valid token is not enough for an action, answer 403 with
error="insufficient_scope"andscope="…". Emblema shows the member Grant and requests those scopes for that member only.
Emblema detects account access even when initialize succeeds and only tools/list answers 401.
2. Protected-resource metadata (RFC 9728)
At the resource_metadata URL, publish a JSON document:
{
"resource": "https://mcp.example.com/mcp",
"authorization_servers": ["https://auth.example.com"],
"scopes_supported": ["read", "write"]
}resource: the URL you issue tokens for. It must have the MCP server's origin, and the server's path must start with the path ofresource. Withoutresource, Emblema uses the server URL.authorization_servers: Emblema uses the first one. Without this field, it uses the MCP server's origin.scopes_supported: the scopes Emblema requests when the challenge names noscope. The administrator sees them filled in.
Answer 200 with the JSON. A 429 or a 5xx counts as the service being unreachable.
3. Authorization-server metadata (RFC 8414 or OpenID Connect)
Emblema looks for the authorization server's metadata in this order:
- for an issuer without a path, such as
https://auth.example.com:/.well-known/oauth-authorization-server, then/.well-known/openid-configuration; - for an issuer with a path, such as
https://auth.example.com/tenant1:/.well-known/oauth-authorization-server/tenant1,/.well-known/oauth-authorization-server,/.well-known/openid-configuration/tenant1, then/tenant1/.well-known/openid-configuration.
{
"issuer": "https://auth.example.com",
"authorization_endpoint": "https://auth.example.com/authorize",
"token_endpoint": "https://auth.example.com/token",
"registration_endpoint": "https://auth.example.com/register",
"revocation_endpoint": "https://auth.example.com/revoke",
"response_types_supported": ["code"],
"grant_types_supported": ["authorization_code", "refresh_token"],
"code_challenge_methods_supported": ["S256"],
"token_endpoint_auth_methods_supported": ["none", "client_secret_basic"],
"client_id_metadata_document_supported": true,
"scopes_supported": ["read", "write"]
}Required fields:
issuer, equal to the authorization server URL listed inauthorization_servers;authorization_endpointandtoken_endpoint;response_types_supportedwithcode;code_challenge_methods_supportedwithS256.
Optional fields Emblema uses: registration_endpoint, client_id_metadata_document_supported, revocation_endpoint and scopes_supported. If you publish only OpenID Connect metadata, the required fields of OpenID Connect Discovery apply as well.
4. PKCE, state and the resource parameter
Emblema always uses the authorization code flow with PKCE S256 and a single-use state. It sends the resource parameter (RFC 8707), equal to the metadata's resource, in both the authorization request and the token request.
- The authorization server must accept
resourceand bind the token to that resource. - The MCP server must refuse tokens issued for another resource.
- If the authorization response carries
iss(RFC 9207), it must matchissuer. - Emblema renews the token with the
refresh_tokengrant shortly before it expires. If you rotate refresh tokens, Emblema stores the new one. - If the token response includes an
id_tokenwithemail,preferred_usernameorname, Emblema shows that value as the connected account's name. It is used for display only.
5. Client registration
Emblema gets a client at your authorization server in this order:
- Pre-registered client. The administrator enters a client ID and secret under Advanced. The app must have their installation's redirect URI registered:
https://<emblema-address>/api/v2/mcp-servers/oauth/callback. - Client ID metadata document (CIMD). If the authorization-server metadata contains
client_id_metadata_document_supported: trueand the Emblema installation has a publichttpsaddress, Emblema'sclient_idis a URL:https://<emblema-address>/api/v2/mcp-servers/oauth/client-metadata. Your authorization server fetches that document to learn who the client is. - Dynamic client registration (RFC 7591). Otherwise Emblema registers at the
registration_endpoint.
If none of the three is possible, the administrator sees "This service needs a registered OAuth app".
The CIMD document has this shape. Dynamic registration sends the same fields, without client_id:
{
"client_id": "https://emblema.example.com/api/v2/mcp-servers/oauth/client-metadata",
"client_name": "Emblema",
"client_uri": "https://emblema.example.com",
"redirect_uris": ["https://emblema.example.com/api/v2/mcp-servers/oauth/callback"],
"grant_types": ["authorization_code", "refresh_token"],
"response_types": ["code"],
"token_endpoint_auth_method": "none"
}Emblema presents itself as a public client, with no secret. If dynamic registration returns a secret anyway, Emblema keeps it and uses it at the token endpoint.
Each Emblema installation has its own address, so its own client_id and redirect URI. Both paths are fixed and will not change. An installation without a public https address, such as one on an internal network, uses dynamic registration or a pre-registered client.
6. Revocation (RFC 7009)
If the metadata lists a revocation_endpoint, Emblema revokes tokens when:
- a member disconnects;
- an administrator disconnects a member;
- an administrator changes or deletes the server.
Revocation is best effort: Emblema deletes the tokens from its own database either way. It authenticates with client_secret_basic when the client has a secret, and otherwise sends client_id in the request body.
7. Where the authorization server may live
If the authorization server, or any of its authorization, token or registration endpoints, is on a different origin from the MCP server, its host may not be:
localhost, or a name ending in.localhost;- a name ending in
.local; - a private IP address written out, such as
10.0.0.5or192.168.1.20.
Emblema refuses it and the administrator sees a refused sign-in address. This is common with Active Directory on .local domains. You have two options:
- use a public DNS name (on on-premises installations, a name that resolves to a private address also works);
- serve the authorization endpoints from the MCP server's own origin.
Otherwise the administrator has to use a shared key.
Test your server
Ask an administrator to add the server: + Add → Custom MCP server, the URL, Continue. The Access row should read "Each member uses their own account". Then Save and connect: the administrator signs in and sees the tools to review.
| What the administrator sees | Likely cause |
|---|---|
| "This server needs a key" | The server answers 401 without resource_metadata and publishes no metadata at the well-known paths. |
| "This service needs a registered OAuth app" | There is no registration_endpoint, CIMD is not supported (or the installation has no public https address), and no client is pre-registered. |
| Invalid OAuth metadata | resource_metadata is on another origin, the JSON is invalid, issuer or the endpoints are missing, issuer does not match, or resource is on another origin. |
| Sign-in address refused | The authorization server is on another origin with a local name or a private IP. See section 7. |
| Redirect refused | An endpoint answers 3xx. |
| Service unreachable | A timeout, a 429 or a 5xx. |
| Response too large | A response is larger than 8 MB. |