Secure MCP Auth Demo
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Secure MCP Auth DemoRead my profile"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Secure MCP Auth Demo
A small, local teaching demo that uses a real MCP Streamable HTTP server with JWT bearer-token authentication and scope-based authorization.
It is intentionally separate from the LangChain and LangGraph demos in this workspace.
What it teaches
The demo models three roles:
Demo user | Granted scopes |
Alice Reader |
|
Bob Contributor | Alice's scopes plus |
Admin Auditor | All scopes, including |
The protected MCP tools are:
Tool | Required scope |
|
|
|
|
|
|
|
|
The request path
Streamlit teaching client
-> Authorization: Bearer <JWT>
-> MCP Streamable HTTP server (/mcp)
-> validate signature, exp, iss, aud
-> read trusted sub and scope claims
-> allow or deny the requested toolThe JWT includes sub, scope, aud, iss, iat, exp, and jti. JWT payloads are signed, not encrypted: do not place passwords, API keys, or sensitive personal information in them.
Run locally
This project uses an isolated virtual environment.
.\.venv\Scripts\python.exe server.pyIn another terminal:
.\.venv\Scripts\streamlit.exe run app.py --server.port 8503Open http://127.0.0.1:8503. Choose Alice, Bob, or Admin, inspect the issued token claims, and try each tool. For example, Alice receives HTTP 403 when trying notes_create, while Bob succeeds.
Verify
.\.venv\Scripts\python.exe -m unittest discover -s tests -vThe server also exposes MCP protected-resource metadata at:
http://127.0.0.1:8765/.well-known/oauth-protected-resource/mcpTeaching boundary
The local app issues tokens itself so every part of the flow is easy to inspect. That is suitable for a lesson, not for a deployed service.
For production, replace auth.py's local issuer with a trusted OAuth/OIDC authorization server such as Auth0, Okta, Microsoft Entra ID, Amazon Cognito, or a company identity provider. Keep the MCP server's validation of issuer, audience, expiry, signature, and scopes.
MCP's HTTP authorization model uses bearer tokens in the Authorization header on every request, validates tokens as an OAuth resource server, and uses 401 for missing or invalid credentials and 403 for insufficient scopes. See the MCP Authorization specification.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kenngcareer/secure-mcp-auth-demo'
If you have feedback or need assistance with the MCP directory API, please join our Discord server