template-express-oauth-sqlite

granular-software/template-express-oauth-sqlite

3.2

If you are the rightful owner of template-express-oauth-sqlite and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This template provides a simple MCP server with OAuth2.1 authentication using SQLite database, perfect for development and small-scale production deployments.

sqlite

A mcpresso MCP server

Quick Start

  1. Install dependencies

    npm install
    
  2. Set up environment variables

    cp .env.example .env
    # Edit .env with your configuration
    
  3. Initialize the database

    npm run db:init
    

    This will create the SQLite database with all necessary tables and indexes.

  4. Start development server

    npm run dev
    
  5. Build for production

    npm run build
    npm start
    

Database Setup

This template uses SQLite for data storage. The database is automatically created when you run the initialization script:

npm run db:init

Database Structure

The initialization script creates the following tables:

  • users - User accounts with authentication
  • sessions - OAuth sessions and tokens
  • notes - User notes with author relationships

Database Features

  • āœ… SQLite file-based storage - No external database required
  • āœ… Foreign key constraints - Maintains data integrity
  • āœ… Optimized indexes - Fast lookups for common queries
  • āœ… Automatic timestamps - Created/updated tracking
  • āœ… OAuth integration - Session and token management

Database Location

The SQLite database is stored at:

data/app.db

You can customize the location by setting the DATABASE_PATH environment variable.

Features

  • OAuth2.1 authentication with SQLite
  • User management and sessions
  • Notes resource with author relationships
  • TypeScript support
  • Development and production builds
  • Environment variable configuration

Project Structure

src/
ā”œā”€ā”€ server.ts          # Main server file
ā”œā”€ā”€ resources/         # MCP resources
│   ā”œā”€ā”€ example.ts
└── auth/              # OAuth configuration
    └── oauth.ts

Environment Variables

VariableDescriptionRequiredDefault
PORTServer portNo3000
SERVER_URLBase URL of your serverYes-
JWT_SECRETSecret key for JWT tokensYes-
DATABASE_PATHSQLite database file pathNodata/app.db

Development

  • npm run dev - Start development server with hot reload
  • npm run build - Build for production
  • npm run typecheck - Type check without building
  • npm run db:init - Initialize database tables and indexes

User Management

Create and manage users with secure password hashing:

  • npm run user:create - Create a user with default credentials
  • npm run user:create <username> <email> <password> - Create a user with custom credentials
  • npm run user:test-password - Test password verification functionality
  • npm run user:test-auth - Test OAuth authentication flow

For detailed user management documentation, see .

License

MIT