Secure MCP TypeScript Server
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 TypeScript ServerWho am I?"
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 TypeScript Server
A TypeScript-based Model Context Protocol (MCP) server with OAuth2 authentication powered by Asgardeo.
Overview
This project demonstrates how to create a secure MCP server that:
Uses TypeScript for type safety
Implements OAuth2 authentication with Asgardeo
Exposes MCP tools that require authentication
Returns authenticated user profile information
Related MCP server: Databricks MCP Server
Prerequisites
Node.js (v16 or higher)
npm, yarn, or pnpm
Quick Start
1. Clone the Repository
git clone https://github.com/ngsanthosh/typescript-mcp-auth-quickstart.git
cd typescript-mcp-auth-quickstart2. Install Dependencies
npm install3. Configure Asgardeo
Sign into your Asgardeo console
Navigate to Applications > New Application
Select Single Page Application and complete the wizard
Name: SecureMCPServer
Authorized Redirect URL: http://localhost:3000/oauth/callback
Save the following values from the application:
client-id(from Protocol tab)Base URL (e.g.,
https://api.asgardeo.io/t/your-org)
4. Set Up Environment Variables
Create a .env file in the root directory:
cp .env.example .envUpdate .env with your Asgardeo configuration:
ASGARDEO_BASE_URL=https://api.asgardeo.io/t/your-org
PORT=30005. Build and Run
Development mode:
npm run devProduction mode:
npm run build
npm startThe server will start on http://localhost:3000/mcp
6. Configure Claude Desktop
Open Claude Desktop
Go to Settings > Developer
Click Edit Config to open
claude_desktop_config.jsonAdd the following configuration:
{
"mcpServers": {
"secure-whoami-server": {
"command": "npx",
"args": [
"mcp-remote@latest",
"http://localhost:3000/mcp",
"--static-oauth-client-info",
"{\"client_id\": \"<your-client-id>\"}",
"--static-oauth-client-metadata",
"{\"scope\": \"openid profile email\"}"
]
}
}
}Replace <your-client-id> with the client ID from your Asgardeo application.
7. Test the Server
Restart Claude Desktop
You'll be redirected to Asgardeo for login
After authentication, ask Claude: "Who am I?"
The server will return your authenticated user profile information
Project Structure
.
├── src/
│ └── index.ts # Main MCP server implementation
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── .env.example # Example environment variables
├── .gitignore # Git ignore rules
├── README.md # This file
└── LICENSE # LicenseKey Features
OAuth2 Authentication: Secure authentication via Asgardeo
Type Safety: Full TypeScript support
MCP Tools: Expose
whoamitool that returns user profileExpress Server: Built on Express.js for HTTP transport
Authentication Middleware: Protect MCP endpoints with
mcpAuthServer.protect()
Available Tools
whoami
Returns the authenticated user's profile information.
Input: None
Output:
{
"profile": {
"sub": "user-id",
"email": "user@example.com",
"given_name": "John",
"family_name": "Doe",
...
}
}Environment Variables
Variable | Description | Example |
| Your Asgardeo organization base URL |
|
| Server port (default: 3000) |
|
Troubleshooting
"Not authenticated" Error
Ensure you've created a test user in Asgardeo (guide)
Verify your client ID is correct in Claude Desktop config
Clear browser cache and try logging in again
Server Won't Start
Check that port 3000 is not in use:
lsof -i :3000Verify all environment variables are set in
.envEnsure Node.js version is 16+
Module Not Found Errors
Run
npm installagainDelete
node_modulesandpackage-lock.json, then reinstall
Learn More
License
MIT
Support
For issues and questions:
Check the Asgardeo Documentation
Visit Stack Overflow
Open an issue in this repository
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/ngsanthosh/typescript-mcp-auth-quickstart'
If you have feedback or need assistance with the MCP directory API, please join our Discord server