Templates / Dynamic MCP server selection with OpenAI GPT-4.1 and contextual AI reranker

Dynamic MCP server selection with OpenAI GPT-4.1 and contextual AI reranker

Unknown

by Jinash Rouniyar ✓ · 416 views · created 2025-09-05 · Engineering, AI RAG

Unknown. This template uses community nodes we can't verify statically. Uses community nodes that can't be verified statically (unverified community packages are off by default in 3.0). Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 12 nodes and runs when a chat message arrives. Along the way it connects OpenAI Chat Model and Contextualai (community).

How it runs

Trigger: When a chat message arrives.

  1. LLM Agent for Decision-Making (AI Agent): runs an AI agent, with model: OpenAI Chat Model
  2. If: checks a condition and branches into true / false
  3. PulseMCP Fetch MCP Servers (HTTP Request): calls an HTTP API
  4. Merge: merges the data from its input branches
  5. Final Response (Chat): uses Chat
  6. Parse MCP Server list into documents w metadata (Code): runs custom JavaScript code
  7. Merge: merges the data from its input branches
  8. Rerank documents (Contextual Ai): work with reranker
  9. Format the top 5 results (Code): runs custom JavaScript code
  10. Final Response (Chat): uses Chat

Services it uses

OpenAI Chat ModelContextualai (community)

Before you upgrade to n8n 3.0

We can't fully verify this one: it relies on 1 community package, and n8n 3.0 turns unverified community packages off by default (N8N_UNVERIFIED_PACKAGES_ENABLED=false).

  • Check that n8n-nodes-contextualai is verified or supports 3.0 (used in Rerank documents).

Nodes used (9)

From the author

PROBLEM Thousands of MCP Servers exist and many are updated daily, making server selection difficult for LLMs. - Current approaches require manually downloading and configuring servers, limiting flexibility. - When multiple servers are pre-configured, LLMs…

Excerpt from Jinash Rouniyar's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.