# amu-pgvector [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/sangaraju1988/amu-pgvector  
**GitHub Stars:** 1  
**Views:** 4  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/amu-pgvector

## Description
Lineage-gated agent memory tools on Postgres + pgvector, enforced by row-level security.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "amu-pgvector": {
    "command": "uvx",
    "args": ["amu-pgvector"]
  }
}
```

## Documentation

## What amu-pgvector does

amu-pgvector implements lineage-aware memory governance for agent-generated results stored in PostgreSQL. It is designed for cases where a result can reveal restricted information even when the result itself is only a number, label, or other apparently harmless value. Access is based on the data used to derive the result, rather than only on metric names, descriptions, or vector similarity.

The project uses PostgreSQL with the pgvector extension. Its memory-unit table is protected with forced row-level security, so the same access decision applies whether a query comes from raw SQL, the Python API, LangChain, or the MCP interface. A department receives a result only when every sensitive column in that result's derivation is permitted for the requesting database role.

## How it works

A trusted writing layer records the SQL and result metadata for a memory unit. A database trigger obtains the SQL lineage, follows registered materialized-view and derived-table relationships, and calculates the sensitive columns touched by that lineage. The resulting status and column set are stored with the memory unit.

At read time, PostgreSQL compares those columns with the permission set associated with the session role. For example, a result derived from `customers.income` can be returned to a Finance role granted access to `income`, while a semantically matching search by a Marketing role is filtered out by the database policy.

Semantic retrieval uses embeddings and pgvector. The quickstart uses a 1,536-dimension fake embedder for local testing; a real embedding model can be supplied for production use. The MCP package exposes the same database-enforced gate rather than implementing a separate client-side filter.

## Setup and configuration

A local setup can be started with Docker Compose, followed by loading `sql/amu_pgvector.sql` into the PostgreSQL database. The example database listens on port `5433` and uses the `amu_dev` database with the `amu_owner` role. The sample owner password is intended for local development and should be changed for other environments.

Install the Python project with `uv sync --all-packages --all-extras`, or install the package with pip. Installing the `mcp` extra adds the `amu-pgvector-mcp` console script. The Python API accepts a PostgreSQL DSN when creating an `AMUStore`; separate database roles can then be used for administrative operations and agent reads.

The SQL installation is designed to run as a normal database owner and requires the `vector` extension. The same SQL approach is described for managed PostgreSQL deployments, including Supabase and Neon.

## Tools and capabilities

The MCP interface provides three tools:

- `amu_search` retrieves semantically similar memory units subject to PostgreSQL row-level security.
- `amu_record` stores a result with its SQL, metadata, ownership information, and embedding input.
- `amu_check_conflict` checks for conflicting metric definitions.

The Python API supports registering sensitive columns, granting department permissions, creating agent roles, recording results, and searching memory. The LangChain package supplies `AMUVectorStore` and `AMURetriever`; reads use the store's PostgreSQL role, so LangChain requests receive the same RLS treatment as SQL and MCP requests.

The database also reacts when a column is later classified as sensitive by recomputing affected memory units. Long or cyclic lineage closure fails closed by marking the affected unit unresolved and hiding it rather than serving a partially traced result.

## Limitations and notes

The writer role's lineage input is trusted by design. A writer that supplies false lineage can undermine the resulting gate. PostgreSQL superusers bypass row-level security, and the design does not address timing side channels or inference created by combining multiple individually permitted memory units.

A convenience identity mode is off by default and depends on a trusted boundary between application code and agent-controlled code when pooled connections are used.

The documented benchmark reached zero cross-department leaks in its tested RLS-gated workload, but retrieval cost depends on filtering and index settings. The default relaxed-order iterative HNSW scan can add substantial latency at 100,000 rows, especially when many rows are hidden. The reported tests did not attempt a one-million-row dataset.

_Full upstream README: https://allmcps.com/mcp/amu-pgvector/readme_

