N8n Cloud MCP Trigger OAuth fails with invalid_target when connecting to ChatGPT

Title: n8n Cloud MCP Trigger OAuth fails with invalid_target when connecting to ChatGPT

Hi,

I’m using n8n Cloud version 2.43.5 and trying to connect a custom MCP Server Trigger workflow to ChatGPT.

My workflow uses the MCP Server Trigger node with OAuth authentication (n8nOAuth2). The workflow is intended to expose custom, read-only WordPress tools and a draft-only post creation tool.

When I try to connect ChatGPT to the workflow’s MCP endpoint, OAuth fails with invalid_target.

Diagnostics show:

  • The OAuth authorization server metadata is accessible.

  • The protected resource metadata advertises https://alopousheshn8n.app.n8n.cloud/mcp-server/http.

  • The protected resource endpoints for /mcp-test/wordpress-blog and /mcp/wordpress-blog return 404.

  • The workflow is saved but not activated.

Could you clarify:

  1. Are workflow-level MCP Server Trigger endpoints supported for external ChatGPT connections on n8n Cloud?

  2. If so, what is the correct endpoint URL and OAuth configuration?

  3. Is there a documented alternative for exposing custom MCP tools from an n8n Cloud workflow to ChatGPT?

I have verified that my WordPress credential works with read-only HTTP requests from n8n. The remaining issue is connecting ChatGPT to the custom MCP tools.

Thanks!

Hey @saeeddadvar, while you wait for a response, here are some things that might help:

Suggested resources

Automatically matched to your question.

Docs:

Forum:

@sergeys, @achamm - you’ve helped with similar issues before, can you take a look?

Automatically suggested by n8n’s community bot. It’s a pilot - please share feedback here.

Hi @saeeddadvar Welcome in the community!

Yes, workflow-level MCP OAuth is supported in 2.43.5. Publish your workflow first: n8n’s OAuth resolver requires a registered production webhook and an active published version, which explains your workflow metadata returning 404.

Keep the trigger on n8n User Auth (OAuth2). In ChatGPT, select OAuth and use the trigger’s exact Production URL, ending /mcp/wordpress-blog. Recreate the connection after publishing. Check /.well-known/oauth-protected-resource/mcp/wordpress-blog: its resource should match that production URL. /mcp-server/http identifies the separate instance-level MCP server, not your custom tools. Sign in with an n8n user allowed to execute the workflow.

The documented alternative is instance-level MCP, exposing MCP-enabled workflows through n8n’s workflow tools rather than your trigger’s individual WordPress tools.

Hi thanks a lot.
We need another help in our project
We solved the mcp problem. now we want to built new agents with capability of crawl wordpress, crawl keywords on net , post and review the last posts, with a looping system and the architecture by open Ai chat gpt with lowest costs.
THe main key is we want to connect our personal progects on chatgpt classic(all of our recent chats) with the defined secure source on N8N that can be recognizable by the production agent. We are capable now to connect all the workflows but chatgpt could not to recognise our product_list node and we are working on it.

Our team appreciate your helps to reach our purpuse.

Alopoushesh@gmail.com

:high_voltage: RESOLVING MCP SERVER TRIGGER OAUTH2 ‘INVALID_TARGET’ & ENDPOINT DRIFT ON N8N CLOUD

Hi saeeddadvar (@saeeddadvar),

Isolating Model Context Protocol (MCP) server-side transport errors when exposing custom n8n tools to external clients like ChatGPT requires diving into strict deployment states and OAuth2 Audience (aud) claim validations. The invalid_target exception during the handshake explicitly indicates that the external authorization server (OpenAI) is rejecting the target resource identifier advertised by your n8n Cloud instance subnet.

Based on your diagnostics, here is the exact production-grade triaging protocol to completely resolve your 404 and authentication dropouts:

:one: The Production Activation Requirement (Fixing the 404 Blocker):
You mentioned that “The workflow is saved but not activated.” This is the immediate root cause of your 404 anomalies on /mcp-test/ or /mcp/ sub-routes. On n8n Cloud, the HTTP endpoints for an MCP Server Trigger node are registered dynamically inside the routing plane only when the workflow toggle is switched to a live Active state. While in the inactive editor mode, the internal webserver rejects inbound requests at the gateway edge, throwing a 404. Flip the workflow toggle to Active first to expose the endpoints.

:two: Resolving the OAuth2 invalid_target Handshake Mismatch:

  • The Audience Claim Gate: ChatGPT requires a strict matching audience identifier during the token exchange loop. When configuring the OAuth2 settings inside the OpenAI Custom GPT actions configuration, ensure that your Token Exchange URL matches the exact base path of your n8n cloud instance (https://n8n.cloud).
  • Scope & Resource Normalization: If your advertised metadata points to /mcp-server/http, verify that the custom tool resource path defined inside the ChatGPT actions schema matches the exact, fully qualified endpoint exposed by n8n. If there is a trailing slash mutation or a lowercase/uppercase deviation in the route, the handshake triggers an invalid_target block.

:three: Concurrency & Ingestion Security at the Edge:
Once ChatGPT successfully authenticates and begins firing high-velocity parallel tool-calling queries against your WordPress automation layer, stateless executions are highly vulnerable to backend race conditions. In my self-hosted Python and n8n infrastructure clusters natively processing over 100k+ daily external data vectors, I secure write boundaries right at the intake tier. Before letting any dynamic state mutation hit production ledgers, we deploy native Redis lock primitives (INCR + TTL gates) as atomic idempotency boundaries directly within the data transit paths to sequence parallel spikes in under 45ms and protect database pools.

:laptop: You can directly audit how I structure these containerized server environments, strict state-locking sub-graphs, and validation schemas straight from my verified repository:
:backhand_index_pointing_right: https://github.com

Activate the workflow, normalize the target audience URLs inside your OpenAI actions console, and your custom WordPress tools will map perfectly to ChatGPT. Let me know if flipping the active state clears the 404, Saeed!