Model Context Protocol
MCP PyPI GitHub

Agents & MCP

Connect your AI agents to Lampion via the MCP (Model Context Protocol) protocol. 47 tools and 5 resources to manage PostgreSQL directly from Claude, Cursor, Windsurf, or any compatible MCP client.

Prefer the terminal? Lampion CLI →
01

Install

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 · Recommended
$ pip install lampion-mcp
uv · Fast alternative
$ uv pip install lampion-mcp

Requirements — Python 3.10+. The package automatically installs mcp[cli] and httpx as dependencies.

02

Configure

Generate an API key in Settings > API Keys in the console, then configure your MCP client.

Claude Desktop · ~/.claude/claude_desktop_config.json
{
  "mcpServers": {
    "lampion": {
      "command": "lampion-mcp",
      "env": {
        "LAMPION_TOKEN": "lmp_live_xxx..."
      }
    }
  }
}
Cursor / VS Code · .cursor/mcp.json
{
  "servers": {
    "lampion": {
      "command": "lampion-mcp",
      "env": {
        "LAMPION_TOKEN": "lmp_live_xxx..."
      }
    }
  }
}
CLI · Standalone or debug
# Via argument
$ lampion-mcp --token lmp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Via environment variable
$ export LAMPION_TOKEN=lmp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
$ lampion-mcp
03

Use

Once configured, your AI agent can interact with Lampion in natural language. The MCP server translates intent into API calls.

Create a project

You say

"Create a PostgreSQL project for my blog app in the Paris region"

The agent runs

create_project(name="blog-db", region="fr-par-1")
list_endpoints(project_id="abc123")
→ Connection string ready
Analyze performance

You say

"What are my slowest queries? Suggest some optimizations."

The agent runs

get_slow_queries(project_id, endpoint_id,
  order_by="mean_time", limit=10)
→ Analysis + index recommendations
Branching for CI/CD

You say

"Create a staging branch, run my migration, and tell me if it passes."

The agent runs

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
Backup before deployment

You say

"Take a snapshot of production before the release, then install pgvector."

The agent runs

create_backup(project_id, "main", "pre-release")
install_extension(project_id, endpoint_id,
  "pgvector")
→ Snapshot created + extension installed
04

31 available tools

Each tool maps to a Lampion REST API endpoint. The agent automatically picks the right tool based on your request.

Projects 4 tools
list_projects List projects
get_project Project details
create_project Create a PostgreSQL project
delete_project Delete a project
Branches 3 tools
list_branches List branches
create_branch Create a CoW (Copy-on-Write) branch
delete_branch Delete a branch
Computes 4 tools
list_endpoints List endpoints + connection strings
get_endpoint Endpoint details
suspend_endpoint Scale to zero
resume_endpoint Resume a compute
SQL 2 tools
execute_sql Run a query (max 100 rows)
get_schema Introspect the schema (tables, columns, types)
Databases & Roles 6 tools
list_databases List databases
create_database Create a database
drop_database Delete a database
list_roles List PostgreSQL roles
create_role Create a role
drop_role Delete a role
Extensions 3 tools
list_extensions List available extensions
install_extension Install (pgvector, PostGIS, pg_cron...)
uninstall_extension Uninstall an extension
Observability 5 tools
get_metrics CPU, RAM, connections, cache ratio
get_slow_queries Top slow queries (pg_stat_statements)
get_logs Tail PostgreSQL logs
get_project_usage Compute, storage, transfer usage
get_org_usage Usage and costs by organization
Backups 3 tools
list_backups List snapshots
create_backup Create a snapshot (LSN)
restore_backup Restore to a new branch
Dump 1 tools
pg_dump SQL export (table filtering, max 50KB)
05

MCP resources

Resources are read-only endpoints, accessible by URI. The agent can read them to get context without performing an action.

lampion://projects All projects with IDs and regions
lampion://projects/{id} Project details
lampion://projects/{id}/endpoints Endpoints with connection strings
lampion://projects/{id}/branches List of branches
lampion://usage Usage, plan, cost estimate
06

Workflow examples

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

Ready to connect your agent?

pip install, configure your token, and let AI manage your databases.

Create an account API Documentation