How the MCP Gateway Pattern works with tsidp
mainThe MCP Gateway Pattern uses tsidp to secure communication between an MCP client, a gateway, and a server using Dynamic Client Registration (RFC 7591) and OAuth 2.0 Token Exchange (RFC 8693).
The Workflow:
- Client Registration: The MCP client registers as an OAuth client with
tsidp. - User Authorization: The client requests the user to authorize access to the MCP gateway.
- Gateway Registration: The MCP gateway also registers as an OAuth client with
tsidp. - Token Exchange: Instead of authorizing the user directly, the gateway takes the token presented by the client (where the gateway was the original audience) and exchanges it for a new token where the MCP server is the audience.
- Server Validation: The MCP server registers with
tsidpto perform token introspection, ensuring the token is valid and specifically lists the MCP server as the audience. - Connection: Once validated, the MCP server initiates the connection back to the gateway and the client.