MCP server: a safe database tool for any MCP client

Open
#31 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
22/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python, sqlite

Research direction

Start in src/sqlguardllm/cli.py to see how the new mcp subcommand hooks in, then read the Guard.enforce() API that the query tool must call. Build the stdio server in src/sqlguardllm/mcp_server.py with the four tools, and add an in-process SQLite test in tests/test_mcp.py. Done means the tests pass with violations returned as tool errors and rows capped at max_rows. Blocked on #12, #27 and #28.

Written by the indexing model from the issue text.

Description

area:integrations area:security size:l type:feature
Goal

Give Claude Desktop, Cursor, VS Code and agents a database tool that can't write, can't see hidden data and can't escape row filters (docs/DESIGN.md#mcp-server).

Acceptance criteria
  • sqlguardllm mcp --policy FILE --db URL [--context JSON] [--role NAME] starts an MCP server over stdio, in the optional extra sqlguardllm[mcp]
  • Tools list_tables, describe_table, explain_query and query; query runs the SQL returned by Guard.enforce() in a read-only transaction with a timeout and returns at most max_rows rows as JSON
  • Violations come back as tool errors with their messages so the model can repair its query
  • End-to-end test with an in-process MCP client against SQLite
Relevant files
  • src/sqlguardllm/mcp_server.py
  • src/sqlguardllm/cli.py
  • tests/test_mcp.py
  • pyproject.toml
Size

L (3-5 days)

Notes
Dominant language
Python
Stars
0
Forks
0
Avg merge
1m
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jmmana/sqlguardllm

All issues in jmmana/sqlguardllm

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.