Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(marketplace): accept auth-server metadata as a DCR discovery document

rubenluetke10-beep5c95b73c3633
diff --git a/jarvis/marketplace/auth/oauth_dcr.py b/jarvis/marketplace/auth/oauth_dcr.py
index cb4824feb5..f536ffa2dc 100644
--- a/jarvis/marketplace/auth/oauth_dcr.py
+++ b/jarvis/marketplace/auth/oauth_dcr.py
@@ -123,6 +123,14 @@ def apply_client_auth(
return None
+def _is_auth_server_metadata(meta: object) -> bool:
+ """True for an RFC 8414 document, as opposed to an RFC 9728 one."""
+ return isinstance(meta, dict) and all(
+ isinstance(meta.get(key), str) and meta[key]
+ for key in ("authorization_endpoint", "token_endpoint")
+ )
+
+
def _well_known_candidates(issuer: str) -> list[str]:
"""Auth-server metadata URLs for an issuer, most-correct first.
@@ -203,6 +211,11 @@ class HostedMcpDcrHandler:
}
auth_servers = pr_meta.get("authorization_servers") or []
+ if not auth_servers and _is_auth_server_metadata(pr_meta):
+ # Servers on the 2025-03-26 MCP auth spec (Atlassian) publish no
+ # protected-resource document; their catalog entry points the
+ # discovery URL straight at the RFC 8414 auth-server metadata.
+ return pr_meta
if not auth_servers:
raise RuntimeError(
"protected-resource has no authorization_servers "
diff --git a/tests/unit/marketplace/test_dcr_discovery.py b/tests/unit/marketplace/test_dcr_discovery.py
index 2ba4b45c43..1ac09c2c21 100644
--- a/tests/unit/marketplace/test_dcr_discovery.py
+++ b/tests/unit/marketplace/test_dcr_discovery.py
@@ -98,3 +98,43 @@ async def test_discover_handles_stripe_style_path_issuer():
# authorize + token requests can carry the `resource` param (Stripe drops
# you on the dashboard without it).
assert h._discovered_resource == "https://mcp.stripe.com"
+
+
+async def test_discover_accepts_auth_server_metadata_as_discovery_url():
+ """Servers without a protected-resource document (Atlassian) are configured
+ with the RFC 8414 metadata URL itself; no resource indicator is sent."""
+ URL = "https://mcp.atlassian.com/.well-known/oauth-authorization-server"
+ META = {
+ "issuer": "https://mcp.atlassian.com",
+ "authorization_endpoint": "https://mcp.atlassian.com/v1/authorize",
+ "token_endpoint": "https://cf.mcp.atlassian.com/v1/token",
+ "registration_endpoint": "https://mcp.atlassian.com/v1/register",
+ }
+ requested: list[str] = []
+
+ def handler(req: httpx.Request) -> httpx.Response:
+ requested.append(str(req.url))
+ if str(req.url) == URL:
+ return httpx.Response(200, json=META)
+ return httpx.Response(404, text="unexpected: " + str(req.url))
+
+ h = HostedMcpDcrHandler(DcrConfig(plugin_id="atlassian", discovery_url=URL))
+ async with httpx.AsyncClient(transport=httpx.MockTransport(handler)) as client:
+ meta = await h._discover(client)
+ assert meta["registration_endpoint"] == "https://mcp.atlassian.com/v1/register"
+ assert requested == [URL]
+ assert h._discovered_resource is None
+
+
+async def test_discover_still_rejects_a_document_with_no_auth_server():
+ def handler(req: httpx.Request) -> httpx.Response:
+ return httpx.Response(200, json={"resource": "https://example.test/mcp"})
+
+ h = HostedMcpDcrHandler(
+ DcrConfig(plugin_id="x", discovery_url="https://example.test/.well-known/x")
+ )
+ async with httpx.AsyncClient(transport=httpx.MockTransport(handler)) as client:
+ with pytest.raises(RuntimeError, match="no authorization_servers"):
+ await h._discover(client)