Included as a web framework dependency for potential future HTTP transport capabilities in the MCP server.
Used as the runtime environment for the MCP server with SDK support via @modelcontextprotocol/sdk.
Used for package management and script execution for installing dependencies and starting the server.
Provides database integration allowing for SQL query execution, user management operations (create, read, update, delete), and custom database interactions.
MCP Example Server
This is a Model Context Protocol (MCP) server that provides two main categories of tools:
- Database Tools - For interacting with a SQLite database
- Calculator Tools - For performing mathematical calculations
Features
Database Tools
query_database
- Execute custom SQL queriesget_all_users
- Retrieve all users with optional limitget_user_by_id
- Get a specific user by IDadd_user
- Add a new user to the databaseupdate_user
- Update an existing userdelete_user
- Delete a user from the database
Calculator Tools
calculate
- Perform basic mathematical operations (add, subtract, multiply, divide, power, sqrt, sin, cos, tan, log, abs, round, floor, ceil)calculate_expression
- Evaluate mathematical expressionscalculate_stats
- Calculate statistical measures (mean, median, variance, standard deviation, etc.)
Installation
- Install dependencies:
- The database will be automatically created when you first run the server.
Usage
Starting the Server
Or for development with auto-restart:
Database Schema
The server creates a SQLite database with the following schema:
Sample data is automatically inserted when the database is first created.
Tool Examples
Database Operations
- Get all users:
- Get user by ID:
- Add a new user:
- Execute custom query:
Calculator Operations
- Basic calculation:
- Evaluate expression:
- Statistical analysis:
Available Calculator Operations
add
- Additionsubtract
- Subtractionmultiply
- Multiplicationdivide
- Division (with zero check)power
- Exponentiationsqrt
- Square rootsin
- Sine functioncos
- Cosine functiontan
- Tangent functionlog
- Natural logarithmabs
- Absolute valueround
- Round to nearest integerfloor
- Floor functionceil
- Ceiling function
Project Structure
Error Handling
The server includes comprehensive error handling for:
- Invalid SQL queries
- Database connection issues
- Mathematical operation errors (division by zero, invalid inputs)
- Missing required parameters
- Unknown tool names
Development
To modify or extend the server:
- Add new tools in the
setupTools()
method inserver.js
- Implement corresponding handler methods
- Update the tools list in the
tools/list
handler - Add any necessary database operations in
database.js
- Add calculator functions in
calculator.js
Dependencies
@modelcontextprotocol/sdk
- MCP SDK for Node.jssqlite3
- SQLite database driverexpress
- Web framework (for potential future HTTP transport)
License
MIT
This server cannot be installed
A Model Context Protocol server providing tools for SQLite database operations (query, add, update, delete users) and mathematical calculations including basic arithmetic, expression evaluation, and statistical analysis.
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server that provides database interaction capabilities through SQLite, enabling users to run SQL queries, analyze business data, and automatically generate business insight memos.Last updated -69TypeScriptMIT License
- -security-license-qualityA Model Context Protocol server that provides tools for connecting to and interacting with various database systems (SQLite, PostgreSQL, MySQL/MariaDB, SQL Server) through a unified interface.Last updated -Python
- -securityFlicense-qualityA Model Context Protocol server that enables SQL operations (SELECT, INSERT, UPDATE, DELETE) and table management through a standardized interface with SQLite databases.Last updated -JavaScript
- -securityAlicense-qualityA Model Context Protocol server that allows users to store, retrieve, update, and delete memories using SQLite storage.Last updated -PythonMIT License