Skip to content

gzein21/CursorDemo

Repository files navigation

SQLite MCP Server

A simple Model Context Protocol (MCP) server for interacting with SQLite databases.

Features

  • Execute SQL queries on SQLite databases
  • Get database schema information
  • List all tables in the database
  • JSON-formatted results for easy parsing

Setup

  1. Install dependencies:

    pip install -r requirements.txt
  2. The server is configured to work with employees.db in the current directory.

Usage

Running the Server

python mcp_sqlite_server.py employees.db

Available Tools

  1. query_database: Execute SQL queries

    • Input: {"query": "SELECT * FROM employees LIMIT 5"}
  2. get_schema: Get database schema

    • Input: {}
  3. list_tables: List all tables

    • Input: {}

MCP Client Configuration

Add this to your MCP client configuration:

{
  "mcpServers": {
    "sqlite-employees": {
      "command": "python",
      "args": ["mcp_sqlite_server.py", "employees.db"],
      "env": {}
    }
  }
}

Testing

Run the test script to verify everything is working:

python test_mcp_server.py

Example Queries

Once connected through an MCP client, you can use these example queries:

  • SELECT * FROM employees LIMIT 10
  • SELECT COUNT(*) FROM employees
  • SELECT department, COUNT(*) FROM employees GROUP BY department
  • PRAGMA table_info(employees)

Security Note

This server executes SQL queries directly. In a production environment, consider implementing query validation and sanitization.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages