Skip to main content
Glama
jlg-formation

mcp-server-sqlite

mcp-server-sqlite

Serveur MCP (Model Context Protocol) en Python exposant une base SQLite à un assistant IA via un unique outil : execute_sql. Usage local et personnel.

L'IA peut exécuter n'importe quelle requête SQL (SELECT, INSERT, UPDATE, DELETE, DDL…) et récupérer les résultats au format JSON.

⚠️ Aucun garde-fou de sécurité : le SQL est totalement libre, il n'y a ni mode lecture seule, ni authentification, ni limite. Destiné à un usage local par un utilisateur unique.

Prérequis

  • Python 3.12+

  • uv

Related MCP server: SQLite MCP Server

Installation

uv sync

Lancement

Le chemin de la base SQLite est fourni via --db-path ou la variable d'environnement SQLITE_DB_PATH. Le fichier est créé automatiquement s'il n'existe pas.

Mode stdio (usage local standard)

uv run mcp-server-sqlite --db-path ./ma_base.db

Mode HTTP (JSON, sans SSE)

uv run mcp-server-sqlite --transport http --db-path ./ma_base.db --host 127.0.0.1 --port 8000

Le transport HTTP répond en application/json (pas de flux SSE), adapté aux clients incapables de streamer. Par défaut : 127.0.0.1:8000.

Accès navigateur : le serveur fonctionne sans aucune configuration d'origine. La protection anti DNS-rebinding du SDK MCP est désactivée (sinon les origines non-localhost sont rejetées avec « Invalid Origin header ») et le CORS autorise par défaut toutes les origines (*). Si vous souhaitez malgré tout restreindre le CORS, utilisez --cors-origin (répétable) :

uv run mcp-server-sqlite --transport http --cors-origin http://localhost:3000 --cors-origin https://mon-app.example

L'en-tête Mcp-Session-Id est exposé pour permettre aux clients navigateurs de lire l'identifiant de session MCP.

L'outil execute_sql

  • Entrée : sql — une chaîne contenant du SQL arbitraire. Plusieurs instructions peuvent être séparées par ; (exécution de type executescript).

  • Sortie (chaîne JSON) :

    • Requête renvoyant des lignes (SELECT) : {"rows": [{"colonne": valeur, ...}, ...]}

    • Requête de modification / DDL : {"rowcount": <nombre de lignes affectées>}

    • Erreur SQL : {"error": "<message>"}

  • Les types non natifs JSON sont convertis en chaîne : BLOB décodé en UTF-8 (repli en hexadécimal), dates au format ISO.

  • Commit automatique après chaque appel réussi.

Configuration côté client MCP

Deux cas de figure : le client lance lui-même le serveur (mode stdio), ou le client se connecte à un serveur HTTP déjà démarré.

Mode stdio (le client lance le serveur)

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "sqlite": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "d:/___AGENTS/mcp-server-sqlite-uv",
        "mcp-server-sqlite",
        "--db-path",
        "d:/___AGENTS/mcp-server-sqlite-uv/ma_base.db"
      ]
    }
  }
}

VS Code (.vscode/mcp.json)

{
  "servers": {
    "sqlite": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "d:/___AGENTS/mcp-server-sqlite-uv",
        "mcp-server-sqlite",
        "--db-path",
        "d:/___AGENTS/mcp-server-sqlite-uv/ma_base.db"
      ]
    }
  }
}

Mode HTTP (le serveur est démarré à part)

Démarrez d'abord le serveur en mode HTTP :

uv run mcp-server-sqlite --transport http --db-path ./ma_base.db --host 127.0.0.1 --port 8000

Le point de terminaison MCP est alors disponible sur http://127.0.0.1:8000/mcp. Configurez ensuite le client pour s'y connecter par URL.

VS Code (.vscode/mcp.json)

{
  "servers": {
    "sqlite": {
      "type": "http",
      "url": "http://127.0.0.1:8000/mcp"
    }
  }
}

Claude Desktop (claude_desktop_config.json)

Claude Desktop ne se connecte qu'en stdio ; on passe par le proxy mcp-remote pour atteindre un serveur HTTP :

{
  "mcpServers": {
    "sqlite": {
      "command": "npx",
      "args": ["mcp-remote", "http://127.0.0.1:8000/mcp"]
    }
  }
}

ℹ️ Si le client tourne dans un navigateur, autorisez son origine avec --cors-origin au lancement du serveur (voir la section Lancement).

Tests

uv run pytest

Développement avec mise

Le projet fournit un mise.toml qui gère les outils (Python 3.12, uv) et expose des tâches. uv est configuré pour utiliser le Python fourni par mise.

mise install       # installe Python + uv
mise run install   # uv sync
mise run test      # tests pytest
mise run serve     # serveur en mode stdio
mise run serve-http # serveur en mode HTTP (JSON)

Licence

MIT — voir LICENSE.

Available Tools

1 tool
execute_sqlA

Exécute une ou plusieurs requêtes SQL sur la base SQLite.

    Args:
        sql: SQL arbitraire (SELECT, INSERT, UPDATE, DELETE, DDL…).
             Plusieurs instructions peuvent être séparées par ';'.

    Returns:
        Une chaîne JSON : {"rows": [...]} pour les requêtes renvoyant des
        lignes, {"rowcount": n} pour les modifications/DDL, ou
        {"error": "..."} en cas d'erreur SQL.
    
ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It discloses that arbitrary SQL (SELECT, INSERT, UPDATE, DELETE, DDL) is allowed, multiple statements via ';', and that errors return JSON with 'error'. However, it does not explicitly warn about destructive potential, but the listed operations imply it.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with separate Args and Returns sections, though the formatting is slightly verbose. Every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given one required parameter, no annotations, and an output schema described in the description, the description covers purpose, parameter behavior, return format, and error handling completely.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must add meaning. It explains that the 'sql' parameter accepts arbitrary SQL, lists allowed operations, and notes that multiple statements can be separated by ';'. This fully compensates for the lack of schema documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states 'Exécute une ou plusieurs requêtes SQL sur la base SQLite', which is a clear verb (execute) + resource (SQLite database) and differentiates from any sibling (none provided).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not provide explicit when-to-use or when-not-to-use guidance, but the tool's purpose is straightforward and no siblings exist, so the implied usage is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev0.1.0
    • First observedexecute_sql

TDQS

A4.4/5.0
Disambiguation5/5

With only one tool, there is no ambiguity; the agent cannot confuse it with any other tool.

Naming Consistency5/5

The single tool name 'execute_sql' follows a clear verb_noun pattern, consistent with best practices.

Tool Count4/5

One tool is minimal but fully capable for a SQLite database server, covering all operations via arbitrary SQL queries.

Completeness5/5

The tool accepts any SQL statement, enabling full CRUD, DDL, and other database operations without gaps.

Maintenance

ActivitySlowing
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables LLM agents to perform complete database operations on SQLite databases, including creating tables, executing queries, and managing data through CRUD operations with schema inspection capabilities.
    32
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to interact with SQLite databases by executing read and write queries, listing tables, and inspecting schemas. It provides a secure, local interface for database management and data retrieval through the Model Context Protocol.
    2
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to connect to and query an SQLite database through the Model Context Protocol, allowing natural language interaction with database tables and data.
    -
  • A
    license
    B
    quality
    C
    maintenance
    Enables AI agents to interact with local SQLite databases with full CRUD, schema introspection, foreign key relations, generated columns, and multi-format import/export (CSV, JSON, XLSX) through natural language.
    26
    17
    MIT

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/jlg-formation/mcp-server-sqlite-uv'

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