Skip to main content
Glama
Business Data MCP Server

Business Data MCP Server

by giuperta

Business Data MCP Server

A read-only Model Context Protocol server that lets Claude (Claude Desktop, Claude Code or any MCP client) answer business questions on a company database in plain language, without ever being able to change data or see what it shouldn't.

"Which product category generated the most revenue in Germany last quarter?" Claude explores the schema, writes the SQL, the server checks it against the access policy, runs it read-only and logs the call.

Demo project built on a sample sales database (customers, products, orders). The same pattern applies to any SQL database (PostgreSQL, Oracle, SQL Server) by swapping the database layer.

Why it is safe

Security is enforced inside the database engine, not only by inspecting the SQL text:

Layer

What it does

Read-only connection

SQLite is opened with mode=ro: writes are impossible, whatever the query.

Engine-level authorizer

Only SELECT/READ operations are allowed, and only on tables in the policy. A hidden table (payroll) is denied even inside a sub-query.

Column masking

Personal data (customers.email, customers.phone) always comes back as NULL. The model sees the column exists but never its values.

Static SQL guard

Rejects multiple statements, PRAGMA, ATTACH, DDL/DML early, with a clear message for the model.

Resource limits

Hard cap on returned rows and an execution budget that stops runaway queries (e.g. infinite recursive CTEs).

Audit log

Every tool call (accepted or rejected, with SQL, row count and timing) is appended to a JSON Lines file.

The access policy is declarative (src/bizdata_mcp/policy.py):

DEFAULT_POLICY = AccessPolicy(
    allowed_tables=frozenset({"customers", "products", "orders", "order_items"}),
    masked_columns={"customers": frozenset({"email", "phone"})},
)

Related MCP server: Guarded Postgres MCP Server

Tools exposed to the model

Tool

Description

list_tables

Tables the assistant is allowed to query

describe_table

Columns, types, primary keys and which columns are masked

run_query

Runs one read-only SELECT and returns columns, rows and a truncated flag

All tools are annotated as readOnlyHint so clients can run them without extra confirmation prompts.

Architecture

Claude ──MCP (stdio)──▶ server.py ──▶ BusinessDataTools ──▶ ReadOnlyDatabase ──▶ SQLite (mode=ro)
                                            │                   ├─ sql_guard (static checks)
                                            │                   ├─ authorizer (policy, masking)
                                            ▼                   └─ progress handler (budget)
                                       audit.jsonl

Quick start

Requires Python 3.11+.

pip install -e ".[dev]"
bizdata-seed data/sales.db        # create the sample database
pytest                            # 29 tests

Use it from Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "business-data": {
      "command": "bizdata-mcp",
      "env": {
        "BIZDATA_DB": "/absolute/path/to/data/sales.db",
        "BIZDATA_AUDIT": "/absolute/path/to/logs/audit.jsonl"
      }
    }
  }
}

Use it from Claude Code

claude mcp add business-data --env BIZDATA_DB=$PWD/data/sales.db -- bizdata-mcp

Example audit log entry

{"ts": "2026-11-17T12:04:31+0100", "tool": "run_query", "outcome": "rejected",
 "sql": "SELECT * FROM payroll", "reason": "Query touches a table or operation outside the access policy."}

Tests

The suite covers the SQL guard, the engine-level policy (hidden tables, masked columns, sub-queries, row cap, runaway queries, write attempts that bypass the guard) and an end-to-end run through a real MCP client session.

Tech

Python 3.11+, MCP Python SDK 2.x, SQLite, pytest.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Claude Code to securely interact with PostgreSQL, MySQL, SQLite, and SQL Server databases, featuring read-only mode, query validation, SSH tunneling, and field redaction for production-safe data access.
      4
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables Claude to query and safely write to a Postgres database, driven entirely by one policy file with read-only access by default, column-precise PII masking, and an append-only audit log. SQL is parsed and validated before execution, writes use parameterized queries with dry-run/confirm and transactions, and every call is rate-limited and audited so destructive or exfiltrating requests are refused.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables Claude to answer questions from PostgreSQL databases using read-only SQL queries, with row caps, column masking, and an audit log while preventing data changes.
      3
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables Claude to answer business questions against a company's retail database — sales summaries, top customers, inventory alerts, customer profiles, and plain-English queries — through read-only SQL tools plus a schema resource and reporting prompt. Access is governed by OAuth 2.1 roles and scopes, column-level PII masking, a SQL guard, rate limits, and audit logging.
      5
      MIT