AdYour product here, seen by people installing AI tools every day Sponsor slots open: 12 of 12, from $249 a month

Troubleshooting

Fix 401 Unauthorized and missing API key errors in MCP servers

Most MCP servers that connect to a service need an API key or token, passed as an environment variable in the config. A 401 means the key is missing, wrong or expired. Add it under "env" in the server config with the exact variable name from the README, then restart the app.

Why it happens

  • The key was never added.
  • The variable name does not match what the server expects.
  • The key is expired or lacks the right permissions.

How to fix it

  1. 1

    Add the key to the config

    "my-server": {
      "command": "npx",
      "args": ["-y", "package-name"],
      "env": { "API_KEY": "your-key" }
    }
  2. 2

    Match the variable name

    Copy the exact name from the server's README. Names are case-sensitive.

  3. 3

    Check the key itself

    Create a fresh key with the scopes the README lists, and never commit it to a shared repository.

Still stuck? Every server page on this site shows the exact config for each app. Find your server.