Skip to content

Possibility to scope auth to certain routes only #32

@EDjur

Description

@EDjur

Hi 👋

I have a Fastify server for my web platform. Inside the same server, I want to add an MCP server, but under the /mcp path. I also need to handle OAuth myself.

However, if I enable OAuth with this plugin, it seems to automatically protect all routes, and not only /mcp ?

I.e. with the plugin auth enabled, I cannot access my normal routes anymore since they start returning this instead:

{"error":"authorization_required","error_description":"Authorization header required"}

I tried of course to register the plugin under a prefix. But MCP clients expect auth routes to sit at root level.

Additionally, I believe this kind of functionality will be needed if the server should both act as the MCP server, and the OAuth server.

Cause right now, this path /oauth2/authorize will be under protection, meaning the browser cannot open it.

Thanks for the help!

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