# MCP Database Filesystem
[English](README_EN.md) | 中文
一个简洁高效的 MCP (Model Context Protocol) 服务器,提供多数据库访问和文件系统操作功能。
## ✨ 主要特性
### 🗄️ 多数据库支持
#### SQL Server
- **SQL 查询执行** - 支持 SELECT 查询
- **SQL 命令执行** - 支持 INSERT/UPDATE/DELETE 操作
- **表结构查询** - 获取表的详细结构信息和字段描述
- **表列表** - 列出数据库中的所有表
#### MySQL
- **MySQL 查询执行** - 支持 MySQL SELECT 查询
- **MySQL 命令执行** - 支持 INSERT/UPDATE/DELETE 操作
- **MySQL 表结构查询** - 获取 MySQL 表的详细结构信息
- **MySQL 表列表** - 列出 MySQL 数据库中的所有表
#### Redis
- **键值操作** - GET/SET/DELETE 键值对
- **键管理** - 列出匹配模式的键
- **服务器信息** - 获取 Redis 服务器状态信息
- **过期设置** - 支持键的过期时间设置
### 📁 文件系统功能
- **文件读取** - 读取文件内容
- **文件写入** - 写入内容到文件
- **目录列表** - 列出目录内容
### 🔒 安全特性
- SQL 注入防护
- 文件系统访问控制
- 环境变量配置
- 权限验证
### 🔄 容错机制
- **优雅降级** - 任何数据库连接失败时不影响其他服务
- **动态重连** - 支持运行时重新连接各种数据库
- **状态监控** - 实时监控所有数据库连接状态
## 🚀 快速开始
### 📋 前置要求
根据您要使用的数据库服务,安装相应的驱动程序:
#### 1. SQL Server (可选)
安装 ODBC Driver for SQL Server
**Windows:**
```bash
# 下载并安装 Microsoft ODBC Driver 17 for SQL Server
# 访问: https://docs.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server
# 或使用 winget 安装
winget install Microsoft.ODBCDriverforSQLServer
```
**macOS:**
```bash
# 使用 Homebrew 安装
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
brew install msodbcsql17 mssql-tools
```
**Linux (Ubuntu/Debian):**
```bash
# 添加 Microsoft 仓库
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
# 安装驱动
sudo apt-get update
sudo apt-get install msodbcsql17
```
#### 2. 验证 ODBC 安装
```bash
# Windows
odbcad32.exe
# macOS/Linux
odbcinst -j
```
#### 2. MySQL (可选)
如果要使用 MySQL 功能,确保 MySQL 服务器可访问。不需要额外的客户端驱动,PyMySQL 已包含在依赖中。
#### 3. Redis (可选)
如果要使用 Redis 功能,确保 Redis 服务器可访问。不需要额外的客户端驱动,redis-py 已包含在依赖中。
### 📦 零安装使用(推荐)
```bash
# 安装 uv(如果尚未安装)
pip install uv
# 直接运行 - 无需克隆仓库!
uvx mcp-db-filesystem@latest
```
### 🔧 配置
在你的 MCP 客户端(如 Claude Desktop、AugmentCode)中添加以下配置:
```json
{
"mcpServers": {
"mcp-db-filesystem": {
"command": "uvx",
"args": ["mcp-db-filesystem@latest"],
"env": {
// SQL Server Configuration (可选)
"MSSQL_SERVER": "localhost",
"MSSQL_DATABASE": "your_database",
"MSSQL_USERNAME": "your_username",
"MSSQL_PASSWORD": "your_password",
"MSSQL_USE_WINDOWS_AUTH": "true",
"MSSQL_PORT": "1433",
"MSSQL_DRIVER": "ODBC Driver 17 for SQL Server",
"MSSQL_CONNECTION_TIMEOUT": "30",
"MSSQL_COMMAND_TIMEOUT": "30",
"MSSQL_POOL_SIZE": "5",
"MSSQL_MAX_OVERFLOW": "10",
"MSSQL_TRUST_SERVER_CERTIFICATE": "true",
"MSSQL_ENCRYPT": "false",
"MSSQL_MULTIPLE_ACTIVE_RESULT_SETS": "true",
"MSSQL_APPLICATION_NAME": "MCP-Db-Filesystem",
// MySQL Configuration (可选)
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_DATABASE": "your_mysql_database",
"MYSQL_USERNAME": "your_mysql_username",
"MYSQL_PASSWORD": "your_mysql_password",
"MYSQL_CHARSET": "utf8mb4",
"MYSQL_CONNECTION_TIMEOUT": "30",
"MYSQL_POOL_SIZE": "5",
"MYSQL_MAX_OVERFLOW": "10",
// Redis Configuration (可选)
"REDIS_HOST": "localhost",
"REDIS_PORT": "6379",
"REDIS_DB": "0",
"REDIS_PASSWORD": "your_redis_password",
"REDIS_SOCKET_TIMEOUT": "30",
"REDIS_CONNECTION_TIMEOUT": "30",
"REDIS_MAX_CONNECTIONS": "10",
// Filesystem Configuration
"FS_ALLOWED_PATHS": "*",
"FS_ALLOWED_EXTENSIONS": "*.*",
"FS_MAX_FILE_SIZE": "1073741824",
"FS_ENABLE_WRITE": "true",
"FS_ENABLE_DELETE": "true",
"FS_IGNORE_FILE_LOCKS": "false",
// Security Configuration
"SECURITY_ENABLE_SQL_INJECTION_PROTECTION": "true",
"SECURITY_MAX_QUERY_LENGTH": "10000",
"SECURITY_ENABLE_QUERY_LOGGING": "true",
"SECURITY_LOG_SENSITIVE_DATA": "false",
// Server Configuration
"SERVER_LOG_LEVEL": "INFO",
"SERVER_DEBUG": "false"
}
}
}
}
```
## 🛠️ 可用工具
### SQL Server 工具
- `sql_query` - 执行 SQL Server SELECT 查询
- `sql_execute` - 执行 SQL Server INSERT/UPDATE/DELETE 命令
- `list_tables` - 列出 SQL Server 数据库中的所有表
- `get_table_schema` - 获取 SQL Server 表的结构信息
- `database_reconnect` - 重新连接 SQL Server
### MySQL 工具
- `mysql_query` - 执行 MySQL SELECT 查询
- `mysql_execute` - 执行 MySQL INSERT/UPDATE/DELETE 命令
- `mysql_list_tables` - 列出 MySQL 数据库中的所有表
- `mysql_get_table_schema` - 获取 MySQL 表的结构信息
- `mysql_reconnect` - 重新连接 MySQL
### Redis 工具
- `redis_get` - 获取 Redis 键值
- `redis_set` - 设置 Redis 键值(支持过期时间)
- `redis_delete` - 删除 Redis 键
- `redis_keys` - 列出匹配模式的 Redis 键
- `redis_info` - 获取 Redis 服务器信息
- `redis_reconnect` - 重新连接 Redis
### 数据库管理工具
- `database_status` - 检查所有数据库连接状态
### 文件系统工具
- `read_file` - 读取文件内容
- `write_file` - 写入文件内容
- `list_directory` - 列出目录内容
- `delete_file` - 删除文件(需要确认)
- `create_directory` - 创建目录
- `delete_file` - 删除文件(需要确认)
- `create_directory` - 创建目录
## 📋 环境变量
### SQL Server 配置
- `MSSQL_SERVER` - SQL Server 服务器地址
- `MSSQL_DATABASE` - 数据库名称
- `MSSQL_USERNAME` - 用户名
- `MSSQL_PASSWORD` - 密码
- `MSSQL_USE_WINDOWS_AUTH` - 是否使用 Windows 身份验证
- `MSSQL_PORT` - SQL Server 端口(默认 1433)
- `MSSQL_DRIVER` - ODBC 驱动名称
- `MSSQL_CONNECTION_TIMEOUT` - 连接超时时间(秒)
- `MSSQL_COMMAND_TIMEOUT` - 命令超时时间(秒)
- `MSSQL_POOL_SIZE` - 连接池大小
- `MSSQL_MAX_OVERFLOW` - 最大溢出连接数
- `MSSQL_TRUST_SERVER_CERTIFICATE` - 是否信任服务器证书
- `MSSQL_ENCRYPT` - 是否加密连接
- `MSSQL_MULTIPLE_ACTIVE_RESULT_SETS` - 是否启用多活动结果集
- `MSSQL_APPLICATION_NAME` - 应用程序名称
### MySQL 配置
- `MYSQL_HOST` - MySQL 服务器地址
- `MYSQL_PORT` - MySQL 端口(默认 3306)
- `MYSQL_DATABASE` - MySQL 数据库名称
- `MYSQL_USERNAME` - MySQL 用户名
- `MYSQL_PASSWORD` - MySQL 密码
- `MYSQL_CHARSET` - 字符集(默认 utf8mb4)
- `MYSQL_CONNECTION_TIMEOUT` - 连接超时时间(秒)
- `MYSQL_POOL_SIZE` - 连接池大小
- `MYSQL_MAX_OVERFLOW` - 最大溢出连接数
### Redis 配置
- `REDIS_HOST` - Redis 服务器地址
- `REDIS_PORT` - Redis 端口(默认 6379)
- `REDIS_DB` - Redis 数据库编号(默认 0)
- `REDIS_PASSWORD` - Redis 密码(可选)
- `REDIS_SOCKET_TIMEOUT` - Socket 超时时间(秒)
- `REDIS_CONNECTION_TIMEOUT` - 连接超时时间(秒)
- `REDIS_MAX_CONNECTIONS` - 最大连接数
### 文件系统配置
- `FS_ALLOWED_PATHS` - 允许访问的路径(`*` 表示所有路径)
- `FS_ALLOWED_EXTENSIONS` - 允许的文件扩展名(`*.*` 表示所有文件)
- `FS_MAX_FILE_SIZE` - 最大文件大小(字节)
- `FS_ENABLE_WRITE` - 是否启用写操作
- `FS_ENABLE_DELETE` - 是否启用删除操作
- `FS_IGNORE_FILE_LOCKS` - 是否忽略文件锁
## 🔧 开发
### 本地开发
```bash
# 克隆仓库
git clone https://github.com/ppengit/mcp-db-filesystem.git
cd mcp-db-filesystem
# 安装依赖
uv sync
# 运行服务器
uv run python -m mcp_db_filesystem server
```
### 测试
```bash
# 运行测试
uv run pytest
# 运行特定测试
uv run pytest tests/test_database.py
```
## 📄 许可证
MIT License - 详见 [LICENSE](LICENSE) 文件。
## 🤝 贡献
欢迎贡献!请提交 Issue 或 Pull Request。
## ❓ 常见问题
### Q: 出现 "No module named 'pyodbc'" 错误
A: 请确保已安装 ODBC Driver for SQL Server,参见上面的前置要求部分。
### Q: 出现 "Data source name not found" 错误
A: 检查 `DB_SERVER` 配置是否正确,确保 SQL Server 服务正在运行。
### Q: 连接超时或拒绝连接
A:
1. 检查 SQL Server 是否启用了 TCP/IP 协议
2. 确认防火墙设置允许连接到 SQL Server 端口(默认1433)
3. 验证用户名和密码是否正确
### Q: 文件系统操作被拒绝
A: 检查 `FS_ALLOWED_PATHS` 和 `FS_ALLOWED_EXTENSIONS` 配置,确保路径和文件类型被允许访问。
## 📞 支持
- GitHub Issues: [https://github.com/ppengit/mcp-db-filesystem/issues](https://github.com/ppengit/mcp-db-filesystem/issues)
## 🔄 更新日志
### v1.0.1
- 🎉 首个稳定版本发布
- ✨ 完整的 SQL Server 数据库支持
- 📁 全面的文件系统操作
- 🔒 增强的安全特性
- 📝 改进的错误处理和日志记录
- 🚀 简化的架构,专注于核心功能
---
**注意**: 此版本专注于核心功能的稳定性和可靠性,提供简洁高效的MCP服务器体验。
Raw data
{
"_id": null,
"home_page": null,
"name": "mcp-db-filesystem",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "cross-platform, database, filesystem, mcp, mysql, redis, server, sqlserver",
"author": null,
"author_email": "PJ <peng.it@qq.com>",
"download_url": "https://files.pythonhosted.org/packages/cd/3a/c5e2743e2748a1517f79000786745392b8806ba8e49ff3b2111bda36c640/mcp_db_filesystem-1.1.3.tar.gz",
"platform": null,
"description": "# MCP Database Filesystem\n\n[English](README_EN.md) | \u4e2d\u6587\n\n\u4e00\u4e2a\u7b80\u6d01\u9ad8\u6548\u7684 MCP (Model Context Protocol) \u670d\u52a1\u5668\uff0c\u63d0\u4f9b\u591a\u6570\u636e\u5e93\u8bbf\u95ee\u548c\u6587\u4ef6\u7cfb\u7edf\u64cd\u4f5c\u529f\u80fd\u3002\n\n## \u2728 \u4e3b\u8981\u7279\u6027\n\n### \ud83d\uddc4\ufe0f \u591a\u6570\u636e\u5e93\u652f\u6301\n\n#### SQL Server\n- **SQL \u67e5\u8be2\u6267\u884c** - \u652f\u6301 SELECT \u67e5\u8be2\n- **SQL \u547d\u4ee4\u6267\u884c** - \u652f\u6301 INSERT/UPDATE/DELETE \u64cd\u4f5c\n- **\u8868\u7ed3\u6784\u67e5\u8be2** - \u83b7\u53d6\u8868\u7684\u8be6\u7ec6\u7ed3\u6784\u4fe1\u606f\u548c\u5b57\u6bb5\u63cf\u8ff0\n- **\u8868\u5217\u8868** - \u5217\u51fa\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868\n\n#### MySQL\n- **MySQL \u67e5\u8be2\u6267\u884c** - \u652f\u6301 MySQL SELECT \u67e5\u8be2\n- **MySQL \u547d\u4ee4\u6267\u884c** - \u652f\u6301 INSERT/UPDATE/DELETE \u64cd\u4f5c\n- **MySQL \u8868\u7ed3\u6784\u67e5\u8be2** - \u83b7\u53d6 MySQL \u8868\u7684\u8be6\u7ec6\u7ed3\u6784\u4fe1\u606f\n- **MySQL \u8868\u5217\u8868** - \u5217\u51fa MySQL \u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868\n\n#### Redis\n- **\u952e\u503c\u64cd\u4f5c** - GET/SET/DELETE \u952e\u503c\u5bf9\n- **\u952e\u7ba1\u7406** - \u5217\u51fa\u5339\u914d\u6a21\u5f0f\u7684\u952e\n- **\u670d\u52a1\u5668\u4fe1\u606f** - \u83b7\u53d6 Redis \u670d\u52a1\u5668\u72b6\u6001\u4fe1\u606f\n- **\u8fc7\u671f\u8bbe\u7f6e** - \u652f\u6301\u952e\u7684\u8fc7\u671f\u65f6\u95f4\u8bbe\u7f6e\n\n### \ud83d\udcc1 \u6587\u4ef6\u7cfb\u7edf\u529f\u80fd\n- **\u6587\u4ef6\u8bfb\u53d6** - \u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9\n- **\u6587\u4ef6\u5199\u5165** - \u5199\u5165\u5185\u5bb9\u5230\u6587\u4ef6\n- **\u76ee\u5f55\u5217\u8868** - \u5217\u51fa\u76ee\u5f55\u5185\u5bb9\n\n### \ud83d\udd12 \u5b89\u5168\u7279\u6027\n- SQL \u6ce8\u5165\u9632\u62a4\n- \u6587\u4ef6\u7cfb\u7edf\u8bbf\u95ee\u63a7\u5236\n- \u73af\u5883\u53d8\u91cf\u914d\u7f6e\n- \u6743\u9650\u9a8c\u8bc1\n\n### \ud83d\udd04 \u5bb9\u9519\u673a\u5236\n- **\u4f18\u96c5\u964d\u7ea7** - \u4efb\u4f55\u6570\u636e\u5e93\u8fde\u63a5\u5931\u8d25\u65f6\u4e0d\u5f71\u54cd\u5176\u4ed6\u670d\u52a1\n- **\u52a8\u6001\u91cd\u8fde** - \u652f\u6301\u8fd0\u884c\u65f6\u91cd\u65b0\u8fde\u63a5\u5404\u79cd\u6570\u636e\u5e93\n- **\u72b6\u6001\u76d1\u63a7** - \u5b9e\u65f6\u76d1\u63a7\u6240\u6709\u6570\u636e\u5e93\u8fde\u63a5\u72b6\u6001\n\n## \ud83d\ude80 \u5feb\u901f\u5f00\u59cb\n\n### \ud83d\udccb \u524d\u7f6e\u8981\u6c42\n\n\u6839\u636e\u60a8\u8981\u4f7f\u7528\u7684\u6570\u636e\u5e93\u670d\u52a1\uff0c\u5b89\u88c5\u76f8\u5e94\u7684\u9a71\u52a8\u7a0b\u5e8f\uff1a\n\n#### 1. SQL Server (\u53ef\u9009)\n\u5b89\u88c5 ODBC Driver for SQL Server\n\n**Windows:**\n```bash\n# \u4e0b\u8f7d\u5e76\u5b89\u88c5 Microsoft ODBC Driver 17 for SQL Server\n# \u8bbf\u95ee: https://docs.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server\n# \u6216\u4f7f\u7528 winget \u5b89\u88c5\nwinget install Microsoft.ODBCDriverforSQLServer\n```\n\n**macOS:**\n```bash\n# \u4f7f\u7528 Homebrew \u5b89\u88c5\nbrew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release\nbrew update\nbrew install msodbcsql17 mssql-tools\n```\n\n**Linux (Ubuntu/Debian):**\n```bash\n# \u6dfb\u52a0 Microsoft \u4ed3\u5e93\ncurl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -\ncurl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list\n\n# \u5b89\u88c5\u9a71\u52a8\nsudo apt-get update\nsudo apt-get install msodbcsql17\n```\n\n#### 2. \u9a8c\u8bc1 ODBC \u5b89\u88c5\n\n```bash\n# Windows\nodbcad32.exe\n\n# macOS/Linux\nodbcinst -j\n```\n\n#### 2. MySQL (\u53ef\u9009)\n\u5982\u679c\u8981\u4f7f\u7528 MySQL \u529f\u80fd\uff0c\u786e\u4fdd MySQL \u670d\u52a1\u5668\u53ef\u8bbf\u95ee\u3002\u4e0d\u9700\u8981\u989d\u5916\u7684\u5ba2\u6237\u7aef\u9a71\u52a8\uff0cPyMySQL \u5df2\u5305\u542b\u5728\u4f9d\u8d56\u4e2d\u3002\n\n#### 3. Redis (\u53ef\u9009)\n\u5982\u679c\u8981\u4f7f\u7528 Redis \u529f\u80fd\uff0c\u786e\u4fdd Redis \u670d\u52a1\u5668\u53ef\u8bbf\u95ee\u3002\u4e0d\u9700\u8981\u989d\u5916\u7684\u5ba2\u6237\u7aef\u9a71\u52a8\uff0credis-py \u5df2\u5305\u542b\u5728\u4f9d\u8d56\u4e2d\u3002\n\n### \ud83d\udce6 \u96f6\u5b89\u88c5\u4f7f\u7528\uff08\u63a8\u8350\uff09\n\n```bash\n# \u5b89\u88c5 uv\uff08\u5982\u679c\u5c1a\u672a\u5b89\u88c5\uff09\npip install uv\n\n# \u76f4\u63a5\u8fd0\u884c - \u65e0\u9700\u514b\u9686\u4ed3\u5e93\uff01\nuvx mcp-db-filesystem@latest\n```\n\n### \ud83d\udd27 \u914d\u7f6e\n\n\u5728\u4f60\u7684 MCP \u5ba2\u6237\u7aef\uff08\u5982 Claude Desktop\u3001AugmentCode\uff09\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u914d\u7f6e\uff1a\n\n```json\n{\n \"mcpServers\": {\n \"mcp-db-filesystem\": {\n \"command\": \"uvx\",\n \"args\": [\"mcp-db-filesystem@latest\"],\n \"env\": {\n // SQL Server Configuration (\u53ef\u9009)\n \"MSSQL_SERVER\": \"localhost\",\n \"MSSQL_DATABASE\": \"your_database\",\n \"MSSQL_USERNAME\": \"your_username\",\n \"MSSQL_PASSWORD\": \"your_password\",\n \"MSSQL_USE_WINDOWS_AUTH\": \"true\",\n \"MSSQL_PORT\": \"1433\",\n \"MSSQL_DRIVER\": \"ODBC Driver 17 for SQL Server\",\n \"MSSQL_CONNECTION_TIMEOUT\": \"30\",\n \"MSSQL_COMMAND_TIMEOUT\": \"30\",\n \"MSSQL_POOL_SIZE\": \"5\",\n \"MSSQL_MAX_OVERFLOW\": \"10\",\n \"MSSQL_TRUST_SERVER_CERTIFICATE\": \"true\",\n \"MSSQL_ENCRYPT\": \"false\",\n \"MSSQL_MULTIPLE_ACTIVE_RESULT_SETS\": \"true\",\n \"MSSQL_APPLICATION_NAME\": \"MCP-Db-Filesystem\",\n\n // MySQL Configuration (\u53ef\u9009)\n \"MYSQL_HOST\": \"localhost\",\n \"MYSQL_PORT\": \"3306\",\n \"MYSQL_DATABASE\": \"your_mysql_database\",\n \"MYSQL_USERNAME\": \"your_mysql_username\",\n \"MYSQL_PASSWORD\": \"your_mysql_password\",\n \"MYSQL_CHARSET\": \"utf8mb4\",\n \"MYSQL_CONNECTION_TIMEOUT\": \"30\",\n \"MYSQL_POOL_SIZE\": \"5\",\n \"MYSQL_MAX_OVERFLOW\": \"10\",\n\n // Redis Configuration (\u53ef\u9009)\n \"REDIS_HOST\": \"localhost\",\n \"REDIS_PORT\": \"6379\",\n \"REDIS_DB\": \"0\",\n \"REDIS_PASSWORD\": \"your_redis_password\",\n \"REDIS_SOCKET_TIMEOUT\": \"30\",\n \"REDIS_CONNECTION_TIMEOUT\": \"30\",\n \"REDIS_MAX_CONNECTIONS\": \"10\",\n\n // Filesystem Configuration\n \"FS_ALLOWED_PATHS\": \"*\",\n \"FS_ALLOWED_EXTENSIONS\": \"*.*\",\n \"FS_MAX_FILE_SIZE\": \"1073741824\",\n \"FS_ENABLE_WRITE\": \"true\",\n \"FS_ENABLE_DELETE\": \"true\",\n \"FS_IGNORE_FILE_LOCKS\": \"false\",\n\n // Security Configuration\n \"SECURITY_ENABLE_SQL_INJECTION_PROTECTION\": \"true\",\n \"SECURITY_MAX_QUERY_LENGTH\": \"10000\",\n \"SECURITY_ENABLE_QUERY_LOGGING\": \"true\",\n \"SECURITY_LOG_SENSITIVE_DATA\": \"false\",\n\n // Server Configuration\n \"SERVER_LOG_LEVEL\": \"INFO\",\n \"SERVER_DEBUG\": \"false\"\n }\n }\n }\n}\n```\n\n## \ud83d\udee0\ufe0f \u53ef\u7528\u5de5\u5177\n\n### SQL Server \u5de5\u5177\n- `sql_query` - \u6267\u884c SQL Server SELECT \u67e5\u8be2\n- `sql_execute` - \u6267\u884c SQL Server INSERT/UPDATE/DELETE \u547d\u4ee4\n- `list_tables` - \u5217\u51fa SQL Server \u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868\n- `get_table_schema` - \u83b7\u53d6 SQL Server \u8868\u7684\u7ed3\u6784\u4fe1\u606f\n- `database_reconnect` - \u91cd\u65b0\u8fde\u63a5 SQL Server\n\n### MySQL \u5de5\u5177\n- `mysql_query` - \u6267\u884c MySQL SELECT \u67e5\u8be2\n- `mysql_execute` - \u6267\u884c MySQL INSERT/UPDATE/DELETE \u547d\u4ee4\n- `mysql_list_tables` - \u5217\u51fa MySQL \u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868\n- `mysql_get_table_schema` - \u83b7\u53d6 MySQL \u8868\u7684\u7ed3\u6784\u4fe1\u606f\n- `mysql_reconnect` - \u91cd\u65b0\u8fde\u63a5 MySQL\n\n### Redis \u5de5\u5177\n- `redis_get` - \u83b7\u53d6 Redis \u952e\u503c\n- `redis_set` - \u8bbe\u7f6e Redis \u952e\u503c\uff08\u652f\u6301\u8fc7\u671f\u65f6\u95f4\uff09\n- `redis_delete` - \u5220\u9664 Redis \u952e\n- `redis_keys` - \u5217\u51fa\u5339\u914d\u6a21\u5f0f\u7684 Redis \u952e\n- `redis_info` - \u83b7\u53d6 Redis \u670d\u52a1\u5668\u4fe1\u606f\n- `redis_reconnect` - \u91cd\u65b0\u8fde\u63a5 Redis\n\n### \u6570\u636e\u5e93\u7ba1\u7406\u5de5\u5177\n- `database_status` - \u68c0\u67e5\u6240\u6709\u6570\u636e\u5e93\u8fde\u63a5\u72b6\u6001\n\n### \u6587\u4ef6\u7cfb\u7edf\u5de5\u5177\n- `read_file` - \u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9\n- `write_file` - \u5199\u5165\u6587\u4ef6\u5185\u5bb9\n- `list_directory` - \u5217\u51fa\u76ee\u5f55\u5185\u5bb9\n- `delete_file` - \u5220\u9664\u6587\u4ef6\uff08\u9700\u8981\u786e\u8ba4\uff09\n- `create_directory` - \u521b\u5efa\u76ee\u5f55\n- `delete_file` - \u5220\u9664\u6587\u4ef6\uff08\u9700\u8981\u786e\u8ba4\uff09\n- `create_directory` - \u521b\u5efa\u76ee\u5f55\n\n## \ud83d\udccb \u73af\u5883\u53d8\u91cf\n\n### SQL Server \u914d\u7f6e\n- `MSSQL_SERVER` - SQL Server \u670d\u52a1\u5668\u5730\u5740\n- `MSSQL_DATABASE` - \u6570\u636e\u5e93\u540d\u79f0\n- `MSSQL_USERNAME` - \u7528\u6237\u540d\n- `MSSQL_PASSWORD` - \u5bc6\u7801\n- `MSSQL_USE_WINDOWS_AUTH` - \u662f\u5426\u4f7f\u7528 Windows \u8eab\u4efd\u9a8c\u8bc1\n- `MSSQL_PORT` - SQL Server \u7aef\u53e3\uff08\u9ed8\u8ba4 1433\uff09\n- `MSSQL_DRIVER` - ODBC \u9a71\u52a8\u540d\u79f0\n- `MSSQL_CONNECTION_TIMEOUT` - \u8fde\u63a5\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff09\n- `MSSQL_COMMAND_TIMEOUT` - \u547d\u4ee4\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff09\n- `MSSQL_POOL_SIZE` - \u8fde\u63a5\u6c60\u5927\u5c0f\n- `MSSQL_MAX_OVERFLOW` - \u6700\u5927\u6ea2\u51fa\u8fde\u63a5\u6570\n- `MSSQL_TRUST_SERVER_CERTIFICATE` - \u662f\u5426\u4fe1\u4efb\u670d\u52a1\u5668\u8bc1\u4e66\n- `MSSQL_ENCRYPT` - \u662f\u5426\u52a0\u5bc6\u8fde\u63a5\n- `MSSQL_MULTIPLE_ACTIVE_RESULT_SETS` - \u662f\u5426\u542f\u7528\u591a\u6d3b\u52a8\u7ed3\u679c\u96c6\n- `MSSQL_APPLICATION_NAME` - \u5e94\u7528\u7a0b\u5e8f\u540d\u79f0\n\n### MySQL \u914d\u7f6e\n- `MYSQL_HOST` - MySQL \u670d\u52a1\u5668\u5730\u5740\n- `MYSQL_PORT` - MySQL \u7aef\u53e3\uff08\u9ed8\u8ba4 3306\uff09\n- `MYSQL_DATABASE` - MySQL \u6570\u636e\u5e93\u540d\u79f0\n- `MYSQL_USERNAME` - MySQL \u7528\u6237\u540d\n- `MYSQL_PASSWORD` - MySQL \u5bc6\u7801\n- `MYSQL_CHARSET` - \u5b57\u7b26\u96c6\uff08\u9ed8\u8ba4 utf8mb4\uff09\n- `MYSQL_CONNECTION_TIMEOUT` - \u8fde\u63a5\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff09\n- `MYSQL_POOL_SIZE` - \u8fde\u63a5\u6c60\u5927\u5c0f\n- `MYSQL_MAX_OVERFLOW` - \u6700\u5927\u6ea2\u51fa\u8fde\u63a5\u6570\n\n### Redis \u914d\u7f6e\n- `REDIS_HOST` - Redis \u670d\u52a1\u5668\u5730\u5740\n- `REDIS_PORT` - Redis \u7aef\u53e3\uff08\u9ed8\u8ba4 6379\uff09\n- `REDIS_DB` - Redis \u6570\u636e\u5e93\u7f16\u53f7\uff08\u9ed8\u8ba4 0\uff09\n- `REDIS_PASSWORD` - Redis \u5bc6\u7801\uff08\u53ef\u9009\uff09\n- `REDIS_SOCKET_TIMEOUT` - Socket \u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff09\n- `REDIS_CONNECTION_TIMEOUT` - \u8fde\u63a5\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff09\n- `REDIS_MAX_CONNECTIONS` - \u6700\u5927\u8fde\u63a5\u6570\n\n### \u6587\u4ef6\u7cfb\u7edf\u914d\u7f6e\n- `FS_ALLOWED_PATHS` - \u5141\u8bb8\u8bbf\u95ee\u7684\u8def\u5f84\uff08`*` \u8868\u793a\u6240\u6709\u8def\u5f84\uff09\n- `FS_ALLOWED_EXTENSIONS` - \u5141\u8bb8\u7684\u6587\u4ef6\u6269\u5c55\u540d\uff08`*.*` \u8868\u793a\u6240\u6709\u6587\u4ef6\uff09\n- `FS_MAX_FILE_SIZE` - \u6700\u5927\u6587\u4ef6\u5927\u5c0f\uff08\u5b57\u8282\uff09\n- `FS_ENABLE_WRITE` - \u662f\u5426\u542f\u7528\u5199\u64cd\u4f5c\n- `FS_ENABLE_DELETE` - \u662f\u5426\u542f\u7528\u5220\u9664\u64cd\u4f5c\n- `FS_IGNORE_FILE_LOCKS` - \u662f\u5426\u5ffd\u7565\u6587\u4ef6\u9501\n\n## \ud83d\udd27 \u5f00\u53d1\n\n### \u672c\u5730\u5f00\u53d1\n\n```bash\n# \u514b\u9686\u4ed3\u5e93\ngit clone https://github.com/ppengit/mcp-db-filesystem.git\ncd mcp-db-filesystem\n\n# \u5b89\u88c5\u4f9d\u8d56\nuv sync\n\n# \u8fd0\u884c\u670d\u52a1\u5668\nuv run python -m mcp_db_filesystem server\n```\n\n### \u6d4b\u8bd5\n\n```bash\n# \u8fd0\u884c\u6d4b\u8bd5\nuv run pytest\n\n# \u8fd0\u884c\u7279\u5b9a\u6d4b\u8bd5\nuv run pytest tests/test_database.py\n```\n\n## \ud83d\udcc4 \u8bb8\u53ef\u8bc1\n\nMIT License - \u8be6\u89c1 [LICENSE](LICENSE) \u6587\u4ef6\u3002\n\n## \ud83e\udd1d \u8d21\u732e\n\n\u6b22\u8fce\u8d21\u732e\uff01\u8bf7\u63d0\u4ea4 Issue \u6216 Pull Request\u3002\n\n## \u2753 \u5e38\u89c1\u95ee\u9898\n\n### Q: \u51fa\u73b0 \"No module named 'pyodbc'\" \u9519\u8bef\nA: \u8bf7\u786e\u4fdd\u5df2\u5b89\u88c5 ODBC Driver for SQL Server\uff0c\u53c2\u89c1\u4e0a\u9762\u7684\u524d\u7f6e\u8981\u6c42\u90e8\u5206\u3002\n\n### Q: \u51fa\u73b0 \"Data source name not found\" \u9519\u8bef\nA: \u68c0\u67e5 `DB_SERVER` \u914d\u7f6e\u662f\u5426\u6b63\u786e\uff0c\u786e\u4fdd SQL Server \u670d\u52a1\u6b63\u5728\u8fd0\u884c\u3002\n\n### Q: \u8fde\u63a5\u8d85\u65f6\u6216\u62d2\u7edd\u8fde\u63a5\nA:\n1. \u68c0\u67e5 SQL Server \u662f\u5426\u542f\u7528\u4e86 TCP/IP \u534f\u8bae\n2. \u786e\u8ba4\u9632\u706b\u5899\u8bbe\u7f6e\u5141\u8bb8\u8fde\u63a5\u5230 SQL Server \u7aef\u53e3\uff08\u9ed8\u8ba41433\uff09\n3. \u9a8c\u8bc1\u7528\u6237\u540d\u548c\u5bc6\u7801\u662f\u5426\u6b63\u786e\n\n### Q: \u6587\u4ef6\u7cfb\u7edf\u64cd\u4f5c\u88ab\u62d2\u7edd\nA: \u68c0\u67e5 `FS_ALLOWED_PATHS` \u548c `FS_ALLOWED_EXTENSIONS` \u914d\u7f6e\uff0c\u786e\u4fdd\u8def\u5f84\u548c\u6587\u4ef6\u7c7b\u578b\u88ab\u5141\u8bb8\u8bbf\u95ee\u3002\n\n## \ud83d\udcde \u652f\u6301\n\n- GitHub Issues: [https://github.com/ppengit/mcp-db-filesystem/issues](https://github.com/ppengit/mcp-db-filesystem/issues)\n\n## \ud83d\udd04 \u66f4\u65b0\u65e5\u5fd7\n\n### v1.0.1\n- \ud83c\udf89 \u9996\u4e2a\u7a33\u5b9a\u7248\u672c\u53d1\u5e03\n- \u2728 \u5b8c\u6574\u7684 SQL Server \u6570\u636e\u5e93\u652f\u6301\n- \ud83d\udcc1 \u5168\u9762\u7684\u6587\u4ef6\u7cfb\u7edf\u64cd\u4f5c\n- \ud83d\udd12 \u589e\u5f3a\u7684\u5b89\u5168\u7279\u6027\n- \ud83d\udcdd \u6539\u8fdb\u7684\u9519\u8bef\u5904\u7406\u548c\u65e5\u5fd7\u8bb0\u5f55\n- \ud83d\ude80 \u7b80\u5316\u7684\u67b6\u6784\uff0c\u4e13\u6ce8\u4e8e\u6838\u5fc3\u529f\u80fd\n\n---\n\n**\u6ce8\u610f**: \u6b64\u7248\u672c\u4e13\u6ce8\u4e8e\u6838\u5fc3\u529f\u80fd\u7684\u7a33\u5b9a\u6027\u548c\u53ef\u9760\u6027\uff0c\u63d0\u4f9b\u7b80\u6d01\u9ad8\u6548\u7684MCP\u670d\u52a1\u5668\u4f53\u9a8c\u3002\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Simple and efficient MCP server for multi-database (SQL Server, MySQL) and Redis access with filesystem operations",
"version": "1.1.3",
"project_urls": {
"Homepage": "https://github.com/ppengit/mcp-db-filesystem",
"Issues": "https://github.com/ppengit/mcp-db-filesystem/issues",
"Repository": "https://github.com/ppengit/mcp-db-filesystem"
},
"split_keywords": [
"cross-platform",
" database",
" filesystem",
" mcp",
" mysql",
" redis",
" server",
" sqlserver"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "31d291ce1312e94b47090567396f45a39237eae8e5fb9ee8137ac725ab1c869c",
"md5": "2b5922f9330612e5675347abbf1b139d",
"sha256": "3b2f68ca93b2ba0d740783fe54581109b39852f2acf9beeb7744e402baa79636"
},
"downloads": -1,
"filename": "mcp_db_filesystem-1.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2b5922f9330612e5675347abbf1b139d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 33457,
"upload_time": "2025-08-27T10:42:40",
"upload_time_iso_8601": "2025-08-27T10:42:40.679831Z",
"url": "https://files.pythonhosted.org/packages/31/d2/91ce1312e94b47090567396f45a39237eae8e5fb9ee8137ac725ab1c869c/mcp_db_filesystem-1.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "cd3ac5e2743e2748a1517f79000786745392b8806ba8e49ff3b2111bda36c640",
"md5": "4e624794ad0e86657b10dd105ea6a20c",
"sha256": "2d7da685b7bd48b90ff0f03ee1fb3bb0eceea8055d95be654a185d6a3e945496"
},
"downloads": -1,
"filename": "mcp_db_filesystem-1.1.3.tar.gz",
"has_sig": false,
"md5_digest": "4e624794ad0e86657b10dd105ea6a20c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 29477,
"upload_time": "2025-08-27T10:42:41",
"upload_time_iso_8601": "2025-08-27T10:42:41.848856Z",
"url": "https://files.pythonhosted.org/packages/cd/3a/c5e2743e2748a1517f79000786745392b8806ba8e49ff3b2111bda36c640/mcp_db_filesystem-1.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-27 10:42:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ppengit",
"github_project": "mcp-db-filesystem",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "mcp-db-filesystem"
}