MCP -with-HTTPS-and-GitHub-OAuth
This project is a secure MCP server built with Node.js and Express. It features HTTPS encryption using self-signed certificates, GitHub OAuth authentication, and additional security measures like rate limiting and HTTP header protection.
claude mcp add --transport stdio omar-steam-mcp-server-with-https-and-github-oauth node server.js \ --env CLIENT_ID="your-github-client-id" \ --env REDIRECT_URI="https://localhost:3000/auth/callback" \ --env CLIENT_SECRET="your-github-client-secret" \ --env SESSION_SECRET="your-session-secret"
How to use
This MCP server is a secure local instance built with Node.js and Express. It serves over HTTPS using a self-signed certificate and integrates GitHub OAuth for user authentication, along with security measures like rate limiting and helmet-based HTTP header protections. After starting the server, you can access the site securely at https://localhost:3000. Use the /auth route to begin GitHub authentication, which will redirect you through GitHub and back to the app at /success on successful login. A protected route such as /secure-data requires authentication; unauthenticated requests to that route will yield a 401 error. The server is designed to enforce secure sessions and handle common web security concerns, making it suitable for local development and testing of OAuth-protected MCP endpoints.
How to install
Prerequisites:
- Node.js v16 or later
- npm (comes with Node.js)
- OpenSSL (for generating SSL certificates)
Step-by-step installation:
-
Clone the repository git clone https://github.com/omar-steam/MCP-Server-with-HTTPS-and-GitHub-OAuth.git cd mcp-server
-
Install dependencies npm install
-
Generate SSL certificates for HTTPS (self-signed for local use) openssl genrsa -out key.pem 2048 openssl req -new -key key.pem -out csr.pem openssl x509 -req -days 365 -in csr.pem -signkey key.pem -out cert.pem // This will produce key.pem and cert.pem in the project root
-
Configure environment variables Create a .env file in the project root with the following: CLIENT_ID=your-github-client-id CLIENT_SECRET=your-github-client-secret REDIRECT_URI=https://localhost:3000/auth/callback SESSION_SECRET=your-session-secret // Replace the placeholders with your actual GitHub OAuth app credentials
-
Start the server node server.js // You should see something like: Secure server running on https://localhost:3000
Additional notes
Tips and notes:
- The server uses self-signed certificates for HTTPS. Browsers will show security warnings; you can proceed for development purposes. For production, replace with a certificate from a trusted CA.
- Ensure the .env values (CLIENT_ID, CLIENT_SECRET, REDIRECT_URI, SESSION_SECRET) are correctly set; mismatches can cause OAuth failures.
- If port 3000 is in use, update the server code to listen on a different port or stop the conflicting service.
- The authentication flow relies on GitHub OAuth app settings; make sure the OAuth app includes the correct Redirect URL (https://localhost:3000/auth/callback).
- For production-like testing, consider adjusting rate limiting and helmet configurations as needed for your environment.
Related MCP Servers
zen
Selfhosted notes app. Single golang binary, notes stored as markdown within SQLite, full-text search, very low resource usage
MCP -Deepseek_R1
A Model Context Protocol (MCP) server implementation connecting Claude Desktop with DeepSeek's language models (R1/V3)
mcp-fhir
A Model Context Protocol implementation for FHIR
mcp
Inkdrop Model Context Protocol Server
mcp-appium-gestures
This is a Model Context Protocol (MCP) server providing resources and tools for Appium mobile gestures using Actions API..
dubco -npm
The (Unofficial) dubco-mcp-server enables AI assistants to manage Dub.co short links via the Model Context Protocol. It provides three MCP tools: create_link for generating new short URLs, update_link for modifying existing links, and delete_link for removing short links.