Local MCP-Server-with-HTTPS-and-GitHub-OAuth

Local MCP-Server-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.

omar-steam

Developer Tools
Visit Server

README

Local MCP-Server-with-HTTPS-and-GitHub-OAuth

This project is a secure local 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.

Features

  • HTTPS Encryption: Ensures secure communication between clients and the server.
  • GitHub OAuth Authentication: Allows users to log in using their GitHub accounts.
  • Rate Limiting: Protects against abuse and denial-of-service (DoS) attacks.
  • Secure Session Management: Uses express-session with secure cookies.
  • HTTP Header Security: Implements helmet to protect against common vulnerabilities.

Prerequisites

Before you begin, ensure you have the following installed on your system:

  • Node.js (v16 or later)
  • npm (comes with Node.js)
  • OpenSSL (for generating SSL certificates)

Setup Instructions

Step 1: Clone the Repository

Clone this repository to your local machine:

git clone https://github.com/omar-steam/MCP-Server-with-HTTPS-and-GitHub-OAuth.git cd mcp-server

Step 2: Install Dependencies

Install the required npm packages:

npm install

Step 3: Generate SSL Certificates

Generate self-signed SSL certificates using OpenSSL:

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 create the following files in your project directory:

  • key.pem: Private key
  • cert.pem: Self-signed certificate

Step 4: Configure Environment Variables

Create a .env file in the root of your project and add the following variables:

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 your-github-client-id and your-github-client-secret with the credentials from your GitHub OAuth App.

Step 5: Start the Server

Run the server: node server.js

You should see:

Secure server running on https://localhost:3000

Usage

Accessing the Server

Open your browser and navigate to:

https://localhost:3000

Authentication via GitHub

  1. Visit /auth to start the GitHub authentication process:

https://localhost:3000/auth

  1. After successful login, you’ll be redirected to /success.
  2. If authentication fails, you’ll be redirected to /failure.

Protected Routes

Access /secure-data to test a route that requires authentication:

https://localhost:3000/secure-data

If you’re not authenticated, you’ll see a 401 Unauthorized error.

Project Structure

mcp-server/ ├── key.pem # Private key for HTTPS ├── cert.pem # Self-signed certificate for HTTPS ├── server.js # Main server file ├── package.json # Project metadata and dependencies ├── .env # Environment variables (not included in version control) └── README.md # Project documentation (this file)

Troubleshooting

Port Already in Use (EADDRINUSE)

If port 3000 is already in use, stop any processes using it or change the port in server.js.

To find and kill processes using port 3000:

netstat -ano | findstr :3000 taskkill /PID <PID> /F

Certificate Warnings in Browser

Self-signed certificates are not trusted by browsers. For production, use a trusted Certificate Authority like Let’s Encrypt.

Contributing

Feel free to fork this repository, make improvements, and submit pull requests! Contributions are welcome.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

Special thanks to:


Enjoy building your secure MCP server guys! 🔥🔥🔥


Notes for Customization:

  1. Replace placeholders like your-github-client-id with your actual credentials.
  2. Update the repository URL (git clone) with your GitHub repository link if you’re hosting this code.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python