Skip to content
MCP server

Filelayer

File ownership, expiring shares and audit trail for SaaS apps, exposed to agents over MCP

Runs locallyStatus and history
Install
Pricing
Open source
Platforms
CLI, self-hosted
Runs
Locally
Version
0.35.4
Listing updated
3 days ago

About Filelayer

Filelayer is an open-source MCP server for files and documents. It runs locally on your machine and is started by your AI client.

Filelayer is a Node library that keeps file ownership, grants and a hash-chained audit trail in your own PostgreSQL, with the bytes on your own S3-compatible bucket or a local directory. The MCP package exposes a slice of it to an agent: list a user's files, share one with an expiry and revoke the link.

The safety design is that the server speaks for exactly one subject. FILELAYER_AS and FILELAYER_ORG are fixed for the life of the process, and no tool reads them as an argument, so an agent cannot act as someone else. To serve several people you start several servers. The bucket must be private, and a doctor command checks whether it serves unauthenticated reads.

The project is Apache-2.0 and labelled alpha at v0.35.3, so the schema can still change in any 0.x release. It needs Node 22.18 or later and a Postgres you already run.

Install

Run in a terminal

claude mcp add core --env DATABASE_URL='<DATABASE_URL>' --env FILELAYER_AS='<FILELAYER_AS>' --env FILELAYER_ORG='<FILELAYER_ORG>' --env S3_ACCESS_KEY_ID='<S3_ACCESS_KEY_ID>' --env S3_SECRET_ACCESS_KEY='<S3_SECRET_ACCESS_KEY>' -- npx -y @filelayer/core

Add to claude_desktop_config.json

{
  "mcpServers": {
    "core": {
      "command": "npx",
      "args": [
        "-y",
        "@filelayer/core"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>",
        "FILELAYER_AS": "<FILELAYER_AS>",
        "FILELAYER_ORG": "<FILELAYER_ORG>",
        "S3_ACCESS_KEY_ID": "<S3_ACCESS_KEY_ID>",
        "S3_SECRET_ACCESS_KEY": "<S3_SECRET_ACCESS_KEY>"
      }
    }
  }
}

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "core": {
      "command": "npx",
      "args": [
        "-y",
        "@filelayer/core"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>",
        "FILELAYER_AS": "<FILELAYER_AS>",
        "FILELAYER_ORG": "<FILELAYER_ORG>",
        "S3_ACCESS_KEY_ID": "<S3_ACCESS_KEY_ID>",
        "S3_SECRET_ACCESS_KEY": "<S3_SECRET_ACCESS_KEY>"
      }
    }
  }
}

Add to .vscode/mcp.json

{
  "servers": {
    "core": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@filelayer/core"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>",
        "FILELAYER_AS": "<FILELAYER_AS>",
        "FILELAYER_ORG": "<FILELAYER_ORG>",
        "S3_ACCESS_KEY_ID": "<S3_ACCESS_KEY_ID>",
        "S3_SECRET_ACCESS_KEY": "<S3_SECRET_ACCESS_KEY>"
      }
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "core": {
      "command": "npx",
      "args": [
        "-y",
        "@filelayer/core"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>",
        "FILELAYER_AS": "<FILELAYER_AS>",
        "FILELAYER_ORG": "<FILELAYER_ORG>",
        "S3_ACCESS_KEY_ID": "<S3_ACCESS_KEY_ID>",
        "S3_SECRET_ACCESS_KEY": "<S3_SECRET_ACCESS_KEY>"
      }
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "core": {
      "command": "npx",
      "args": [
        "-y",
        "@filelayer/core"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>",
        "FILELAYER_AS": "<FILELAYER_AS>",
        "FILELAYER_ORG": "<FILELAYER_ORG>",
        "S3_ACCESS_KEY_ID": "<S3_ACCESS_KEY_ID>",
        "S3_SECRET_ACCESS_KEY": "<S3_SECRET_ACCESS_KEY>"
      }
    }
  }
}

