MCP Python Server
Provides MCP tools for CRUD operations and search on a local SQLite database with tables for users, products, and orders.
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 Python Serverlist all products"
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 Server & Database Integration using Python
A Python-based Model Context Protocol (MCP) server built using FastMCP that exposes database operations as MCP tools. The project integrates a local SQLite database and demonstrates how AI clients such as Claude Desktop and a custom Python client can interact with backend services through MCP.
๐ Project Overview
This project was developed as part of my internship to understand and implement the Model Context Protocol (MCP).
The server exposes database operations through MCP tools, allowing AI applications and clients to interact with a structured SQLite database.
The project demonstrates:
Building an MCP server using FastMCP
Integrating a SQLite database with multiple tables
Exposing database operations as MCP tools
Connecting through a Python client
Integrating with Claude Desktop
Automated testing using pytest
Related MCP server: Gestao-MCP
โจ Features
โ Python-based MCP Server using FastMCP
โ SQLite Database Integration
โ Users, Products and Orders Database
โ CRUD Operations
โ Search Functionality
โ Parameterized SQL Queries
โ Structured JSON Responses
โ Logging
โ Python MCP Client
โ Claude Desktop Integration
โ Automated Testing using pytest
๐ Tech Stack
Technology | Purpose |
Python 3.13 | Programming Language |
FastMCP | MCP Server Framework |
SQLite | Local Database |
pytest | Automated Testing |
Claude Desktop | MCP Client |
MCP Inspector | Tool Testing |
VS Code | Development Environment |
๐ System Architecture
Claude Desktop
โ
โ
(MCP Tool Calls)
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ FastMCP Server โ
โ server.py โ
โโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โผ โผ
MCP Tools Logging
โ
โผ
Database Layer
db.py
โ
โผ
SQLite Database
(Users โข Products โข Orders)๐ Project Structure
mcp-python-server/
โ
โโโ client.py # Python MCP client
โโโ server.py # FastMCP server exposing database tools
โโโ db.py # Database access layer
โโโ seed.py # Creates and seeds the SQLite database
โโโ requirements.txt
โโโ pytest.ini
โโโ README.md
โ
โโโ tests/
โ โโโ test_db.py # Database tests
โ โโโ test_tools.py # MCP tool tests
โ
โโโ .gitignore๐ Database Schema
The project uses a SQLite database consisting of three tables.
Users
Column | Type |
id | INTEGER |
name | TEXT |
TEXT |
Products
Column | Type |
id | INTEGER |
name | TEXT |
category | TEXT |
price | REAL |
stock | INTEGER |
Orders
Column | Type |
id | INTEGER |
user_id | INTEGER |
product_id | INTEGER |
quantity | INTEGER |
order_date | TEXT |
๐ง MCP Tools
User Tools
Tool | Description |
get_all_users | Retrieve all users |
get_user | Retrieve a user by ID |
search_user | Search users by name |
add_user | Add a new user |
remove_user | Delete a user |
Product Tools
Tool | Description |
get_all_products | Retrieve all products |
get_product | Retrieve a product by ID |
search_product | Search products |
Order Tools
Tool | Description |
get_all_orders | Retrieve all orders |
๐ Installation & Setup
Clone the repository
git clone https://github.com/<your-username>/mcp-python-server.git
cd mcp-python-serverCreate a virtual environment
python -m venv venvActivate the environment
venv\Scripts\activateInstall dependencies
pip install -r requirements.txtGenerate the SQLite database
python seed.pyโถ Running the Project
Start the MCP Server
mcp dev server.pyRun the Python Client
python client.pyExecute Tests
pytestExpected Output
===========================
10 passed
===========================๐ธ Screenshots
MCP Inspector

Claude Desktop Integration

Python Client

Automated Testing

๐ค Claude Desktop Integration
The MCP server can be integrated with Claude Desktop using the MCP configuration file.
Once configured, Claude Desktop can directly invoke the available MCP tools.
Example prompts:
Show all users.
List all products.
Search for Laptop.
Show all orders.
Create a new user.
๐งช Testing
Automated testing was implemented using pytest.
The test suite validates:
Database operations
CRUD functionality
Search operations
Invalid user handling
Invalid product handling
MCP tool responses
Current Status
โ 10 Tests Passed
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/NikhilBansalv/MCP-Python-Server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server