Skip to content

Database routing via URL path (HTTP mode) #180

Description

@MacondoExpress

Breaking change — must NOT be merged into main. Target branch: v2.

Context

The Neo4j MCP server currently accepts only a single database per deployment, configured at startup via the NEO4J_DATABASE environment variable or CLI argument. As part of the multi-tenant proposal, the database name must become a per-request concern in HTTP mode, expressed directly in the URL path.

The new path format is:

/db/{databaseName}/mcp/

When the {databaseName} segment is absent the server should fail.


Goals

1 — Expose the new URL path handler

Register the /db/{databaseName}/mcp/ route in the HTTP server replacing the existing /mcp route.

2 — Extract database name from URL path and inject into context.Context

Parse {databaseName} from the matched route and place it on the request context so the Neo4j driver can consume it downstream, mirroring the existing pattern used for auth headers.

3 — Raise an error when NEO4J_DATABASE or --neo4j-database is set in HTTP mode

The NEO4J_DATABASE environment variable and its CLI argument equivalent are meaningful only in STDIO mode. In HTTP mode the database is expressed via the URL path (sub-task 2).

This change must land in the v2 branch and must not be backported to main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingThis will be a breaking change.enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions