Passing env variable to remote Custom MCP server

Describe the problem/error/question

I have setup a custom mcp server running on AWS enviroment. I would like to pass env variables to the server in json format like below:

{
  "mcpServers": {
    "mindbodyHTTP-mcp": {
      "command": "npx",
      "args": [
        "mcp-remote@latest",
        "http://127.0.0.1:8080/mcp"
      ],
      "env": {
        "MINDBODY_API_KEY": "your_api_key",
        "MINDBODY_SITE_ID": "-99",
        "MINDBODY_SOURCE_NAME": "your_source_name",
        "MINDBODY_SOURCE_PASSWORD": "your_source_password"
      }
    }
  }
}

The MCP Client tool does not allow this to be added, where and How can I pass this to the MCP server? I am not running n8n locally, its the n8n cloud.

This works with the claude desktop, I cant find any a way to add this json to MCP Client tool. If there is another tool I need to use, please let me know.

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

{
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        0
      ],
      "id": "e33aaaee-9b8a-49b9-86ba-edbb006ec5fd",
      "name": "When chat message received",
      "webhookId": "ba5aa47d-b57d-4fc3-b292-c18523a25952"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        208,
        0
      ],
      "id": "dd73eaa0-b20d-46cd-90d4-3f131762830a",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4.1-mini",
          "mode": "list",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        80,
        208
      ],
      "id": "e8851180-c873-4aab-8c38-8179107ca813",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "L3KvLeqWqy6nNIMP",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        224,
        208
      ],
      "id": "161eae6c-a6dc-44e3-80bb-03f9436298b1",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "endpointUrl": "http://ec2-52-54-51-95.compute-1.amazonaws.com:8080/mcp",
        "serverTransport": "httpStreamable",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "typeVersion": 1.1,
      "position": [
        400,
        208
      ],
      "id": "2190a68c-d5fd-4f24-84c7-4822ad8a7f87",
      "name": "Mindbody MCP"
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Mindbody MCP": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "15941d1943f5399b35a98e1d4a408c1f5aad9fc01cffee733c7a2c88e94621f9"
  }
}

1 Like

Hey @starwoodmedspa hope all is good. Welcome to the community.

Unfortunately, from what I know, the native MCP Client tool doesn’t allow passing environment variables yet, but the community node (n8n-nodes-mcp) does. In your case that’s not an option, if you are running n8n in the cloud.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.