Skip to main content

A secure MCP server for browsing directories and files with access control

Project description

Directory Browser MCP Server

一个用于浏览目录和文件的MCP (Model Context Protocol) 服务器。

功能特性

  • 📁 目录浏览 - 列出指定目录的内容
  • 📄 文件信息 - 获取文件/目录的详细信息
  • 🔍 权限检查 - 检查路径的访问权限
  • 🛡️ 安全控制 - 基于白名单的目录访问控制

安装

cd directory_browser_mcp
pip install -e .

配置

编辑 config.json 文件来配置允许访问的目录:

{
  "allowed_directories": [
    "/Users/用户名/Documents",
    "/Users/用户名/Desktop",
    "/项目根目录"
  ],
  "show_hidden_files": false,
  "max_entries": 1000
}

使用方法

作为MCP服务器运行

python -m directory_browser_mcp

可用工具

  1. list_directory - 列出目录内容

    • path: 目录路径
    • show_hidden: 是否显示隐藏文件 (可选)
  2. get_file_info - 获取文件详细信息

    • path: 文件或目录路径
  3. check_path_access - 检查路径访问权限

    • path: 要检查的路径

安全特性

  • ✅ 白名单目录访问控制
  • ✅ 路径穿越攻击防护
  • ✅ 文件系统权限检查
  • ✅ 安全错误处理

示例

# 列出目录
{
  "tool": "list_directory",
  "arguments": {
    "path": "/Users/username/Documents",
    "show_hidden": false
  }
}

# 获取文件信息
{
  "tool": "get_file_info",
  "arguments": {
    "path": "/Users/username/Documents/file.txt"
  }
}

# 检查访问权限
{
  "tool": "check_path_access",
  "arguments": {
    "path": "/Users/username/Documents"
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

directory_browser_mcp-0.1.3.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

directory_browser_mcp-0.1.3-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file directory_browser_mcp-0.1.3.tar.gz.

File metadata

  • Download URL: directory_browser_mcp-0.1.3.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for directory_browser_mcp-0.1.3.tar.gz
Algorithm Hash digest
SHA256 41fc20c981f293e41197300152c37a3c465db8a212bdc3183669d09c32b3fafc
MD5 ff7f3f82d4677b73763222842aecdd40
BLAKE2b-256 7bbecc18e9c28fe0bf72196ba50e5b4b6290df12a4259cafa1295deaf338e5f1

See more details on using hashes here.

File details

Details for the file directory_browser_mcp-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for directory_browser_mcp-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 94e81ab866fc37e7575610196ab00aa11fae960491f1d625094e41b64a14f84e
MD5 3d011ddf9e370965bf11cfaf45b1b597
BLAKE2b-256 369d25bc022e85fb62e665f4056b7d40442b95fddcd2f103c20b1021933bb56b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page