π« Customer Support MCP Server
π€ AI-Powered Customer Support MCP Server
Connect Cursor AI to a real SQLite database through Model Context Protocol (MCP).
π Project Overview
The Customer Support MCP Server is a Python-based MCP server that allows an AI application such as Cursor to interact with a real SQLite database.
Instead of allowing the AI to directly execute SQL queries, the server exposes safe and well-defined business tools for customer support operations.
π― Main Goal
Demonstrate how an AI application can use MCP (Model Context Protocol) to:
- π« Create customer support tickets
- π Retrieve existing tickets
- π Search tickets
- βοΈ Update ticket information
- πΎ Store ticket data in SQLite
- π€ Allow Cursor AI to perform operations using natural language
ποΈ Architecture
π€ USER
β
β Natural Language
βΌ
βββββββββββββββββ
β Cursor β
β AI Agent β
βββββββββ¬ββββββββ
β
β MCP
βΌ
ββββββββββββββββββββββββββ
β Customer Support MCP β
β Server β
ββββββββββββββββββββββββββ€
β π« create_ticket β
β π get_ticket β
β π search_tickets β
β βοΈ update_ticket β
ββββββββββββββ¬ββββββββββββ
β
β SQL
βΌ
βββββββββββββββββββ
β SQLite β
β support.db β
βββββββββββββββββββ
===================
π Features
Feature Description
π« Create Ticket Create a new customer support ticket
π Get Ticket Retrieve a ticket using its ID
π Search Tickets Search using keyword, email, status, or priority
βοΈ Update Ticket Update status, priority, or description
πΎ SQLite Persistent local database
π€ Cursor AI client for interacting with MCP
π§ͺ MCP Inspector Test and debug MCP tools
β‘ uv Fast Python package/environment management
=======================
π§° Technology Stack
Technology Purpose
π Python 3.12 Application development
π MCP AI β Tool communication
ποΈ SQLite Database
π€ Cursor AI/MCP client
β‘ uv Python environment & dependency management
π§ͺ MCP Inspector MCP server testing
=====================
π Project Structure
customer_support_mcp/
β
βββ π .cursor/
β βββ π mcp.json
β
βββ π data/
β βββ ποΈ support.db
β
βββ π .venv/
β
βββ π database.py
βββ π server.py
βββ π pyproject.toml
βββ π uv.lock
βββ π README.md
βββ π .gitignore
==================
ποΈ Database Schema
The SQLite database contains a tickets table.
βββββββββββββββββββββββββββββββββββββββββββ
β tickets β
βββββββββββββββββββββββββββββββββββββββββββ€
β id INTEGER PRIMARY KEY β
β customer_name TEXT β
β customer_email TEXT β
β subject TEXT β
β description TEXT β
β status TEXT β
β priority TEXT β
β created_at TIMESTAMP β
β updated_at TIMESTAMP β
βββββββββββββββββββββββββββββββββββββββββββ
============
π§ͺ Test Using MCP Inspector
The MCP Inspector allows you to test the tools before connecting Cursor.
Run:
uv run mcp dev server.py
Open the Inspector URL displayed in the terminal.
You should see:
Customer Support MCP Server
Tools
β create_ticket
β get_ticket
β search_tickets
β update_ticket
=======================
π§βπ» Connect MCP Server to Cursor
Create:
.cursor/mcp.json
=======================
π Restart Cursor
After saving .cursor/mcp.json:
Cursor
β
Restart Cursor
β
Open customer_support_mcp
β
Settings
β
Tools & MCP
-------------
You should see:
π’ customer-support
Tools:
β create_ticket
β get_ticket
β search_tickets
β update_ticket
===============
π€ Using Cursor AI
Once the MCP server is connected, you can use natural language.
π« Create Ticket
Ask Cursor:
Create a ticket for John Smith.
Email:
[email protected]
Issue:
Customer cannot login.
Priority:
high
Cursor can call:
create_ticket()
π Retrieve Ticket
Ask:
Show me ticket number 1.
Cursor can call:
get_ticket(ticket_id=1)
π Search Tickets
Ask:
Find all open urgent tickets.
Cursor can call:
search_tickets(
status="open",
priority="urgent"
)
βοΈ Update Ticket
Ask:
Change ticket 1 to resolved.
Cursor can call:
update_ticket(
ticket_id=1,
status="resolved"
)
===================
π₯ Example Workflow
π€ User
β
β "Create a ticket for John"
βΌ
π€ Cursor AI
β
β MCP Tool Call
βΌ
π create_ticket()
β
β SQL INSERT
βΌ
ποΈ SQLite
β
β Ticket #1
βΌ
π MCP Server
β
βΌ
π€ Cursor
β
βΌ
π€ User
==================
π Example or Sample database of Tickets Output
After creating tickets, the database might contain:
ββββββ¬βββββββββββββββ¬ββββββββββββββββββββββ¬βββββββββββββββ¬βββββββββββ
β ID β Customer β Subject β Status β Priority β
ββββββΌβββββββββββββββΌββββββββββββββββββββββΌβββββββββββββββΌβββββββββββ€
β 1 β John Smith β Unable to login β open β high β
β 2 β Sarah Jones β Payment failed β open β urgent β
β 3 β Mike Brown β Password reset β resolved β medium β
ββββββ΄βββββββββββββββ΄ββββββββββββββββββββββ΄βββββββββββββββ΄βββββββββββ
=================
π§ MCP Concept
The most important concept in this project is:
AI APPLICATION
β
βΌ
βββββββββββββ
β MCP β
βββββββ¬ββββββ
β
βΌ
BUSINESS TOOLS
β
ββββββββββΌβββββββββ
βΌ βΌ βΌ
CREATE SEARCH UPDATE
β β β
ββββββββββΌβββββββββ
βΌ
DATABASE
The AI does not directly manipulate the SQLite database.
---------
Instead:
AI
β
MCP Tool
β
Python Function
β
SQLite
β
Result
β
AI
===============
β
MCP Business Tools
AI
β
MCP Tool
β
Validated Python Function
β
SQLite
===============
π Verify SQLite Database
The database will be created here:
data/support.db
You can verify the database using Python:
sqlite3 "C:\Users\your name\path\folder name\data\support.db"
============
π Learning Outcomes
After completing this project, you will understand:
π MCP
Model Context Protocol
β
MCP Server
β
MCP Tools
β
MCP Client
---
ποΈ Database Integration
Python
β
sqlite3
β
SQLite
---
π€ AI Integration
Cursor AI
β
MCP
β
Python Tools
β
SQLite
---
πΌ Business Operations
CREATE
β
READ
β
SEARCH
β
UPDATE
============
π Project Summary
Component Technology
π€ AI Client Cursor
π Protocol MCP
π Backend Python
ποΈ Database SQLite
β‘ Environment uv
π§ͺ Testing MCP Inspector
π« Business Domain Customer Support
=============
π Final Architecture
ββββββββββββββββββββββ
β CURSOR β
β π€ AI AGENT β
βββββββββββ€βββββββββββ
β
β MCP
βΌ
ββββββββββββββββββββββββ
β CUSTOMER SUPPORT MCP β
β SERVER β
β βββββββββββββββββββββββ£
β π« create_ticket β
β π get_ticket β
β π search_tickets β
β βοΈ update_ticket β
ββββββββββββ€ββββββββββββ
β
β SQL
βΌ
ββββββββββββββββββββββββ
β SQLite β
β support.db β
ββββββββββββββββββββββββ
==============
π Complete Command Flow
# 1. Go to project
cd C:\Users\path
# 2. Create environment
uv venv --python 3.12
# 3. Activate environment
.venv\Scripts\Activate.ps1
# 4. Install MCP
uv add "mcp[cli]"
# 5. Verify SQLite
uv run python -c "import sqlite3; print('SQLite OK')"
# 6. Verify MCP
uv run python -c "from mcp.server.fastmcp import FastMCP; print('MCP OK')"
# 7. Run MCP Inspector
uv run mcp dev server.py
# 8. Run MCP server directly
uv run python server.py
==============
β€οΈ Final Message
<div align="center">
π« Customer Support MCP Server
Python π + MCP π + SQLite ποΈ + Cursor π€
AI + MCP + Database = Intelligent Business Operations