MCP server/database

DB MCP (HR CSV to SQLite) MCP Server

Imports HR CSV data into an in-memory SQLite database for structured querying.

daviddata-cloud/MCP_DOC ↗by daviddata-cloudupdated
Manual setup required. The maintainer's config contains paths only you know - edit the placeholders below before adding it to Claude Code.
1

Prepare the server locally

Run this once before adding it to Claude Code.

git clone https://github.com/daviddata-cloud/MCP_DOC
cd MCP_DOC

Then follow the repository README for any remaining dependency or build steps.

2

Register it in Claude Code

claude mcp add db-mcp-fd9d -- python /path/to/db_mcp_server.py

Replace any placeholder paths in the command with the real path on your machine.

3

Make your agent remember this setup

db-mcp-fd9d's config, env vars, and the gotchas you hit — recalled in every future Claude Code, Cursor, and Codex session.

npx conare@latest

Free · one command · indexes the sessions already on disk. Set up in the browser instead →

What it does

  • Loads HR CSV files into an in-memory SQLite database
  • Parses 3-line metadata headers from CSV files
  • Exposes read-only SQL query capabilities via MCP
  • Provides structured search tools for employee records
  • Uses standard-library Python for lightweight deployment

Tools 4

hr_metadataReturns the 3-line metadata header from the CSV as a JSON object.
hr_schemaReturns the SQLite schema for the employees table.
hr_queryExecutes read-only SELECT or WITH SQL queries against the HR data.
hr_find_peoplePerforms a structured search for employee records without writing SQL.

Environment Variables

HR_CSV_PATHPath to the HR CSV file to be imported into the SQLite database.

Try it

What is the metadata associated with the current HR dataset?
Show me the database schema for the employee records.
Find all employees with the last name 'Smith' using the search tool.
Run a SQL query to count how many employees are in the database.
List the first 5 employees from the database using a SELECT query.
Original README from daviddata-cloud/MCP_DOC

DB MCP (HR CSV → SQLite) — Open Source Reference

