Back to Home
arnaldo-delisio icon

mcp-oauth-password

Verified Safe

by arnaldo-delisio

Overview

Provides a self-hosted, password-based OAuth 2.1 authentication server for Model Context Protocol (MCP) applications.

Installation

Run Command
npx ts-node example/server.ts

Environment Variables

  • SERVER_URL
  • DATABASE_URL
  • OAUTH_CLIENT_ID
  • OAUTH_CLIENT_SECRET
  • OAUTH_PASSWORD_HASH
  • SESSION_SECRET
  • API_KEY
  • NODE_ENV

Security Notes

The server implements OAuth 2.1 with Proof Key for Code Exchange (PKCE), bcrypt password hashing (10 rounds), and secure session cookies (httpOnly, secure, sameSite=Lax). Session and authorization codes are stored persistently in PostgreSQL. Redirect URI validation and automatic rate limiting on login, token, and authorize endpoints help mitigate common attacks. Audit logging tracks authentication events for monitoring. The 'secure' cookie flag is correctly enforced based on the NODE_ENV. For its intended use in personal/self-hosted environments, these features provide strong security. However, as noted in the README, features like token expiration with refresh tokens and multi-user support (beyond a single configured password) are still on the roadmap for full enterprise-grade production readiness (v1.0.0). The example provides default credentials for demonstration, but the core library design encourages using environment variables for sensitive data.

Similar Servers

Stats

Interest Score0
Security Score8
Cost ClassLow
Stars0
Forks0
Last Update2025-12-13

Tags

OAuth 2.1PKCEPassword AuthenticationMCPNode.jsPostgreSQL