examples/server: add example MCP server with JWT and API key (#339)
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. Fixes #330
This commit is contained in:
parent
be0a00cd0a
commit
a3935c6be2
1 changed files with 664 additions and 0 deletions
15
examples/server/auth-middleware/go.mod
Normal file
15
examples/server/auth-middleware/go.mod
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
module auth-middleware-example
|
||||
|
||||
go 1.23.0
|
||||
|
||||
require (
|
||||
github.com/golang-jwt/jwt/v5 v5.2.2
|
||||
github.com/modelcontextprotocol/go-sdk v0.3.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/google/jsonschema-go v0.2.1-0.20250825175020-748c325cec76 // indirect
|
||||
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
|
||||
)
|
||||
|
||||
replace github.com/modelcontextprotocol/go-sdk => ../../../
|
||||
Loading…
Reference in a new issue