Skip to content

mcp add treats uppercase HTTP(S) URLs as executable commands #2636

Open

Description

@AmarGhugare

mcp add --command accepts an HTTP(S) URL, but changing only the URL scheme's case changes the saved transport from HTTP to a local executable command. The registration still exits successfully.

Reproduction

Tested from source at f26b669b56a4423abd773c81f6c6c9c2ebadc42a on native Windows x64, using Bun 1.4.4. No MCP server or network request is needed.

In an empty temporary project, run the source CLI with your checkout's absolute path:

bun /path/to/codex-security/sdk/typescript/src/cli.ts mcp add --agent=cursor --no-global --json --command='HTTPS://mcp.example.invalid/MCP?mode=ReadOnly'

The command exits 0 and writes this server entry to .cursor/mcp.json:

{
  "command": "HTTPS://mcp.example.invalid/MCP?mode=ReadOnly",
  "args": []
}

Repeat in a separate empty project with only HTTPS changed to https. It also exits 0, but writes:

{
  "url": "https://mcp.example.invalid/MCP?mode=ReadOnly"
}

I checked five schemes through the real CLI registration flow, with isolated home/config directories:

Scheme Saved as Exit status
https URL 0
HTTPS executable command 0
hTtPs executable command 0
http URL 0
HTTP executable command 0

Expected behavior

All these HTTP(S) schemes should select the URL transport. URI scheme names are case-insensitive (RFC 3986, section 3.1). The case-sensitive path and query should remain unchanged.

Cause and impact

The HTTP(S) check in mcpServerConfig uses /^https?:\/\//u. An uppercase or mixed-case scheme falls through to command-line parsing, so the saved configuration asks the client to launch the URL as a program. I verified the generated configuration; I did not launch an MCP client or contact a server.

Workaround: lowercase just the http or https scheme before registration.

Activity

  1. mldangelo-oai commented on Nov 15, 2026

    @mldangelo-oai
    Collaborator

    I reproduced the mixed-case URL problem and compared the three proposed fixes. #2637, #2644, and #2645 contain the same parser change and regression tests. I’d review #2637 for this issue because it also documents the accepted URL schemes. The report-rendering change in #2644 can be evaluated separately under #2447.

  2. added
    bugSomething isn't working
    area:cliCommand-line help, arguments, terminal UI, and user interaction.
    on Nov 15, 2026
  3. AmarGhugare commented on Nov 15, 2026

    @AmarGhugare
    Author

    Thanks for checking and comparing the fixes. Happy to address any feedback on #2637.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliCommand-line help, arguments, terminal UI, and user interaction.bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions