DEV Community

Cover image for 🧠🥷How to use MCP in Cline and Cursor 2 (use under Proxy)
Web Developer Hyper
Web Developer Hyper

Posted on • Edited on

2 1

🧠🥷How to use MCP in Cline and Cursor 2 (use under Proxy)

Intro

Hello! I'm a Ninja Web Developer. Hi-Yah!🥷
By the way, I couldn't figure out whether the Ninja of the cover image is in front of the desk or back of the desk.🤣 Never mind.
Last time, I wrote how to use MCP in Cline and Cursor, but couldn't use MCP under Proxy.
🧠🥷How to use MCP in Cline and Cursor
So this time I will write about how to use MCP under Proxy.
I hope this post will be a help to someone, because I wasted much time trying to use MCP under Proxy.🤮

What didn't work

1️⃣ Set environment variable of proxy in PC
2️⃣ Set env of proxy in mcp.json for Cursor and cline_mcp_settings.json for Cline.

Why I couldn't use MCP under Proxy?

I looked inside the code of MCP Slack server.
It was using fetch to communicate with slack.
I searched the relation of fetch and proxy, and found the answer in the article of Microsoft .🎉
https://learn.microsoft.com/en-us/microsoft-cloud/dev/dev-proxy/how-to/use-dev-proxy-with-nodejs
The answer is fetch cannot use env of proxy.

How to use MCP under Proxy

First, I tried global-agent, because it looked easier than others.
It didn't work in my case...🤮
Second, I tried https-proxy-agent.
It also didn't work in my case...🤮
Third, I tried Axios, and replaced all the fetch to Axios in the code.
I did it using the AI power of Cline and Cursor.
It worked!🎉
Please let me know, if there is a better way to use MCP under Proxy.

How to use MCP in Cline and Cursor under Proxy (Step by step)

I will explain using Slack MCP Server for example.
https://github.com/modelcontextprotocol/servers/tree/main/src/slack
I checked it works both in Cline and Cursor.
1️⃣ Download Slack MCP Server in PC.↓

npm install @modelcontextprotocol/server-slack
Enter fullscreen mode Exit fullscreen mode

2️⃣ Install Axios.↓

npm install axios
Enter fullscreen mode Exit fullscreen mode

3️⃣ Replace all the fetch to axios.↓
Not just replace the word fetch to axios, but rewrite the code for axios.
So, it will be easy if you ask AI to do it.
I will make a repository for this code later.
4️⃣ Set the mcp.json for Cursor and cline_mcp_settings.json for Cline.↓

{
  "mcpServers": {
    "slack-server": {
      "command": "cmd",
      "args": [
        "/c",
        "node",
        "C:/path to your folder/node_modules/@modelcontextprotocol/server-slack/dist/index.js"
      ],
      "env": {
        "SLACK_BOT_TOKEN": "xoxb-your-bot-token",
        "SLACK_TEAM_ID": "T01234567",
        "HTTP_PROXY": "your proxy",
        "HTTPS_PROXY": "your proxy"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Changed npx to node.
5️⃣ Now you are ready to use MCP under Proxy.🎉

Outro

If you can use MCP under Proxy, the range of use of MCP will expand.
I heard that there are other interesting MPC server like Blender MCP and Unity MCP and others.
I would like to learn more about MCP and share it.
Thank you for reading.
Happy AI coding!🤖 Hi-Yah!🥷

Update (2025/03/22):Wrote about How to make MCP (Cline and Cursor)
🧠🥷How to make MCP (Cline and Cursor)

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

If this article connected with you, consider tapping ❤️ or leaving a brief comment to share your thoughts!

Okay