Configuration

  • DATABASE_URLYour own PostgreSQL, where this library keeps file ownership, grants and the audit chain. Apply node_modules/@filelayer/core/schema.sql once before starting.Required
  • FILELAYER_ASThe ONE subject this server speaks for, in your own id space. Fixed for the life of the process: no tool reads it as an argument and no tool can change it, which is the only reason exposing these tools to an agent is safe. Write it yourself or have your provisioning write it, never derive it from a conversation. Serving several people means starting several servers.Required
  • FILELAYER_ORGThe organisation this server is scoped to, in your own id space.Required
  • FILELAYER_DATA_DIRA local directory for the bytes. Needs no bucket and no IAM user. Set this OR the S3_* block: with neither, the server refuses to start rather than falling back to memory, which would work in a demo and lose the first real file.
  • S3_ENDPOINTAn S3-compatible endpoint, for example https://<account>.r2.cloudflarestorage.com. Setting it makes S3_BUCKET, S3_ACCESS_KEY_ID and S3_SECRET_ACCESS_KEY required.
  • S3_BUCKETThe bucket. It must be private: this library decides who may be GIVEN a URL and has no say in who the object store will answer. `npx -p @filelayer/core filelayer doctor` reports whether yours serves unauthenticated reads.
  • S3_REGIONRegion, or `auto` for Cloudflare R2.
  • S3_ACCESS_KEY_IDAccess key id for the bucket.
  • S3_SECRET_ACCESS_KEYSecret access key for the bucket.
  • FILELAYER_MCP_AGENT_LABELHow this agent names itself in the audit trail, recorded on every event these tools produce. It is what lets the chain separate "the partner opened this document" from "the partner's assistant opened this document".
  • FILELAYER_MCP_ALLOW_DESTRUCTIVESet to exactly `true` to register delete_file. Off by default because deleting is not recoverable and an agent that misreads a sentence deletes the wrong thing silently.
  • FILELAYER_MCP_EXPOSE_AUDITSet to exactly `true` to register file_audit. Off by default because the trail is an organisation's whole history and a tool that returns it copies every file name, actor and denial into the model's context. Reading it is itself audited since 0.27.0, which was the previous reason; the default did not move.
  • FILELAYER_MCP_RETURN_BYTESSet to exactly `true` to register read_file. Off by default because a document returned by a tool is a document copied into a model's context; file_info plus a share link is usually what was actually needed.
  • FILELAYER_BASE_URLThe base of the share URLs this instance mints. Without it, share links come back without a URL.

What it does

Single-subject server
Acts for one fixed user and organization that tools cannot change.
Expiring shares
Share a file with an expiry, a download cap or a password.
Revocable links
Revoke a share so access stops immediately, not at expiry.
Hash-chained audit
Records allowed and denied access in your own Postgres.
Bring your own storage
Uses your S3 or R2 bucket, or a local data directory.
Doctor check
Reports whether your bucket serves unauthenticated reads.

Good for

  • Let an agent list a customer's files without cross-user access
  • Share a contract with an expiring link and revoke it later
  • Answer a security review about who opened or was refused a file
  • Add per-file permissions to a SaaS app on your own bucket

Pricing

Open source, from $99 a month

Free Apache-2.0 library; paid support from $99/mo per organization

Prices change. Check filelayer.dev before you buy.

Filelayer FAQ

Is it free?

The library is Apache-2.0 and free in production. Team is $99 a month and Business $299 a month for support; Enterprise is by email.

Why is it safe to expose to an agent?

The acting subject is fixed in environment variables and no tool accepts it as an argument.

What does it need?

Node 22.18 or later, a PostgreSQL database and either an S3-compatible bucket or a local data directory.

How mature is it?

It is alpha at v0.35.3, and the schema can still change in any 0.x release.

Is Filelayer free?

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

How do I add Filelayer to Claude Code?

Run this command in your terminal: claude mcp add core --env DATABASE_URL='<DATABASE_URL>' --env FILELAYER_AS='<FILELAYER_AS>' --env FILELAYER_ORG='<FILELAYER_ORG>' --env S3_ACCESS_KEY_ID='<S3_ACCESS_KEY_ID>' --env S3_SECRET_ACCESS_KEY='<S3_SECRET_ACCESS_KEY>' -- npx -y @filelayer/core

What are the best alternatives to Filelayer?

The closest alternatives to Filelayer are REA, Agent Roast, Midplane, Leash and ASTra.

Alternatives to Filelayer

  1. REA

    MCP server

    CLI and MCP server that lets coding agents reverse engineer apps and binaries

    Runs locally
    • Open source
    • 464K GitHub stars
    • Developer tools
  2. Agent Roast

    MCP server

    Offline review that flags agent changes which weaken tests, assertions or CI

    Runs locally
    • Open source
    • 4 Hacker News points
    • Developer tools
  3. Midplane

    MCP server

    Postgres gateway for AI agents with table grants, column masking and approval for writes

    Runs locally
    • Open source
    • 5 GitHub stars
    • Databases
  4. Leash

    MCP server

    Review what your AI touched, approve risky actions and undo supported changes

    • 1 tool
    • Remote
    • Free
    • 1 GitHub star
    • Security
  5. ASTra

    MCP server

    Let agents read, edit, validate and undo Word .docx files with exact operations

    Runs locally
    • 5 tools
    • Freemium
    • Files and documents