MCPDatabasesSSE

by alvnavraii

293 downloads
Not rated
GitHub

About

MCPDatabasesSSE is a Model Context Protocol server that provides tools for executing SQL queries and managing PostgreSQL databases. It is built with FastMCP and communicates via SSE (Server-Sent Events) transport, making it suitable for AI assistants that need to interact with a…

Details

Author
alvnavraii
Downloads
293
Categories
Other

- Exposes seven database operation tools via MCP
- Supports query, insert, update, delete, and schema changes
- Uses SSE transport for real-time communication
- Connects to a PostgreSQL database via a connect function
- Built on the FastMCP framework

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCPDatabasesSSE
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

The server runs on host 0.0.0.0 port 8050 and exposes tools for querying, inserting, updating, deleting, and schema operations (create/alter/drop tables). No installation or configuration details are provided in the README.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcpdatabasessse": {
            "SqliteManagement": {
                "command": "/home/slendy/MCPProjects/DataBase/.venv/bin/python",
                "args": [
                    "/home/slendy/MCPProjects/DataBase/main.py",
                    "--engine",
                    "sqlite",
                    "--url",
                    "sqlite:////home/slendy/MCPProjects/DataBase/ecommerce.db"
                ]
            },
            "PostgressManagement": {
                "command": "/home/slendy/MCPProjects/DataBase/.venv/bin/python",
                "args": [
                    "/home/slendy/MCPProjects/DataBase/main.py",
                    "--engine",
                    "postgresql",
                    "--url",
                    "postgresql://postgres:postgres@localhost:5433/ecommerce"
                ]
            }
        }
    }
}

McpServers

{
    "SqliteManagement": {
        "command": "/home/slendy/MCPProjects/DataBase/.venv/bin/python",
        "args": [
            "/home/slendy/MCPProjects/DataBase/main.py",
            "--engine",
            "sqlite",
            "--url",
            "sqlite:////home/slendy/MCPProjects/DataBase/ecommerce.db"
        ]
    },
    "PostgressManagement": {
        "command": "/home/slendy/MCPProjects/DataBase/.venv/bin/python",
        "args": [
            "/home/slendy/MCPProjects/DataBase/main.py",
            "--engine",
            "postgresql",
            "--url",
            "postgresql://postgres:postgres@localhost:5433/ecommerce"
        ]
    }
}

from mcp.server.fastmcp import FastMCP
from connection import connect

mcp = FastMCP(name = "PostgressManagement", host="0.0.0.0", port=8050)

def execute(query: str):
conn = connect()
cursor = conn.cursor()
cursor.execute(query)
conn.commit()
cursor.close()
conn.close()
return True

@mcp.tool()
async def query_db(query: str):
conn = connect()
cursor = conn.cursor()
cursor.execute(query)
result = cursor.fetchall()
cursor.close()
conn.close()
return result

@mcp.tool()
async def insert_db(query: str):
return execute(query)

@mcp.tool()
async def update_db(query: str):
return execute(query)

@mcp.tool()
async def delete_db(query: str):
return execute(query)

@mcp.tool()
async def create_table(query: str):
return execute(query)

@mcp.tool()
async def alter_table(query: str):
return execute(query)

@mcp.tool()
async def drop_table(query: str):
return execute(query)

@mcp.tool()
async def insert_db(query: str):
return execute(query)

if __name__ == "__main__":
print("Starting server...")
conn = connect()
mcp.run(transport="sse")

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.