granular-software/template-express-oauth-sqlite
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
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env # Edit .env with your configuration
-
Initialize the database
npm run db:init
This will create the SQLite database with all necessary tables and indexes.
-
Start development server
npm run dev
-
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
Variable | Description | Required | Default |
---|---|---|---|
PORT | Server port | No | 3000 |
SERVER_URL | Base URL of your server | Yes | - |
JWT_SECRET | Secret key for JWT tokens | Yes | - |
DATABASE_PATH | SQLite database file path | No | data/app.db |
Development
npm run dev
- Start development server with hot reloadnpm run build
- Build for productionnpm run typecheck
- Type check without buildingnpm 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 credentialsnpm run user:create <username> <email> <password>
- Create a user with custom credentialsnpm run user:test-password
- Test password verification functionalitynpm run user:test-auth
- Test OAuth authentication flow
For detailed user management documentation, see .
License
MIT