Skip to main content
Glama
nhevers

mcp-sqlite

by nhevers
README.md
# mcp-sqlite

MCP server that provides SQLite database operations. Allows AI assistants to query, modify and manage SQLite databases through the Model Context Protocol.

## Installation

```bash
pip install -r requirements.txt
```

## Quick Start

```python
from mcpsqlite import SQLiteServer

server = SQLiteServer(db_path="data.db")
server.run()
```

## Features

- Execute SELECT, INSERT, UPDATE, DELETE queries
- Schema inspection and table listing
- Transaction support with rollback
- Query result formatting
- Safe parameterized queries

## MCP Tools

### query

Execute a SQL query and return results.

```json
{
  "name": "query",
  "arguments": {
    "sql": "SELECT * FROM users WHERE age > ?",
    "params": [18]
  }
}
```

### execute

Execute a SQL statement (INSERT, UPDATE, DELETE).

```json
{
  "name": "execute",
  "arguments": {
    "sql": "INSERT INTO users (name, age) VALUES (?, ?)",
    "params": ["Alice", 25]
  }
}
```

### schema

Get database schema information.

```json
{
  "name": "schema",
  "arguments": {
    "table": "users"
  }
}
```

### tables

List all tables in the database.

```json
{
  "name": "tables",
  "arguments": {}
}
```

## Configuration

```python
server = SQLiteServer(
    db_path="data.db",
    read_only=False,
    max_rows=1000
)
```

## Examples

### Running as MCP server

```bash
python -m mcpsqlite --db data.db --port 8080
```

### Claude Desktop configuration

```json
{
  "mcpServers": {
    "sqlite": {
      "command": "python",
      "args": ["-m", "mcpsqlite", "--db", "data.db"]
    }
  }
}
```

## License

MIT

Maintenance

ActivityInactive
ResponsivenessNo issues