API Key
Secure access and protect your MCP server using API keys.
To enable API key authentication, you can use the apiKeyAuthMiddleware middleware on your app.
If no headerName is provided, the middleware will default to x-api-key.
This middleware can also be used with a validation function. It should return a boolean value indicating if the API key is valid.
Next time you connect to your MCP server, you'll need to provide the API key in the x-api-key header (or the name you specified in the middleware).
Your connection object will look like this:
Make sure to check the connecting documentation for more details on the different clients.