# PremAgentic

> PremAgentic is an open-source MCP server for knowledge and memory. On-premises document retrieval for agents, with folder-level access rules checked first. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** Windows, Linux, self-hosted, CLI
- **Website:** https://premagentic.com
- **Repository:** https://github.com/premagentic/premagentic
- **MCP Registry name:** io.github.premagentic/premagentic
- **Categories:** knowledge and memory, security
- **Listing updated:** 2026-11-16

## About

PremAgentic indexes Markdown, text, PDF, Word and Excel files on your own servers and returns cited passages to people and AI assistants. An administrator sets an ordered list of allow and deny entries per folder; the first entry that names the caller decides, and no entry means no. Those rules are checked on every search, before anything is retrieved, so an HR group can reach salary bands that an engineering group cannot.

It adds lifecycle gates too: superseded material is held back unless history is requested, a document declaring a machine author is held from agents until a person reviews it, and a document past its stale-after date is flagged for people and withheld from agents. Answers are passages with file, heading, page or sheet citations; it generates no prose, never writes to the source, and does not read text inside pictures or scanned pages.

The MCP server runs from an OCI container over stdio and connects to the PremAgentic API using PREM_API_URL and an agent token issued with prem tokens issue. By default embeddings are local with no outbound calls or API keys, but an assistant on a hosted model does receive the passages it retrieves, and a folder can be barred from such agents. It runs on Windows and Linux with PostgreSQL 14 or later, under AGPL 3.0.

## Features

- **Folder-level access rules:** Ordered allow and deny entries decide who can read each folder.
- **Cited passages only:** Returns passages with file and heading, page or sheet citations, without generated prose.
- **Local embeddings:** The default provider makes no outbound call and needs no API key.
- **Lifecycle gates:** Withholds superseded, unreviewed machine-authored and stale documents from agents.
- **Model-location control:** A folder can be marked never to be served to agents running on hosted models.
- **Audit trail:** Records where each agent's model runs on every audit row.

## Good for

- Give an assistant access to internal documents without exposing restricted folders
- Return the current version of a policy rather than a superseded draft
- Keep clinical or legal files closed to staff who should not see them
- Run document search with no cloud service

## Install

### Claude Code (Terminal)

```sh
claude mcp add premagentic --env PREM_API_URL='<PREM_API_URL>' --env PREM_AGENT_TOKEN='<PREM_AGENT_TOKEN>' -- docker run -i --rm -e PREM_API_URL -e PREM_AGENT_TOKEN ghcr.io/premagentic/premagentic-mcp:0.1.0
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "premagentic": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "PREM_API_URL",
        "-e",
        "PREM_AGENT_TOKEN",
        "ghcr.io/premagentic/premagentic-mcp:0.1.0"
      ],
      "env": {
        "PREM_API_URL": "<PREM_API_URL>",
        "PREM_AGENT_TOKEN": "<PREM_AGENT_TOKEN>"
      }
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "premagentic": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "PREM_API_URL",
        "-e",
        "PREM_AGENT_TOKEN",
        "ghcr.io/premagentic/premagentic-mcp:0.1.0"
      ],
      "env": {
        "PREM_API_URL": "<PREM_API_URL>",
        "PREM_AGENT_TOKEN": "<PREM_AGENT_TOKEN>"
      }
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "premagentic": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "PREM_API_URL",
        "-e",
        "PREM_AGENT_TOKEN",
        "ghcr.io/premagentic/premagentic-mcp:0.1.0"
      ],
      "env": {
        "PREM_API_URL": "<PREM_API_URL>",
        "PREM_AGENT_TOKEN": "<PREM_AGENT_TOKEN>"
      }
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "premagentic": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "PREM_API_URL",
        "-e",
        "PREM_AGENT_TOKEN",
        "ghcr.io/premagentic/premagentic-mcp:0.1.0"
      ],
      "env": {
        "PREM_API_URL": "<PREM_API_URL>",
        "PREM_AGENT_TOKEN": "<PREM_AGENT_TOKEN>"
      }
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "premagentic": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "PREM_API_URL",
        "-e",
        "PREM_AGENT_TOKEN",
        "ghcr.io/premagentic/premagentic-mcp:0.1.0"
      ],
      "env": {
        "PREM_API_URL": "<PREM_API_URL>",
        "PREM_AGENT_TOKEN": "<PREM_AGENT_TOKEN>"
      }
    }
  }
}
```

## FAQ

### Does it send my documents to the cloud?

Not with the default local embedding provider. An assistant on a hosted model does receive the passages each search returns.

### Which file types does it read?

Markdown, text, PDF, Word (.docx) and Excel (.xlsx, .xlsb); the last three need allowed extensions.

### Can agents write to my documents?

No. Agents read from it and never write.

### What licence is it under?

GNU Affero General Public License 3.0.

### Is PremAgentic free?

Yes. PremAgentic is open source, so you can use and self-host it for free.

### How do I add PremAgentic to Claude Code?

Run this command in your terminal: claude mcp add premagentic --env PREM_API_URL='<PREM_API_URL>' --env PREM_AGENT_TOKEN='<PREM_AGENT_TOKEN>' -- docker run -i --rm -e PREM_API_URL -e PREM_AGENT_TOKEN ghcr.io/premagentic/premagentic-mcp:0.1.0

### What are the best alternatives to PremAgentic?

The closest alternatives to PremAgentic are REA, Codebase Memory, XERJ, Claude Code Ultimate Guide and Nautilus Compass Memory.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Nautilus Compass Memory](https://ai-powered.com/mcp/nautilus-compass-memory): Nautilus Compass Memory is an open-source MCP server for knowledge and memory.
- [Agent Roast](https://ai-powered.com/mcp/agent-roast): Agent Roast is an open-source MCP server for developer tools.
- [Midplane](https://ai-powered.com/mcp/midplane): Midplane is an open-source MCP server for databases.
- [Leash](https://ai-powered.com/mcp/leash): Leash is a free MCP server for security.

---
Source: https://ai-powered.com/mcp/premagentic
