Customer MCP Server
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., "@Customer MCP ServerCan you get the purchase summary for customer 550e8400-e29b-41d4-a716-446655440000?"
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.
Customer MCP Server
Customer MCP Server is a project for connecting LLMs to customer data using the Model Context Protocol (MCP), allowing AI clients to access customer data securely and with clear governance boundaries.
System Overview
The system is designed so that the LLM can only query customer data through defined tools, without direct database access.
What's Supported
Retrieve basic customer profile information
Perform semantic search over customer interaction history using vector embeddings
Summarize purchase data and financial transactions with exact values
Record audit logs of transactions
Prevent prompt injection and unauthorized data access
Architecture
LLM Client
|
| MCP Protocol
v
MCP Server (Python)
|
+-------------------+
| |
v v
Semantic Search SQL / Financial
PostgreSQL + pgvector PostgreSQLKey Features
1. Customer Profile
Retrieve basic customer information such as customer_id, name, email, phone, created_at
2. Interaction Semantic Search
Search customer conversation/interaction history using embedding vectors
Suitable for semantic search of broad queries such as refund issue, complaint, billing concern
3. Financial Summary
Calculate order count and total purchase amount from the database
Use SQL aggregation to produce accurate and reliable values
Return an audit log of transactions with a hash reference
Hybrid Query Example
Example query:
"What issues has the customer reported, and what is their total purchase amount?"
Flow:
search_customer_interactions()
|
vpgvector similarity search
+get_customer_purchase_summary()
|
vSQL aggregation
|
vCombined verified response
Process:
MCP Server invokes semantic search from interaction_history using pgvector
MCP Server retrieves financial summary from purchase_orders using SQL aggregation
Combine the results:
Customer Context
Relevant Interaction
Exact Financial Amount
Return them to the LLM
4. Security Guardrails
Detects prompt injection patterns
Validates customer_id before accessing data
Restricts data access to MCP tools only
Technologies Used
Python 3.12+
FastMCP
asyncpg
pydantic
openai
google-genai
PostgreSQL 17 + pgvector
Docker Compose
Project Structure
customer-mcp/
├── app/
│ ├── config.py
│ ├── database.py
│ ├── embeddings.py
│ ├── mcp_server.py
│ ├── security.py
│ └── tools/
│ ├── customer.py
│ ├── financial.py
│ └── semantic_search.py
├── docs/
│ └── ARCHITECTURE.md
├── sql/
│ ├── 01_extensions.sql
│ ├── 02_schema.sql
│ ├── 03_indexes.sql
│ ├── 04_seed.sql
│ └── 05_security.sql
├── docker-compose.yml
├── requirements.txt
├── test_customer.py
├── test_embedding.py
├── test_financial.py
├── test_search.py
├── test_security.py
└── README.mdPrerequisites
Python 3.12 or newer
Docker Desktop
Network access to install packages from PyPI
Installation and Setup
1. Create a virtual environment
py -3.12 -m venv venvOn Windows:
venv\Scripts\activate2. Install dependencies
pip install -r requirements.txt3. Set up environment variables
Create a .env file with the following example:
DATABASE_URL=postgresql://mcp_readonly_user:CHANGE_ME@localhost:5432/customer_mcp
GEMINI_API_KEY=your_gemini_api_key_here4. Start PostgreSQL database
docker compose up -dDocker Compose will create a PostgreSQL + pgvector container and automatically initialize the database from the SQL scripts in the sql/ folder.
Note: SQL scripts in docker-entrypoint-initdb.d run only the first time a PostgreSQL volume is created.
To reinitialize everything from scratch:
docker compose down -v
docker compose up -d
Initialization order
sql/01_extensions.sql Enable PostgreSQL extensions Enable pgvector sql/02_schema.sql Create customer tables Create interaction history table Create purchase tables Create immutable audit structure sql/03_indexes.sql Create database indexes Create pgvector HNSW index for semantic search sql/04_seed.sql Insert demo customer data Insert interaction history Insert purchase records Insert audit records sql/05_security.sql Create read-only database user Grant SELECT permission
Verify the container
docker ps5. Run MCP Server
python -m app.mcp_serverMCP Inspector
You can also inspect MCP Tools through the UI.
mcp-inspector python -m app.mcp_serverAvailable MCP Tools
get_customer_profile
Retrieve customer profile information
Data source:
customers table
Returns:
customer_id
first_name
last_name
email
phone
created_at
Example input:
{
"customer_id": "550e8400-e29b-41d4-a716-446655440000"
}search_customer_interactions
Semantic search for interaction history using pgvector
Example input:
{
"customer_id": "550e8400-e29b-41d4-a716-446655440000",
"query": "refund issue",
"limit": 3
}get_customer_purchase_summary
Retrieve exact purchase totals using SQL aggregation
Example input:
{
"customer_id": "550e8400-e29b-41d4-a716-446655440000"
}Available MCP Tools
Tool | Purpose |
get_customer_profile | Retrieve customer profile information |
search_customer_interactions | Semantic search customer conversation history |
get_customer_purchase_summary | Retrieve exact financial summary and audit log |
Testing
You can run the following test files from the repository root:
python test_embedding.py
python test_search.py
python test_financial.py
python test_security.py
python test_customer.pySecurity Notes
LLM cannot access the database directly
Data access is allowed only through MCP Tools
Input validation is applied to customer_id
Detects prompt injection patterns
Financial data uses SQL aggregation to return exact values
Audit log is an immutable append-only structure
The database user for MCP has least-privilege permissions
UPDATE / DELETE / DDL operations are not allowed
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.
Related MCP Connectors
MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.
MCP server connecting AI agents to non-custodial staking data across 130+ networks.
Hosted MCP server for LLM cost estimation, model comparison, and budget-aware routing.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/Sukkamit/Customer-MCP-Server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server