Provides tools for executing SQL queries and transactions against SQLite databases, enabling database operations and data management
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Server with External Toolsget current weather in New York City"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP (Model Context Protocol) Server
A production-ready implementation of a Model Context Protocol (MCP) server with a modern React frontend. The server provides a secure JSON-RPC interface for AI model interactions, while the frontend offers a user-friendly dashboard for monitoring and management.
β¨ Features
Backend (Node.js/TypeScript)
JSON-RPC 2.0 over HTTP with WebSocket support
TypeScript with full type safety
Modular Architecture for easy extension
SQLite database with migrations
JWT-based authentication with OAuth 2.0 support
Rate limiting and security headers
Winston logging with file rotation
Health checks with detailed system metrics
API Documentation with Swagger/OpenAPI
Containerization with Docker
Frontend (React/TypeScript)
π Vite for fast development and builds
π¨ Material-UI (MUI) for beautiful, responsive UI
π React Query for server state management
π‘οΈ Secure API client with token refresh
π± Mobile-responsive design with PWA support
π Theming support
π Real-time monitoring and metrics
π Error tracking with Sentry
Related MCP server: MCP Weather Server
π Getting Started
Prerequisites
Node.js 18+
npm or yarn
SQLite3 (included in most systems)
Docker (optional, for containerized deployment)
Quick Start
Clone and install dependencies:
git clone https://github.com/edogola4/mcp.git cd mcp # Install backend dependencies npm install # Install frontend dependencies cd client npm install cd ..Set up environment variables:
# Run the setup script npm run setup # Or manually copy the example config cp config.example.ts .envEdit the
.envfile and update the configuration values as needed.Start the development servers:
# In the root directory (for the backend) npm run dev # In a new terminal, from the client directory (for the frontend) cd client npm run dev
π οΈ Configuration
Environment Variables
All configuration is managed through environment variables. The following environment variables are available:
Server Configuration
NODE_ENV: Application environment (development,production,test)PORT: Port to run the server on (default:3000)HOST: Host to bind the server to (default:0.0.0.0)
Security
JWT_SECRET: Secret key for JWT token signing (required)JWT_EXPIRES_IN: JWT token expiration time (default:1d)CORS_ORIGIN: Allowed CORS origins (default:*)RATE_LIMIT_WINDOW_MS: Rate limiting window in milliseconds (default:900000- 15 minutes)RATE_LIMIT_MAX: Maximum requests per window (default:100)
Database
DB_PATH: Path to SQLite database file (default:./data/mcp-db.sqlite)DB_LOGGING: Enable database query logging (default:false)
Logging
LOG_LEVEL: Logging level (error,warn,info,http,verbose,debug,silly)LOG_TO_FILE: Enable logging to file (default:false)LOG_FILE_PATH: Path to log file (default:logs/app.log)
API Documentation
API_DOCS_ENABLED: Enable API documentation (default:true)API_DOCS_PATH: Path to API documentation (default:/api-docs)
OAuth (Optional)
OAUTH_ENABLED: Enable OAuth authentication (default:false)OAUTH_ISSUER_URL: OAuth provider URLOAUTH_CLIENT_ID: OAuth client IDOAUTH_CLIENT_SECRET: OAuth client secretOAUTH_REDIRECT_URI: OAuth redirect URIOAUTH_SCOPE: OAuth scopes (default:openid profile email)
π Development
Running the Application
Development Mode
Production Build
Testing
π³ Docker Support
The application includes Docker support for easy deployment:
π¦ Production Deployment
For production deployment, consider the following:
Set
NODE_ENV=productionConfigure a reverse proxy (Nginx, Apache, etc.)
Set up HTTPS with a valid SSL certificate
Configure proper logging and monitoring
Set up a process manager (PM2, systemd, etc.)
π€ Contributing
Contributions are welcome! Please read our Contributing Guidelines for details.
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Support
For support, please open an issue in the GitHub repository. npm run dev
mcp-server/ βββ client/ # Frontend React application β βββ public/ # Static files β βββ src/ # React source code β βββ api/ # API client and RPC calls β βββ components/ # Reusable UI components β βββ pages/ # Page components βββ src/ # Backend source code β βββ config/ # Configuration files β βββ controllers/ # Request handlers β βββ core/ # Core application logic β βββ services/ # Business logic services βββ .env.example # Example environment variables βββ package.json # Backend dependencies and scripts
Frontend
Production Build
βοΈ Configuration
Backend Environment Variables
Create a .env file in the root directory with the following variables:
Frontend Configuration
The frontend is pre-configured to connect to the backend at http://localhost:3000. If you need to change this, modify the proxy settings in client/vite.config.final.ts.
π‘ API Reference
The API uses JSON-RPC 2.0 over HTTP. All endpoints are prefixed with /api.
Authentication
Login
POST /api/auth/loginAuthenticate with username and password.
Refresh Token
POST /api/auth/refreshGet a new access token using a refresh token.
RPC Endpoint
Example request:
π¦ Deployment
PM2 (Recommended for Production)
Docker
Base URL
All API endpoints are prefixed with /api/v1.
Authentication
Login
GET /auth/loginInitiates the OAuth 2.0 flow.
Callback
GET /auth/callbackOAuth callback URL (handled automatically).
Refresh Token
POST /auth/refreshRefresh an access token.
JSON-RPC 2.0 Endpoint
All RPC methods require a valid JWT token in the Authorization header:
Example Request
Example response:
π Authentication
The server uses OAuth 2.0 with OpenID Connect for authentication. The flow is as follows:
Client redirects to
/auth/loginUser authenticates with the OAuth provider
Provider redirects to
/auth/callbackwith an authorization codeServer exchanges the code for tokens
Client receives an access token and refresh token
Token Management
Access Token: Short-lived (default: 1h), used for API authentication
Refresh Token: Long-lived (default: 7d), used to obtain new access tokens
Protected Endpoints
All endpoints except the following require authentication:
GET /health- Health checkGET /auth/login- OAuth loginGET /auth/callback- OAuth callbackPOST /auth/refresh- Token refresh
π οΈ Available Methods
Authentication
auth.getUserInfo(accessToken: string)Get user information from the OAuth provider.
Weather
weather.getCurrent(params: { city?: string, lat?: number, lon?: number, units?: string, lang?: string })Get current weather for a location by city name or coordinates.
File System
file.read(params: { path: string, encoding?: string })Read a file from the sandbox directory.file.write(params: { path: string, content: string, encoding?: string, createDir?: boolean, append?: boolean })Write content to a file in the sandbox directory.
Database
database.query(params: { sql: string, params?: any[], readOnly?: boolean })Execute a SQL query against the database.{ "method": "database.query", "params": { "sql": "SELECT * FROM users WHERE id = ?", "params": ["user123"], "readOnly": true }, "id": 1 }database.transaction(queries: Array<{ sql: string, params?: any[] }>)Execute multiple SQL queries in a transaction.{ "method": "database.transaction", "params": { "queries": [ {"sql": "INSERT INTO users (id, email) VALUES (?, ?)", "params": ["user123", "test@example.com"]}, {"sql": "INSERT INTO user_profiles (user_id, name) VALUES (?, ?)", "params": ["user123", "Test User"]} ] }, "id": 2 }
User Management
user.getProfile()Get the current user's profile.user.updateProfile(params: { email?: string, name?: string })Update the current user's profile.user.changePassword(params: { currentPassword: string, newPassword: string })Change the user's password.
System
system.getStatus()Get system status and health information.system.getMetrics()Get system metrics (CPU, memory, etc.).
π§ͺ Testing
Running Tests
Test Coverage
We aim to maintain high test coverage. Current coverage:
Unit Tests: ~90%
Integration Tests: ~80%
E2E Tests: ~70%
Linting
π Deployment
Docker (Recommended)
PM2 (Production)
Kubernetes
Example deployment:
π Documentation
π€ Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/AmazingFeature)Commit your changes (
git commit -m 'Add some AmazingFeature')Push to the branch (
git push origin feature/AmazingFeature)Open a Pull Request