pagila-mcp
Small MCP server wrapper for the Pagila sample database. This repository provides:
mcp_pagila_server.py- MCP server that accepts JSON requests on stdin and returns JSON responses on stdout.db.py- database helpers to run queries against Postgres.mcp_inspector.py- a small interactive inspector that starts the server subprocess and sends test requests.
Quickstart
Copy the example env and set your DB credentials:
Create a virtualenv and install dependencies:
Run the inspector (it will start the server for you):
Usage & safety
The server exposes
run_pagila_querywhich accepts onlySELECTstatements.text_to_sqlgenerates SELECT SQL from natural language (local heuristic by default).Do not commit
config.envor any secrets. Use environment variables for production.
CI & code style
This repo includes a GitHub Actions CI workflow at
.github/workflows/ci.ymlto run formatting and tests.Use
pre-commit(configured in.pre-commit-config.yaml) to run black/isort/flake8 locally.
License MIT
Pagila MCP server
Lightweight MCP server around the Pagila DB.
Quick start:
Copy
.env.example->config.envand fill DB creds.Create a virtualenv and install dependencies:
python -m venv .venv .venv/bin/pip install -r requirements.txtRun the server:
.venv/bin/python mcp_pagila_server.pyUse the inspector:
.venv/bin/python mcp_inspector.py
See .vscode/launch.json and .vscode/mcp.json for examples.