Python_Scripts_MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Python_Scripts_MCP Generate a directory tree of my project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
AgentTools — Python 脚本工具集 (MCP Server)
通过 MCP (Model Context Protocol) 将本地 Python 工具脚本暴露给 AI 客户端(如 Claude Desktop)调用的工具集。
📦 功能概述
工具 | 功能 | 适用场景 |
tree_to_txt | 扫描目录生成文件树,保存为文本文件 | 项目结构概览、文档编写 |
xlsx_to_txt | 读取所有 | 将表格数据提供给 AI 处理 |
python_to_txt | 提取所有 | 代码审查、AI 上下文准备 |
text_to_txt | 自动检测编码,合并所有文本文件 | 文档汇总、语料整理 |
所有工具在扫描目录时自动跳过 .venv、__pycache__、.git 等目录,并尊重 .gitignore 配置。
Related MCP server: Skillz
🚀 快速开始
1. 安装依赖
本项目使用 uv 管理依赖:
uv sync2. 配置 MCP 客户端
将以下 JSON 添加到你的 MCP 客户端配置中(如 Claude Desktop claude_desktop_config.json):
{
"mcpServers": {
"python-script-runner": {
"command": "path\\to\\.venv\\Scripts\\python.exe",
"args": [
"path\\to\\mcp_server.py"
]
}
}
}⚠️ 请将
path\\to\\替换为你的实际项目路径。
3. 运行测试
python mcp_server.py🛠️ 工具详情
tree_to_txt
python tree_to_txt.py # 扫描当前目录
python tree_to_txt.py -d /path/to/project # 指定目录
python tree_to_txt.py -o tree.txt # 自定义输出文件名xlsx_to_txt
python xlsx_to_txt.py # 读取当前目录所有 xlsx
python xlsx_to_txt.py --raw-formulas # 提取公式原文
python xlsx_to_txt.py --max-rows 100 # 限制行数python_to_txt
python python_to_txt.py # 提取所有 .py 文件text_to_txt
python text_to_txt.py # 合并所有文本文件📄 LICENSE
本项目基于 MIT License 开源。
Available Tools
5 toolsmainA
简单的 Hello World 测试脚本。输出欢迎信息,用于验证 Python 环境是否正常工作。无需参数。
Inputs: args.
python_to_txtA
扫描当前目录下所有 .py 文件(递归),提取每个文件的代码内容,合并输出到一个文本文件中。格式:每个文件以【相对路径】和【代码】标记分隔。适用于:代码审查、准备 AI 上下文输入、代码汇总存档。无参数,默认扫描当前目录,输出到 output_py_files.txt。自动跳过 .venv、pycache、.git 目录及 .gitignore 中忽略的内容。
Inputs: args.
text_to_txtA
扫描当前目录下所有文本文件(自动检测 UTF-8/UTF-16/GBK/Latin-1 编码),将文件内容合并输出到一个文本文件中。格式:每个文件以【文件名】标记分隔。适用于:文档汇总、语料准备、文本分析、合并散落的文本资料。无参数,默认扫描当前目录,跳过自身输出文件,输出到 merged_texts.txt。自动跳过 .venv 目录及 .gitignore 中忽略的内容。
Inputs: args.
tree_to_txtA
扫描指定目录(默认为当前目录)生成完整目录文件树,保存到文本文件中。适用于:项目结构概览、文档编写、了解目录层级关系。参数: -d <目录路径> 指定扫描目录(默认当前目录);-o <文件名> 指定输出文件(默认 file_tree.txt)。自动跳过 .venv、pycache、.git 目录及 .gitignore 中忽略的内容。
Inputs: args.
xlsx_to_txtA
扫描指定目录下所有 .xlsx Excel 文件,生成文件树并提取每个文件的所有 Sheet 内容,以表格格式输出到文本文件。自动过滤全空行/列。适用于:将 Excel 数据转换为 AI 可读的纯文本格式、批量提取表格数据。参数: -d <目录路径> 指定扫描目录(默认当前目录);-o <文件名> 指定输出文件(默认 xlsx_contents.txt);--raw-formulas 提取公式原文(默认提取计算后的值);--max-rows <行数> 限制每个 Sheet 最大读取行数。自动跳过 .venv 目录及 .gitignore 中忽略的内容。
Inputs: args.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool targets a distinct source format (Excel, Python, general text, directory tree), and main is clearly a test script. However, python_to_txt and text_to_txt both process .py files, which could cause minor confusion about which to use for a given task.
Four of the five tools follow a consistent <source>_to_txt naming pattern. The exception is main, which breaks the convention but is understandable as a simple test script.
With five tools, the server is well-scoped for its purpose. Each tool serves a clear utility function, and there are no redundant or unnecessary entries.
The server covers conversion of common source types to text, including Excel, Python, and general text files, plus directory tree export. Minor gaps include lack of support for other document formats (PDF, Word) and no option to process individual files rather than directories.
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
MCP server that lets AI assistants use all OneSchema features exposed via the public API.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides a complete end-to-end MCP server implementation with file system tools, web scraping capabilities, and system information access. Includes ready-to-use configuration files and integration examples for Claude Desktop, ChatGPT, and other AI models.6MIT
- AlicenseNot gradedqualityNot gradedmaintenanceAn MCP server that transforms Claude-style skills and resources into callable tools for any MCP-compatible agent or client. It automatically discovers, exposes, and executes scripts from skills organized in local directories or packaged archives.MIT
- AlicenseNot gradedqualityDmaintenanceA dead simple MCP server for exposing your app functions to AI agents like Claude Desktop.6MIT
- FlicenseNot gradedqualityDmaintenanceA simple MCP server that provides basic utility tools for text manipulation, file operations, and calculations, intended to be connected to Claude AI desktop app.-