Connect your AI agents to Lampion via the MCP (Model Context Protocol) protocol. 31 tools and 5 resources to manage PostgreSQL directly from Claude, Cursor, Windsurf, or any compatible MCP client.
Prefer the terminal? Lampion CLI →
The Lampion MCP server is open source on GitHub and distributed on PyPI under the name lampion-mcp. A single command is all it takes.
$ pip install lampion-mcp
$ uv pip install lampion-mcp
Requirements — Python 3.10+. The package automatically installs mcp[cli] and httpx as dependencies.
Generate an API key in Settings > API Keys in the console, then configure your MCP client.
{
"mcpServers": {
"lampion": {
"command": "lampion-mcp",
"env": {
"LAMPION_TOKEN": "lmp_live_xxx..."
}
}
}
} {
"servers": {
"lampion": {
"command": "lampion-mcp",
"env": {
"LAMPION_TOKEN": "lmp_live_xxx..."
}
}
}
} # Via argument $ lampion-mcp --token lmp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Via environment variable $ export LAMPION_TOKEN=lmp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx $ lampion-mcp
Once configured, your AI agent can interact with Lampion in natural language. The MCP server translates intent into API calls.
"Create a PostgreSQL project for my blog app in the Paris region"
create_project(name="blog-db", region="fr-par-1") list_endpoints(project_id="abc123") → Connection string ready
"What are my slowest queries? Suggest some optimizations."
get_slow_queries(project_id, endpoint_id, order_by="mean_time", limit=10) → Analysis + index recommendations
"Create a staging branch, run my migration, and tell me if it passes."
create_branch(project_id, "staging", "main") execute_sql(project_id, endpoint_id, "ALTER TABLE users ADD col...") get_schema(project_id, "postgres", "public") → Schema validation
"Take a snapshot of production before the release, then install pgvector."
create_backup(project_id, "main", "pre-release") install_extension(project_id, endpoint_id, "pgvector") → Snapshot created + extension installed
Each tool maps to a Lampion REST API endpoint. The agent automatically picks the right tool based on your request.
Resources are read-only endpoints, accessible by URI. The agent can read them to get context without performing an action.
A few complete scenarios showing how an agent chains tools together.
Deploy a feature branch
1. create_branch(project_id, "feat-auth", "main") 2. execute_sql(... "CREATE TABLE sessions (...)") 3. execute_sql(... "INSERT INTO sessions ...") 4. get_schema(... "postgres", "public") // Check the schema 5. get_metrics(...) // Check performance 6. delete_branch(... "feat-auth") // Cleanup
Full performance audit
1. get_metrics(...) // Overview 2. get_slow_queries(... limit=20) // Top slow queries 3. execute_sql(... "EXPLAIN ANALYZE ...") // Execution plan 4. get_logs(... lines=50) // Recent logs 5. get_project_usage(...) // Associated costs → The agent synthesizes: index recommendations, alerts, estimates
Safe migration
1. create_backup(... "pre-migration") // Snapshot 2. create_branch(... "migration-test") // Test branch 3. execute_sql(... "ALTER TABLE ...") // Test the migration 4. get_schema(...) // Check the result 5. execute_sql(on main, "ALTER TABLE ...") // Apply to production 6. delete_branch(... "migration-test") // Cleanup
pip install, configure your token, and let AI manage your databases.