Multi Agents N8N - MCP Server/client need help!

Hello community!
I hope you’re all doing well. As for me, I’m tearing my hair out with my workflow(s)!
I’m trying to build a multi-agent/workflow system using the MCP Server/client setup in n8n. (Yes, I know, crewai and others already do this very well, but I like n8n and want to build this system inside n8n. Once it’s working, I think it will be much easier to add or remove agents, etc.)
I’ve tried a bunch of methods and honestly, I’m not sure where I stand anymore — I’m sure you know how that feels :smiley: Anyway!

So, I have a first workflow that interacts with an agent via an OpenWebUI chat (thanks Cole Medin!), which sends user requests to an MCP Server. Then the MCP Server forwards my request to the desired agent.

But I can’t seem to send my question to the MCP Server — it’s always empty. I’ve tried different approaches, added logs, etc., but nothing works. I don’t see the right way to make it work!

So here’s the first workflow (the agent interacting via OpenWebUI):

Then the MCP Server (here simplified to try and make it work/understand):

And finally, my AI agent connected to my MCP Server:

If you have any suggestions, questions, best practices, etc., I’m all ears!

There are probably some settings to adjust, whether it’s the choice of AI agents or other configurations, but for now, I have to admit I’m focused on getting my question to reach my RAG agent so it can activate its function and search the Qdrant database to return an answer. I’ll handle the rest myself!

Thanks in advance for everything :slight_smile:

1 Like

It appears that the core of your problem is that your MCP Server is not correctly receiving the query.input or RAG field.

So try this: Change the MCP Client tool call format

Inside your Client agent, update the tool call format to explicitly pass query.input:

{
“query”: {
“input”: “{{input}}”
}
}

In your system message or instructions to the AI agent, guide it to use:

{
“query”: {
“input”: “YOUR_QUESTION_HERE”
}
}

Or in code:

return [{
json: {
query: {
input: $json.input || “fallback default”
}
}
}]

Alternatively, you could log the Incoming Payload in the MCP Tool Workflow, OR If you want a quick and dirty fix in the MCP Server tool workflow, change the mapping to: “RAG”: “={{$json.query?.input || $json.RAG || $json.input}}”

Let mre know if any of these works. Thnx

Hello Creatiive,

Thank you for your response and feedback!
I was able to test your method this morning, it’s pretty much what I had in mind but couldn’t manage to do because I feel like the graphical interface doesn’t give me the option to add:
"Inside your Client agent, update the tool call format to explicitly pass query.input:

{
  "query": {
    "input": "{{input}}"
  }
}

I modified the parameters directly in the JSON and added this:

"workflowInputs": {
  "mappingMode": "defineBelow",
  "value": {
    "text": "={{ $json[\"query\"][\"input\"] }}"
  }
}

Then I copied and pasted the workflow, but what I’m trying to understand is where I could have set this value in the interface here:

Anyway, thanks a lot, it really helped me, although now I’m facing the timeout error which seems to be currently fixed (https://github.com/n8n-io/n8n/pull/15886).
I will now try other agents.

Thanks again :slight_smile:

1 Like