
DB & Calculator MCP Server
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.
README
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:
npm install
- The database will be automatically created when you first run the server.
Usage
Starting the Server
npm start
Or for development with auto-restart:
npm run dev
Database Schema
The server creates a SQLite database with the following schema:
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
email TEXT UNIQUE NOT NULL,
age INTEGER,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
Sample data is automatically inserted when the database is first created.
Tool Examples
Database Operations
- Get all users:
{
"name": "get_all_users",
"arguments": {}
}
- Get user by ID:
{
"name": "get_user_by_id",
"arguments": {
"id": 1
}
}
- Add a new user:
{
"name": "add_user",
"arguments": {
"name": "John Doe",
"email": "john@example.com",
"age": 30
}
}
- Execute custom query:
{
"name": "query_database",
"arguments": {
"query": "SELECT * FROM users WHERE age > 25"
}
}
Calculator Operations
- Basic calculation:
{
"name": "calculate",
"arguments": {
"operation": "add",
"numbers": [5, 3]
}
}
- Evaluate expression:
{
"name": "calculate_expression",
"arguments": {
"expression": "2 + 3 * 4"
}
}
- Statistical analysis:
{
"name": "calculate_stats",
"arguments": {
"numbers": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
}
}
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
├── package.json
├── README.md
├── src/
│ ├── server.js # Main MCP server
│ ├── database.js # Database operations
│ └── calculator.js # Calculator operations
└── data/
└── example.db # SQLite database (created automatically)
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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.