Skip to main content

Pathgate

pathgate is a Python Model Context Protocol (MCP) server that exposes a controlled filesystem interface to MCP clients such as Claude Desktop, Cursor, VS Code, and inspector tools. The server only permits access to directories that are explicitly allow-listed at startup.

What it does

The server exposes:

  • File resources via file://...
  • Directory resources via directory://...
  • Tools for reading, writing, listing, creating, deleting, moving, copying, searching, and inspecting files/directories
  • Built-in prompts for directory analysis and file discovery

Security model

Access is restricted by allow-listed paths. At startup, the server resolves the supplied paths and only permits operations within those directories.

  • Paths are checked with os.path.realpath() and prefix matching
  • Symlinks are resolved before comparison
  • The server can be run in read-only mode to disable mutating operations

Installation

Pathgate package is published on PyPI. To use it, for example with Claude Desktop, add this in the

{
  "mcpServers": {
    "pathgate": {
      "command": "uvx",
      "args": ["pathgate@latest", "C:\\Users\\me\\Documents"]
    }
  }
}

Or, you can use the install command to directly write the config file

uvx pathgate install <paths>

paths should have nothing between them

uvx pathgate install C:\Users\me\Documents C:\Users\me\Projects

When no paths are given, it prompts you for them.

Options

--read-only: writes the safer variant of the entry. --dry-run: shows what it would write and changes nothing. --yes: skips the confirmation prompt. --name: sets a different entry name (default pathgate). --config PATH: I build this mcp server for Claude primarily. Using this option edits a specific file, which also works for other clients that use the same mcpServers shape.

Updating

You don't need to manually update it. The command does that for you.

Usage

Start with allowed directories

uvx pathgate "C:\Users\<username>\Documents" "C:\Users\<username>\Projects"

Read-only mode

uvx pathgate --read-only "C:\Users\<username>\Documents"

Environment variable alternative

$env:FS_MCP_ALLOWED_PATHS = "C:\Users\<username>\Documents;C:\Users\<username>\Projects"
uvx pathgate

On macOS/Linux, use : instead of ; for the path separator.

Tools

The current implementation exposes these tools:

  • read_file_tool — read a file and return its content, size, and encoding
  • write_file_tool — write content to a file
  • list_directory_tool — list directory contents, optionally recursively
  • create_directory_tool — create a directory tree if needed
  • delete_file_tool — delete a single file
  • delete_directory_tool — delete a directory, optionally recursively
  • move_file_tool — move or rename a file/directory
  • copy_file_tool — copy a file/directory
  • search_files_tool — search for files matching a pattern
  • get_file_info_tool — return metadata for a file or directory

Example requests

Once connected, clients can ask:

List the files in C:\Users\<username>\Documents
Read C:\Users\<username>\Documents\notes.txt
Search for *.py files under C:\Users\<username>\Projects
Create a file at C:\Users\<username>\Documents\todo.txt with the content "Ship release"

Project layout

pathgate/
├── pathgate/
│   ├── __init__.py
│   ├── __main__.py
│   ├── config.py
│   ├── prompts.py
│   ├── resources.py
│   ├── server.py
│   ├── tool_schemas.py
│   └── tools.py
├── tests/
│   └── test_server.py
├── pyproject.toml
├── README.md
└── LICENSE

Requirements

  • Python 3.10+
  • mcp>=2

References

Metadata

Release files for pathgate 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pathgate 0.2.3
File Size Uploaded Provenance Actions
pathgate-0.2.3.tar.gz 12.1 kB Without provenance Details for pathgate-0.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pathgate 0.2.3
File Interpreter ABI Platform Actions
pathgate-0.2.3-py3-none-any.whl Python 3 none any Details for pathgate-0.2.3-py3-none-any.whl

Total release size: 26.6 kB

Release files / pathgate-0.2.3.tar.gz

Download URL pathgate-0.2.3.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8f5761bcf749a1cc7ffa4ac0d254f2b4ebb1b8a8f3379ec6821ef89c8c0c3e43
BLAKE2b-256 checksum
How to use checksums
842779e43c7eb11d7ec87711cc5d58bcb1987ec4905df10e130a00cd78dc01b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / pathgate-0.2.3-py3-none-any.whl

Download URL pathgate-0.2.3-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fba65ba5050e1467f4573e5216a3612f7b0ceda35e4a2ba733444f7335da7aa2
BLAKE2b-256 checksum
How to use checksums
38c8a6a9dfe1943cb97a854bb5e26673cc4abad097dbbb4db17db9453628c450
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for pathgate 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page