Skip to content

Local MCP Server fails with 400 Bad Request when Organization API key is used #183

@8888-droid

Description

@8888-droid

Description

When running the local MCP server with an Organization API key (not a Personal API key), the server fails with a 400 Bad Request error.

Steps to Reproduce

  1. Create an Organization API key in Neon Console (Settings → API Keys within an organization)
  2. Run the local MCP server:
    npx -y @neondatabase/mcp-server-neon start <ORG_API_KEY>
  3. Server crashes with AxiosError: Request failed with status code 400

Expected Behavior

Server should start successfully and be ready to accept MCP commands.

Actual Behavior

Server crashes immediately with the following error:

Server error: AxiosError: Request failed with status code 400
    at settle (.../axios/dist/node/axios.cjs:2090:12)
    ...
    at async file:///.../dist/index.js:39:26 {
  code: 'ERR_BAD_REQUEST',
  ...
}

Additional Context

  • Version: @neondatabase/mcp-server-neon@0.6.5
  • Node.js: v22 (Alpine Docker image)
  • API Key Type: Organization API key (not Personal)

Verification that the API key works

Direct API calls with the same key work correctly:

# This works:
curl -H "Authorization: Bearer <ORG_API_KEY>" "https://console.neon.tech/api/v2/projects"
# Returns list of projects successfully

# This also works:
curl -H "Authorization: Bearer <ORG_API_KEY>" "https://console.neon.tech/api/v2/auth"
# Returns: {"account_id":"org-xxx","auth_method":"api_key_org","auth_data":"..."}

So the API key is valid and works, but the MCP server package fails to initialize with it.

Possible Cause

The error occurs during initialization at dist/index.js:39. It seems like the server might be making a request that doesn't properly handle Organization API keys vs Personal API keys, possibly sending an incorrect request format to the /auth endpoint or another initialization endpoint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions