Lexiguard HR
Provides tools for querying a local MySQL database (read-only SQL, schema listing) and retrieving table structure, enabling natural language database interactions.
Click on "Deploy 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., "@Lexiguard HRWho works in Engineering?"
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.
Lexiguard HR — Local MySQL MCP Server for Cursor
A small Model Context Protocol (MCP) demo that lets Cursor query a local MySQL HR database in natural language—without pasting credentials or schema into every chat.
Cursor (AI) ←── MCP (stdio) ──→ server.py ←── SQL ──→ MySQL (lexiguard)What it does
MCP tool | Description |
| Lists tables, columns, types, and keys so the AI knows what exists |
| Runs read-only SQL ( |
Example questions in Cursor chat:
“Use get_db_schema to show all tables.”
“Who works in Engineering?”
“List employees with their department names.”
“Average salary by department.”
Related MCP server: easy-mysql-mcp
Tech stack
Python 3.10+
MCP Python SDK (
mcp, FastMCP)Cursor with project MCP config (
.cursor/mcp.json)
Prerequisites
Quick start
1. Create database and sample data
In MySQL Workbench or the CLI:
CREATE DATABASE IF NOT EXISTS lexiguard;
USE lexiguard;
CREATE TABLE IF NOT EXISTS departments (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
location VARCHAR(100)
);
CREATE TABLE IF NOT EXISTS employees (
id INT AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
email VARCHAR(100) UNIQUE,
department_id INT,
hire_date DATE,
salary DECIMAL(10, 2),
FOREIGN KEY (department_id) REFERENCES departments(id)
);
INSERT INTO departments (name, location) VALUES
('Engineering', 'London'),
('HR', 'Manchester'),
('Finance', 'Birmingham');
INSERT INTO employees (first_name, last_name, email, department_id, hire_date, salary) VALUES
('Alice', 'Smith', 'alice.smith@lexiguard.com', 1, '2022-03-15', 65000.00),
('Bob', 'Jones', 'bob.jones@lexiguard.com', 1, '2021-07-01', 72000.00),
('Carol', 'Brown', 'carol.brown@lexiguard.com', 2, '2020-11-20', 48000.00),
('David', 'Taylor', 'david.taylor@lexiguard.com', 3, '2023-01-10', 55000.00);2. Install Python dependencies
Windows (PowerShell):
cd db-mcp-server
python -m venv .venv
.\.venv\Scripts\pip install -r requirements.txtmacOS / Linux:
cd db-mcp-server
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt3. Configure environment
cp .env.example .envEdit .env with your MySQL settings (especially MYSQL_PASSWORD if root has a password).
4. Connect Cursor
This repo includes project-level MCP config at .cursor/mcp.json.
Open this folder as a Cursor workspace.
Go to Cursor Settings → Models → MCP.
Enable
lexiguard-hr(should show 2 tools).Restart Cursor if the server does not appear.
macOS / Linux: Update .cursor/mcp.json so command points to your venv Python, for example:
"command": "${workspaceFolder}/.venv/bin/python"Windows (default in this repo):
"command": "${workspaceFolder}/.venv/Scripts/python.exe"Credentials are loaded from .env via envFile—do not commit .env (it is in .gitignore).
5. Try it
Open chat (Ctrl+L / Cmd+L), use Agent mode, and allow MCP tool runs when prompted.
Project layout
db-mcp-server/
├── .cursor/
│ └── mcp.json # Cursor MCP launch config
├── server.py # MCP server (FastMCP + MySQL)
├── requirements.txt
├── .env.example # Copy to .env locally
├── .gitignore
├── README.md # This file (demo / setup)
└── MCP-HOW-IT-WORKS.md # Short technical notes on MCPSecurity notes
Read-only queries only in
query_hr_db(noINSERT/UPDATE/DELETE).Keep
.envlocal; use.env.exampleas a template for collaborators.Intended for local development demos, not production exposure of a database.
Troubleshooting
Issue | What to check |
MCP server red / disconnected | MySQL running; |
“Connection refused” | Start MySQL service; confirm |
Tools not listed | Reopen project folder; toggle MCP server; restart Cursor |
GitKraken MCP error | Unrelated third-party config in global |
Learn more
See MCP-HOW-IT-WORKS.md for a concise technical explanation of MCP and how this repo implements it.
License
Use and adapt freely for learning and demos.
This server cannot be deployed
Maintenance
Related MCP Connectors
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Ask data questions in natural language. Get SQL, insights, and charts from your databases.
Related MCP Servers
- FlicenseAqualityDmaintenanceA tool that provides simple API to execute SQL queries and manage MySQL databases, designed to integrate with Cursor IDE for AI assistants to directly perform database operations.82-
- AlicenseAqualityCmaintenanceEnables AI assistants to inspect and query a MySQL database through safe, structured tools, including schema discovery and read-only queries.9214 npmMIT
- AlicenseAqualityDmaintenanceEnables read-only MySQL database connectivity, allowing execution of SELECT queries, listing tables, and describing table structures via natural language.312 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables Cursor AI to interact with MySQL databases through natural language, supporting SQL queries, table schema retrieval, and data operations.371 npm17MIT