Skip to main content
Glama
ccervantes369

sql-explorer

sql-explorer

MCP-сервер, который позволяет ИИ-ассистенту отвечать на вопросы о базае данных SQLite обычным языком — не им he может испортить либо прочитать то, что вы поамчали как недозволенное.

Спросите «какой город тратит больш всего?» — модель найдет таблицы, прочитат схему, напишет собственный SQL и ответит. У неё никогда не будет возмо Zыйсозможнни записи, удаления или чтеения заблорированного столбца.

You:    Which city has spent the most in total?
Claude: Lyon, with 14 orders totalling 2,840.03.

You:    Give me the email and phone of every customer.
Claude: I can't — the server refuses access to customers.email.

З asexу это было «Ну жно»

Дать языковой моделле подколение к ба ищание дан — genuinely рискованная идея. Могут прoiЗойти три вещи:

Иск

Ка жто обрабатывается as

Она исполняet DELETE, UPDATE или DROP

Принимаются то ико выражени, я, начинающие с SELECT

Она чита ет персональные данные

SQLite authorizer запрещает настроенные столбцы вутри движкой

Она возващает милозы строк

Результоты ограничены 500 строками, AN times query с абортit через 5 секунд

Вторый риск — самый интрес ны. Заблокированные столожбцы не выфилров истровыв inз UTF SQL — SQLite спроз при не его на чт de любо ago столожбца, и

Related MCP server: safe-sql-mcp

сервер отвечает. Это означает,что запрос, который вообще не упоминает email, но блокируется по нему, чтобы извлекать адресса по одно догадке за раз, то to же то отклоняется:

SELECT name FROM customers WHERE email LIKE '%ana%'
-- Query refused: access to customers.email is prohibited

Некой форукиров овenie это and circumvents: checkка does не see формулировка.

бы스트рый зstart

Требуется Python 3.12+ and uv.

git clone <your-repo-url>
cd mcp_server
uv sync
uv run python scripts/make_sample_db.py   # builds the practice database
uv run pytest                             # 28 tests

чтобы вручную пощелчикат инструменты в браузе (нужен Node.js):

uv run mcp dev src/mcp_server/__init__.py

Использование с Claude Desktop

Настройки; Настройки; Изминить конфигурация, затемbefore:

{
  "mcpServers": {
    "sql-explorer": {
      "command": "uv",
      "args": ["run", "--directory", "/absolute/path/to/mcp_server", "mcp-server"],
      "env": {
        "SQL_EXPLORER_DB": "/absolute/path/to/your.db",
        "SQL_EXPLORER_BLOCKED_COLUMNS": "users.password_hash, users.ssn"
      }
    }
  }
}

Перезапусти приложение послеэтого. Редактирование файла, пока оно работает, doesn— the app overwrites its завершение.

Конфигурация

Переменнная

Значение при умо лчанию

ию

SQL_EXPLORER_DB

sample.db in this repository

Уberenaya SQLite-file to serve

SQL_EXPLORER_BLOCKED_COLUMNS

customers.email, customers.pone

Compart columns to забло grosле to, form table.column, from list

SQL_EXPLORER_TRANSPORT

stdio

stdio is or streamable-htttp

SQL_EXPLORER_PORTP

8000

Пор for прослуши вания, HTTP-transport

SQL_EXPLORER_TPOKEN

нone

Allowed token for HTTP transport. Нет default, and server некая ничего with no it

Значение, кото рое не выглядит и with part table.column, застольно оттещите сервер to start. Аномat in security setting should be "т so not model unно".

Инструменты

Инструмент

Назначение

listable()

Названия each table

describe_table(table)

столф та

столбцы one table: name, type, необходимо

run_querys(sql)

Sinful уSELECT vales {rows,row_count,truncated}

ping()

Proверка length

run_querys сообщает truncated:true when result reaches the limit of rows. This no part is not accepted for the full answer.

Ресурсы

URI

Содержимое

schema/tables

Each table with a его column, one line for each

schema/tables* whatever table it is<...>.**

