When you need this
Use upstream authentication when the MCP server you are registering requires some form of authentication (eg- static bearer token, custom headers, or OAuth). Typical examples:- SaaS-hosted MCP servers
- Internal MCP servers behind an API gateway
- Self-hosted MCP servers using static bearer-token auth
- Hosted MCP servers that require OAuth approval during registration
Bearer token via CLI flag
If the upstream server accepts a standard bearer token, pass it at registration time:Bearer token in a config file
Custom headers
If the upstream server expects a non-standard authorization format or additional headers, use theheaders field:
bearer_token and headers.Authorization, the explicit header value should be treated as the more specific configuration.
Upstream OAuth during registration
Mcpjungle now supports OAuth flows for upstream HTTP MCP servers in beta. The simplest path is interactive CLI registration:- Mcpjungle first tries a normal unauthenticated registration.
- If the upstream server responds with
401and advertises OAuth, the CLI opens your browser. - You approve the OAuth request.
- Mcpjungle stores the resulting token and completes server registration.
This upstream OAuth support is currently beta.
OAuth fields in config files
You can also configure the upstream OAuth flow explicitly in the server JSON config:oauth_redirect_uri: callback URI used during the upstream OAuth flowoauth_client_id: optional pre-registered OAuth client IDoauth_client_secret: optional client secret associated withoauth_client_idoauth_scopes: optional scopes to request during authorization
oauth_client_id is omitted, Mcpjungle attempts dynamic client registration when the upstream authorization server supports it.
Environment variable placeholders
JSON config files support${VAR_NAME} placeholders in string fields, including bearer_token and header values:
STDIO servers and auth via environment variables
For STDIO-based MCP servers, authentication is typically passed through environment variables in the server config. Example:Important scope distinction
Two different authentication layers can exist in the same deployment:- Gateway authentication: Enterprise-mode clients authenticating to Mcpjungle.
- Upstream authentication: Mcpjungle authenticating to a registered MCP server.
Current limitations
Current upstream OAuth support has some limitations:- The feature is currently beta
- It is only supported for streamable HTTP transport
- The oauth token stored is scoped to the whole gateway, ie, per-user oauth login is currently not supported
Related pages
Register servers
Register streamable HTTP MCP servers with CLI flags or config files.
Access control
Configure how MCP clients authenticate to the Mcpjungle gateway itself.
Clients and users
Manage human and machine identities in enterprise mode.
Limitations
Review the remaining OAuth constraints and other current gaps.
