home / mcp / hr csv mcp server
Provides read‑only MCP tools over stdio for an in‑memory SQLite HR dataset loaded from a CSV with 3‑line metadata header.
Configuration
View docs{
"mcpServers": {
"daviddata-cloud-mcp_doc": {
"command": "python",
"args": [
"db_mcp_server.py"
],
"env": {
"HR_CSV_PATH": " /path/to/your/hr_people.csv"
}
}
}
}You can run a lightweight MCP server that loads an HR CSV, imports it into an in‑memory SQLite database, and exposes read‑only MCP tools over stdio for querying and exploring the data. This guide shows you how to use the server, install prerequisites, and perform common tasks with the included test client and tools.
You run the server locally and connect with the accompanying MCP client. The server loads the HR CSV, reads the first three metadata lines, imports the data into an in‑memory SQLite database, and exposes read‑only MCP tools over standard input/output. Use the client to initialize the session, list available tools, run sample queries, and interactively perform SELECT queries on the HR dataset.
You can test basic functionality with the included test client. Start the server, then run the client to see an initialization handshake, list the exposed tools, and execute sample queries. The available tools include retrieving the metadata header, inspecting the database schema, executing read‑only queries, and performing structured searches against the HR dataset.
Prerequisites: You must have Python installed on your system. The server and client run with standard Python libraries and do not require additional dependencies.
1) Ensure Python is available on your PATH.
2) Run the MCP server using the included script. The server will use its default HR CSV path if you do not provide a custom path.
python db_mcp_server.py3) Optionally specify a custom HR CSV file path as an argument. The server will load that CSV file instead of the default sample.
python db_mcp_server.py /path/to/your/hr_people.csv4) You may also set the path via an environment variable before starting the server.
HR_CSV_PATH=/path/to/your/hr_people.csv python db_mcp_server.py5) Verify the server is ready. The server will start and await commands on stdio. You can test with the included client to ensure the features are available.
6) Run the test client to explore the MCP tools and perform example queries.
python db_mcp_client.pyThe MCP server exposes several read‑only tools to interact with the HR dataset. These include retrieving the 3‑line metadata header, inspecting the SQLite schema for the employees table, executing read‑only SQL queries, and performing structured searches without writing SQL.
The server writes only JSON‑RPC responses to stdout. Any diagnostic logs are sent to stderr, ensuring clean MCP output for downstream processing.
Returns the 3-line metadata header from the CSV as a JSON object.
Returns the SQLite schema for the employees table.
Executes read‑only SELECT and WITH SQL queries against the in‑memory SQLite database.
Performs structured searches without writing SQL.