This folder contains a fully open-source Model Context Protocol (MCP) server implementation that:

  • Loads an HR “people” CSV file
  • Reads 3 lines of metadata at the top of the CSV (comment lines starting with #)
  • Imports the CSV into an in-memory SQLite database
  • Exposes read-only MCP tools over stdio (newline-delimited JSON-RPC 2.0)

No Claude Desktop setup is required. A small Python client is included for testing.

Files

  • db_mcp_server.py — MCP server (stdio)
  • db_mcp_client.py — simple MCP stdio client for testing
  • data/hr_people.csv — sample HR CSV with 3-line metadata header

Run the server

python db_mcp_server.py

Optionally pass a custom CSV path:

python db_mcp_server.py /path/to/your/hr_people.csv

Or set an environment variable:

HR_CSV_PATH=/path/to/your/hr_people.csv python db_mcp_server.py

Test with the included client (recommended)

python db_mcp_client.py

You should see:

  • initialize handshake
  • tools/list
  • a sample SQL query result
  • an interactive prompt to run more SELECT queries

Tools exposed

  • hr_metadata — returns the 3-line metadata header as a JSON object
  • hr_schema — returns the SQLite schema for table employees
  • hr_query — execute read-only SELECT/WITH SQL queries
  • hr_find_people — structured search without writing SQL

CSV metadata format (first 3 lines)

Example:

# dataset: HR People
# description: Synthetic employee roster for MCP demo (no real PII)
# primary_key: employee_id
employee_id,first_name,last_name,...

Metadata lines are parsed as key: value. If a line is not key: value, it is stored as meta_line_1, meta_line_2, etc.

Notes for sharing

  • Everything here is standard-library Python (SQLite + CSV).
  • The demo data is synthetic (no real PII).
  • The server writes only JSON-RPC to stdout. Logs go to stderr (safe for stdio MCP).

##How to run

Server (auto-builds index if missing)

python mcp_server.py

Test client

python client.py (interactive mode)

python client.py --search "diabetes treatment" --top-k 5

#add more documentation files:

Drop .txt or .md files into ./docs/

Rebuild:

python build_doc_index.py --docs_dir ./docs --out_map ./doc_map.json --out_db ./doc_i

#run sample

--terminal 1
 C:\Users\davidzhang\Downloads\ml\ml\doc_mcp_1>python mcp_server.py
[doc_mcp_server] Loaded 1 docs. FTS5=yes
[doc_mcp_server] Ready.

--terminal 2
 C:\Users\davidzhang\Downloads\ml\ml\doc_mcp_1>python client.py --search "diabetes treatment" --top-k 5
[doc_mcp_server] Loaded 1 docs. FTS5=yes
[doc_mcp_server] Ready.
{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{
  \"query\": \"diabetes treatment\",
  \"top_k\": 5,
  \"matches\": [
    {
      \"doc_id\": \"cdc-diabetes-treatment-guidelines\",
      \"title\": \"CDC DIABETES COMPLICATION RISK MANAGEMENT GUIDELINES\",
      \"chunk_id\": 3,
      \"score\": 3.3014800093648174e-06,
      \"snippet\": \"…Type 2 [diabetes] with circulatory complications\
- I50.9: Heart failure (if present)\
\
### 3.2 Aggressive [Treatment]…\",
      \"text\": \"itoring (CGM)\
- Kidney function testing: Every 6 months\
- Eye examination: Every 6-12 months\
\
### 2.5 Enhanced Interventions\
- Referral to certified diabetes care and education specialist\
- Quarterly nutritionist consultations\
- Structured exercise program\
- Cardiovascular risk assessment\
- Sleep apnea screening if indicated\
- Depression and diabetes distress screening\
\
### 2.6 Complication Screening\
Biannual assessments:\
- Comprehensive foot examination\
- Monofilament testing for neuropathy\
- Ankle-brachial index if claudication symptoms\
- Retinal photography or dilated eye exam\
\
---\
\
## Section 3: HIGH RISK PATIENTS (60-80% Complication Probability)\
\
### 3.1 ICD-10-CM Coding\
Primary codes:\
- E11.65: Type 2 diabetes with hyperglycemia\
- E11.69: Type 2 diabetes with other specified complication\
- E11.8: Type 2 diabetes with unspecified complications\
\
Complication-specific codes as identified:\
- E11.21: Type 2 diabetes with diabetic nephropathy\
- E11.311-319: Type 2 diabetes with diabetic retinopathy\
- E11.40-49: Type 2 diabetes with diabetic neuropathy\
- E11.51-59: Type 2 diabetes with circulatory complications\
- I50.9: Heart failure (if present)\
\
### 3.2 Aggressive Treatment Goals\"
    },
    {
      \"doc_id\": \"cdc-diabetes-treatment-guidelines\",
      \"title\": \"CDC DIABETES COMPLICATION RISK MANAGEMENT GUIDELINES\",
      \"chunk_id\": 15,
      \"score\": 3.258944413339537e-06,
      \"snippet\": \"ational [Diabetes] Statistics Report (2023)\
- Endocrine Society Clinical Practice Guidelines\
- AACE/ACE Comprehensive Type 2 [Diabetes]…\",
      \"text\": \"ational Diabetes Statistics Report (2023)\
- Endocri

Frequently Asked Questions

What are the key features of DB MCP (HR CSV to SQLite)?

Loads HR CSV files into an in-memory SQLite database. Parses 3-line metadata headers from CSV files. Exposes read-only SQL query capabilities via MCP. Provides structured search tools for employee records. Uses standard-library Python for lightweight deployment.

What can I use DB MCP (HR CSV to SQLite) for?

Querying synthetic HR rosters for data analysis tasks. Integrating CSV-based employee data into LLM workflows. Performing structured lookups on HR datasets without manual file parsing. Testing SQL-based data retrieval patterns within an MCP environment.

How do I install DB MCP (HR CSV to SQLite)?

Install DB MCP (HR CSV to SQLite) by running: python db_mcp_server.py

What MCP clients work with DB MCP (HR CSV to SQLite)?

DB MCP (HR CSV to SQLite) works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Conare · memory for coding agents

Turn this server into reusable context

Keep DB MCP (HR CSV to SQLite) docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Set up free$npx conare@latest