Cursor MCP Auth and Token Setup: A Practical Guide A practical guide details how to configure authentication for Model Context Protocol (MCP) servers in the Cursor editor, distinguishing local stdio servers that read secrets from an env field from remote HTTP/SSE servers that take a bearer token in an Authorization header or use an OAuth PKCE flow. It warns that mixing command fields with remote URLs, or headers with stdio entries, is the most common configuration error, and advises keeping credentials out of args and committed configs. Quick answer: Configure MCP auth in Cursor by transport. A local stdio server runs as a child process and reads a secret from an env variable in its config entry, with no HTTP header to set. A remote HTTP or SSE server is reached over the network and takes a bearer token in an Authorization header, or completes an OAuth flow with PKCE the editor starts for you. Either way, put the credential in env or headers, never in args or a committed repo. The first decision is how the server is reached, not which token to paste. A stdio server is launched locally by the editor and talks over standard input and output, so the editor is its parent process and passes a secret through the environment, with no network hop or bearer header. A remote server runs at a URL, the editor connects over HTTPS, and every call carries auth, either a static header or an OAuth token the client renews. | Transport | How it runs | Where the secret goes | Renewal | |---|---|---|---| | Local stdio | Child process, stdin and stdout | env field in the entry | None, static secret | | Remote HTTP or SSE | HTTPS to a URL | Authorization header | Manual token or OAuth | | Remote with OAuth | HTTPS to a URL | Client-managed access token | Refresh on 401, often PKCE | Prefer OAuth for a remote server you do not control: short-lived access tokens cap the damage from a leak, and the editor holds the refresh token instead of a permanent password. The editor reads entries from its MCP config file, global for your machine or project-level with the code. Each named entry uses either command fields or a url. A stdio entry uses command, args, and env; a remote entry uses url and headers. Mixing them is the most common error: a command on a remote entry or a header on a stdio entry leaves the server unreachable. { "mcpServers": { "local-data": { "command": "npx", "args": "-y", "data-mcp" , "env": { "DATA API KEY": "your-secret" } }, "remote-search": { "url": "https://example.com/mcp", "headers": { "Authorization": "Bearer your-token" } } } } The local server reads DATA API KEY from its environment; the remote one reads the header. Never put a secret in args, which show in a process listing and bug reports. In a shared config, inject values from your shell or an untracked file instead. | Symptom | Likely cause | Fix | |---|---|---| | 403 on every call | Token scope too narrow | Reissue with the scope the tools need | | 401 after working for a while | Access token expired | Renew or re-run OAuth | | Works in a terminal, not the editor | Env not inherited by GUI apps | Set it inside the config env field | | Server never appears | command on a remote URL, or url on stdio | Match fields to the transport | | Token leaks after a commit | Secret in a tracked config | Move it to env, rotate the value | A 403 differs from a 401: 401 means unauthenticated, often an expired or missing token, while 403 means the credential was accepted but lacks permission for that tool, so re-pasting the same token will not help. A GUI app launched from the dock may not inherit shell variables from a terminal profile, which is why the config's own env field beats exporting elsewhere. For a hosted endpoint the same field rules apply. A Powerduck Cloud hosted MCP endpoint issues a separate MCP access key for agents, which you place in a header or env like any other token instead of reusing an account password, and it stays off until you expose it. For how the editor compares with a dedicated review and testing workflow, see the comparison hub https://www.powerduck.com/blog/powerduck-vs-cursor/ . Why does my stdio server reject the Authorization header? Because stdio has no HTTP layer. Pass the secret through the env field and read it from the process environment inside the server. Is OAuth always required for remote servers? No. Some accept a static bearer token in headers, but OAuth with short-lived access tokens is the safer choice when the server offers it. How do I check that auth worked? Reload, confirm the tool list is populated, then call one read-only tool. A visible result is stronger than a green connection indicator. Cursor MCP auth follows the transport: stdio takes an env secret on a child process, remote takes a header or an OAuth token on every HTTPS call. Keep credentials out of args and tracked files, verify with a real read-only call, and read a 403 as a scope problem. Match the field to the transport first, and most setup failures never reach the auth stage.