Early access: Ailimu is free while we build to 1.0. We'd love your feedback. Send feedback Get notified at 1.0
Ailimu

Connect Claude to PostgreSQL with an MCP server

You can ask Claude questions about the data in a PostgreSQL database and get answers from the live tables, without exporting anything or writing SQL. This guide shows how to set it up with Ailimu, a self-hosted MCP server, and why the database, not the software, keeps the final say over what Claude can reach.

If you are new to the idea, start with what an MCP server is. The same server also connects to FileMaker, and one install can hold both side by side.

What you need

1. Give Ailimu an account of its own

This is the step that matters most. The database's permissions are the real limit on what Claude can do. Ailimu offers only what you tick in its wizard, but an account that cannot read or change something stops it however the wizard is set. So create a dedicated account and grant it only what Claude should have.

For reading, grant SELECT on the tables you plan to expose, or on a whole schema:

CREATE ROLE ailimu_ro LOGIN PASSWORD 'choose-a-long-password';
GRANT CONNECT ON DATABASE shop TO ailimu_ro;
GRANT USAGE ON SCHEMA public TO ailimu_ro;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO ailimu_ro;

Start here, with reading only. If you later want Claude to change a record, grant UPDATE on the specific columns it may change, never on the whole table:

GRANT UPDATE (status, notes) ON orders TO ailimu_rw;

PostgreSQL itself then refuses a change to any other column, even if someone ticks it as writable in the wizard. If you use row-level security, it applies to this account like any other.

2. Put the login in .env

Add the account to the .env file beside Ailimu, then restart the container:

PG_USER=ailimu_ro
PG_PASSWORD=choose-a-long-password

The login is read from the environment only. It is never written to Ailimu's configuration file or to a backup.

3. Connect

  1. Open the wizard and choose New connection.
  2. For Connect to, choose PostgreSQL.
  3. Enter the host, the port (5432 unless you changed it), the database and the schema (public unless your tables live elsewhere). One connection serves one schema; make another connection for a second schema.
  4. Click Test connection.

A few details save time:

4. Choose what Claude can see

Ailimu reads PostgreSQL's own catalog, so it knows every table, column type, primary key, foreign key and comment exactly. Nothing about keys or relationships is guessed, and the relationship diagram draws the keys the database declares.

Tick the tables Claude may use, then the fields. For each field you decide whether it can be returned, searched, or neither. Leave out anything the questions do not need, because the rows Claude reads are sent to the AI provider as part of the conversation. Then publish. Ailimu is read-only until you turn changes on.

Every value Claude supplies is sent to the database as a bound value, never written into a query.

5. Connect Claude

The last step of the wizard, Connect Claude, shows the address and token for this connection, and makes a one-click extension for Claude Desktop. The steps are the same as for FileMaker: see Connect Claude to your FileMaker data, from the part where Claude is connected.

Then ask a question you already know the answer to: "Which customers placed more than three orders last month?" Claude finds the right tables and answers with the rows it used.

What is different from FileMaker

Next