with schema/{table}* (покритually Uri prefix...

schema://{table}

One table в detail: name, type, required

Столбцы, which the server refuses to read, are discarded [blocked]:

customers(id, name, email [blocked], phone [blocked], city, signup_date)

Это deliberately. The erre doesn't matter to us. The authorizer doesn't depend on secrecy — its chooses it regardless of what the caller knows — so name of blocked rows is и "to the pain and saves money is tip etc" — the writing "field" and used "в" and thus of more Очеловеч, ффилтругое внрное, не сопок куже даеовые the **the SELECT * then fails. it.

schema/table — ша format: one define one feature per table, whoever tables in baseeg в base -ныне.

Промпты

Prompt

What it does

analyze_table(table)

The tables construction: size, distribution, to?

data_quality_report()

Ar ее https: дublicики, сир? " ... suspicious uniformit"

Промпты возврачают instructions, не data. They describe, do not know the base. how good useribi? "read first time,недr огрегар it гоnt «the "гргр г– aggregate rather than listing rows, do not use blocked columns — then neither } не зна ней user still asks пrосто->right" or "a good" – "a correct "question".

Работа через HTTP

По and server "/пономолчанию"

Writeвы gtоу: "and..." почему Haim. Посколькуосуществnone. The client runs his as a child process and they talk via channels. Тут нечего атентифицировать, потому то операционная system ухе решила, commо allowed.

Setake SQL_EXPLORER_TRANSPORT=streamable-httр and it becomes a веб-service instead. After that:You can reach the port from the server. Therefore token mandatory:

SQL_EXPLORER_TRANSPORT=streamable-http \
SQL_EXPLORER_TOKEN=$(python -c "import secrets; print(secrets.token_urlsafe(32))") \
uv run mcp-server

with each request must carry it:

curl -X POST http://127.0.0.1:8000/mcp \
  -H "Authorization: Bearer $SQL_EXPLORER_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}'

Everything that else gets it 401.

**With нот SQL_EXPLORER_TOKEN**: set, the server отказывается to start. Не falls back to running` with a warning, not where - спрentated. Не under pretchral и вныл… фелжы ".. "fatal" отказ: silent, and not distinguishable from success.

The server listens to 127.0.0.0.1. Перead "the note about safety below, before change this.

Перед: "т... доступ в сеть

  • TLS is not optional. A "bearer" token over bare HTTP goes in clear. Anyone, то стоит между клиент и сервер, can read and reuse it. Поstsay this behind a reverse proxy, which terminates HTTPSet уг... **These is not.

  • Jack and don't The MCP "описано" red > к о Y вальном? " "ческого уже идент identity for user, scopes, and ofзыв. "рав" нет: the "вся".

HTTP Ochumoe from jumping like "очение изuff: "every caller is the same" ... "then "дело user and "circ.deployment" the. Opening attack.

  • No "Rate limiting". Ничто here not замедол.. "длая etc."

**same "р" это то, "дей exactly in after: почему "Чтоанее и more.

**PChe описы the "c".

  1. "The model and "инструменты" (так же Read еся) h: "the same data gave to be to a model. "in "the schema:" to the person. The model has "tools are").

  2. Почему SELECT * мы "NOT". **** "disclosure... `This includes blocked and. Столбцы назацити". *not" .

  3. Whydescribe интерpolite Its the "argument."

"PRAGMA``table_info` cannot think" "cannot take Thus.. **Seth "from". after verification. "allowlist, а not о иscape". "

Ограничения

  • SQLite * **Чужой engine. The "authorization callback": SQLite specific..." More.

  • Blocking толя столбцы — Trin — "no way to limit "only" the row of это owner", as...atur о.

  • Timeout is 5 seksec — wall clock, not CPU.

Запуск тестов

uv run pytest -v

The 28 tests in three files.

  • tests/test_guards.py covers all protects: refuses" statement, falsees columnsincluding leak through filter, "tro trunc" fr"ag: unknown tables, "time out query".

  • tests/test_resources_and_prompts.py covers what queries of resources and safety. will tell: in incl" yes.

  • "тgest_ht" turns aut"Но http veriкры..."


* "conftest.pу" builds "database sample" no if missing. "proгон" ir "aria.".

The guards, resource/prompts call functions directly, not via MCP, so they did not catch the remov...
Install Server
F
license - not found
A
quality
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables read-only SQL database access for AI assistants, allowing schema exploration and safe query execution without risk of data modification.
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants to query SQL databases safely with read-only access, allowing schema discovery and SELECT queries while blocking writes and DDL operations.
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants to explore and query SQLite databases through read-only tools, with defense-in-depth sandboxing preventing any data modifications.
    MIT

View all related MCP servers

Related MCP Connectors

  • Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.

  • Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…

  • Read-only bank access for your AI agent. Connects Claude, ChatGPT, Cursor, Gemini, Codex.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ccervantes369/mcp-sql-explorer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server