Repository navigation
Description
Description
The Atlassian remote MCP server fails to authenticate due to an issuer mismatch in the OAuth/OIDC discovery process. The server's well-known endpoint returns a different issuer URL than what is expected based on the server's base URL.
Steps to Reproduce
- Run
thv run atlassian-remote - Observe authentication failure
Current Behavior
The authentication fails with the following error:
Error: failed to restart workload atlassian-remote: failed to authenticate to remote server:
remote authentication failed: failed to discover registration endpoint:
unable to discover OIDC endpoints at "https://mcp.atlassian.com/.well-known/openid-configuration"
or "https://mcp.atlassian.com/.well-known/oauth-authorization-server":
OIDC error: https://mcp.atlassian.com/.well-known/openid-configuration: HTTP 404,
OAuth error: https://mcp.atlassian.com/.well-known/oauth-authorization-server:
invalid metadata: issuer mismatch: expected https://mcp.atlassian.com,
got https://atlassian-remote-mcp-production.atlassian-remote-mcp-server-production.workers.dev
Expected Behavior
The OIDC discovery should handle cases where the issuer URL differs from the base URL, allowing successful authentication with the Atlassian remote MCP server.
Additional Context
The OAuth authorization server metadata returns:
{
"issuer": "https://atlassian-remote-mcp-production.atlassian-remote-mcp-server-production.workers.dev",
"authorization_endpoint": "https://mcp.atlassian.com/v1/authorize",
"token_endpoint": "https://atlassian-remote-mcp-production.atlassian-remote-mcp-server-production.workers.dev/v1/token",
"registration_endpoint": "https://atlassian-remote-mcp-production.atlassian-remote-mcp-server-production.workers.dev/v1/register",
// ... other fields
}Note that the issuer field contains a different domain than the base URL (mcp.atlassian.com), which causes the validation to fail.
Proposed Solution
The OIDC discovery mechanism should be more flexible in handling issuer mismatches, possibly by:
- Allowing configuration to skip issuer validation
- Supporting an explicit issuer override in the configuration
- Accepting the issuer from the well-known endpoint when it's from a trusted domain pattern
Originally reported by @ariel-miculas in #199 (comment)
Activity
Handle OIDC issuer mismatch for remote MCP servers
ariel-miculas commentedon Sep 18, 2025
Since we're on the Atlassian remote MCP topic, could you help me figure out what URL I should use to connect to the MCP server after setting up the proxy?
I tried
and
But they don't seem to work.
With the atlassian server at least I get an invalid access token error:
fix: Handle OIDC issuer mismatch for remote MCP servers with context-…
fix: Handle OIDC issuer mismatch for remote MCP servers with context-…
fix: Handle OIDC issuer mismatch for remote MCP servers with context-…
amirejaz commentedon Sep 18, 2025
@ariel-miculas It’s more convenient to run the remote server i.e Atlassian remote MCP server using
thv runwith the issuer URL. This makes it easier to manage the remote server in the same way as a local one.If you run
thv list, you should be able to see the URL, and it will also be configured in the registered clients. Please let me know if you face any issue.Here’s the official guide on running a remote MCP server:
https://docs.stacklok.com/toolhive/guides-cli/run-mcp-servers#run-a-remote-mcp-server
ariel-miculas commentedon Sep 19, 2025
Thanks, @amirejaz
This seems to do the trick:
With this endpoint
"atlassian-mcp-server": {"url":"http://localhost:9000/v1/sse"}configured in cursor.ariel-miculas commentedon Sep 19, 2025
Note: passing
--enable-auditbreaks the functionality of the mcp server, cursor can no longer retrieve the list of tools.amirejaz commentedon Sep 19, 2025
@ariel-miculas I'm glad that was helpful! The issuer mismatch validation is important to prevent CVEs, though in this case, the issuer seems legitimate. We'll add the issuer to the registry to avoid this mismatch issue going forward. I'll update you here once that's done, after that, it should be much more convenient to just run your original command:
thv run atlassian-remote.ariel-miculas commentedon Sep 19, 2025
@JAORMX could you fix the audit functionality for the atlassian server?
The issue is here
The remote atlassian server uses
/v1/sseinstead of/sse, so this branch isn't taken.amirejaz commentedon Sep 19, 2025
@ariel-miculas Thanks for catching this! I’m looking into it now.
Fix remote MCP server authentication with issuer mismatch
Fix remote MCP server authentication with issuer mismatch
Fix remote MCP server authentication with issuer mismatch (#1980)
amirejaz commentedon Oct 1, 2025
@ariel-miculas The
--enable-auditissue has been fixed and will be included in the next Toolhive release.ariel-miculas commentedon Oct 1, 2025
Great to hear, thank you very much, @amirejaz !