MCP Database Assistant
Provides tools for reading and writing to a SQLite database, including sales analytics, inventory management, customer management, and order processing.
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 Database AssistantShow me the current inventory levels for 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-Database-Assistant
The goal of this project is to build a simple realistic Database AI assistant following Model-Context-Protocol (MCP) standard that can understand natural-language questions using LLM like Ollama, communicates with database tools through an MCP client-server architecture, selects the correct database operation, and performs safe read/write actions on an external SQLite database.
Project Structure:
mcp_db_assistant/
├── streamlit_app.py # Simple browser UI for dropdown/custom questions, write approval, and final answer
├── host_app.py # Host app: Ollama LLM + MCP client orchestration
├── mcp_server.py # MCP server: exposes read/write DB tools
├── init_db.py # Creates and resets SQLite database
├── retail.db # Sample SQLite database
├── requirements.txt
├── .envTech stack used: Python, Ollama, qwen2.5:7b, MCP SDK, FastMCP, SQL, Streamlit
Related MCP server: MCP SQLite Server
Workflow:
User asks a natural-language question
↓
Host discovers relevant MCP tools from the MCP server
↓
Host sends question + MCP tool schemas to Ollama qwen2.5:7b
↓
Ollama LLM decides which exposed tool to call and what arguments to pass
↓
Host executes the respective registered tool through MCP Client SDK
↓
MCP Client talks to MCP Server using MCP JSON-RPC over stdio
↓
MCP Server reads/writes SQLite database
↓
Executed tool result goes back to Host
↓
Host sends result back to Ollama
↓
Ollama explains the result to the end userImportant communication distinction
Host ↔ Ollama LLM
Uses Ollama Python SDK / Ollama API
Host ↔ MCP Client SDK
Uses normal Python method calls, such as session.call_tool(...)
MCP Client ↔ MCP Server
Uses MCP protocol, JSON-RPC over stdio
MCP Server ↔ SQLite Database
Uses normal python, sqlite3 database codeTools registered in the MCP server
The MCP server has below registered tools which are the controlled database operations.
For reading operations:
list_tables
describe_table
get_sales_summary
get_revenue_by_region
get_sales_by_channel
get_daily_sales_trend
check_inventory
get_product_details
search_products
get_low_stock_products
get_supplier_reorder_report
get_top_products_by_revenue
get_customer_profile
get_customer_orders
get_order_details
get_segment_performance
run_readonly_sql
For writing operations: The Host asks for human confirmation before executing write tools.
create_customer
update_customer_segment
create_product
update_product_price
update_reorder_level
restock_inventory
adjust_inventory
create_sales_order
cancel_order
For tracking/auditing operations:
get_inventory_movements
get_audit_log
Handling Out-of-scope questions
Out-of-context handling is mainly done through the Host’s system prompt. If a custom question is not related to this retail database assistant, the LLM should not call MCP tools for unrelated topics. It should answer with a short message explaining that the demo only supports retail database operations and analytics, such as customers, products, inventory, sales/orders, suppliers, and audit logs.
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/SreeHarsha72/MCP-Database-Assistant'
If you have feedback or need assistance with the MCP directory API, please join our Discord server