This project implements a complete MCP (Model Context Protocol) server using Express and SQLite, with generic CRUD operations for any table and custom SQL queries.
- Connect to any SQLite database configurable at startup
- Generic CRUD operations for any table
- Custom SQL query execution (SELECT, INSERT, UPDATE, DELETE)
- Database schema inspection
- Pagination and filtering in queries
- Robust error handling
# Via environment variable
SQLITE_DB_PATH=/path/to/database.sqlite npm start
# Via command line argument
npm start -- --db=/path/to/database.sqlite
npm install
— Install dependenciesnpm start
— Run server in development modenpm run build
— Compile TypeScript project
GET /schema
— Get complete database schemaPOST /query
— Execute any custom SQL queryGET /table/:tableName
— List table records (with pagination)POST /table/:tableName
— Create a new recordPUT /table/:tableName/:id
— Update a record by IDDELETE /table/:tableName/:id
— Delete a record by ID
GET /items
— List all itemsPOST /items
— Create a new itemPUT /items/:id
— Update an itemDELETE /items/:id
— Delete an item
POST /query
{
"sql": "SELECT * FROM users WHERE age > ?",
"params": [18]
}
GET /table/users?limit=10&offset=0&where=age > 18&orderBy=name ASC
POST /table/products
{
"name": "Laptop",
"price": 999.99,
"category": "Electronics"
}
- Node.js >= 18