feat(auth-middleware): add example MCP server with JWT and API key#339
Conversation
|
Amazing, Cheers for this! Just one thing -- with the 0.3.0 release, there are a few breaking changes to this example. With a few minor tweaks around the |
9887230 to
2defb9f
Compare
|
@wagnerjt |
|
Unfortunately I'm not a maintainer of this repo to approve this. Just wanted to give you a heads up and again, nice example @yasomaru! |
|
Thanks! We'll review shortly. If @jba can't review today, I'll review :) |
jba
left a comment
There was a problem hiding this comment.
This is awesome! Thanks so much for doing this and validating (no pun intended) the server-side auth design.
Is there anything we're missing? Something in the auth package you wish we had?
Thank you for the kind words!
But ,the current design is already quite solid and covers the main use cases really well. |
|
Thanks for those suggestions. I'm glad the core design is sound. |
…thentication This commit introduces a new example demonstrating the integration of authentication middleware with an MCP server. The server supports both JWT token and API key authentication, along with scope-based access control for various MCP tools. Key features include token generation endpoints, in-memory API key storage, and a health check endpoint. New files added: - `main.go`: Implements the MCP server and authentication logic. - `go.mod` and `go.sum`: Manage dependencies for the project. - `README.md`: Provides setup instructions, available endpoints, and example usage. This example serves as a reference for implementing secure access to MCP tools.
…ypes after rebase
…mments This commit renames several functions in the authentication middleware to improve clarity, changing `jwtVerifier` to `verifyJWT` and `apiKeyVerifier` to `verifyAPIKey`. Additionally, comments throughout the code have been updated for consistency and clarity, ensuring they accurately describe the functionality. The changes also include adjustments to the handling of user information extraction and scope checks in the MCP tools.
9281e40 to
7c04a3d
Compare
This commit introduces a new example demonstrating the integration of authentication middleware with an MCP server. The server supports both JWT token and API key authentication, along with scope-based access control for various MCP tools. Key features include token generation endpoints, in-memory API key storage, and a health check endpoint.
New files added:
main.go: Implements the MCP server and authentication logic.go.modandgo.sum: Manage dependencies for the project.README.md: Provides setup instructions, available endpoints, and example usage.This example serves as a reference for implementing secure access to MCP tools.
Fixes #330