How to config MCP server with an env parameter in Cursor

like this:

env GITHUB_PERSONAL_ACCESS_TOKEN=xxxxxxxxx npx -y @modelcontextprotocol/server-github

Thank you for your reply, but the MCP tool cannot be loaded using this configuration command:

It happened to me but after closing and opening it worked, by the way do you have node installed so you can run npx, try the command in the console it should work

Thanks for your reply.
I installed node. I can run MCP without configuring the env parameter in command. However, an error occurs when using the env parameter

Once installed, entering and exiting the cursor should work

maybe a solution…

Yes I have the Github MCP working via smithery it solves the env issue.

The alternative (as per the cursor docs) is to create a bash script and set the env in that script and then use that script as the mcp target.

1 Like

This Issue was annoying me so much that I created an NPM package that fixes it
you can use the terminal generator at mcprunner.com this will create a one line command that will work in cursor using that package :smiley: