# File Tools MCP 技能包 该技能包提供文件与 URL 的 Base64 处理能力,主要用于将文件内容转换为 JSON 字符串或 data URI,供 MCP Agent 直接调用。 ## 功能 - 文件对象转 JSON 字符串 - 文件对象转 data URI(Base64) - 文件路径转 data URI(Base64) - 文件 URL 转 data URI(Base64) ## 工具列表 ### 1. file_to_json 将文件对象转储为 JSON 字符串。 **入参** ```json { "file": { "name": "example.txt", "type": "text/plain", "size": 123, "last_modified": 1700000000, "content_base64": "SGVsbG8=" } } ``` 也可以使用 `file_path`: ```json { "file_path": "e:\\lzwcai-mcp\\README.md" } ``` ### 2. file_to_data_uri 将文件对象转换为 data URI。 **入参** ```json { "file": { "name": "hello.txt", "content_base64": "SGVsbG8=" }, "type": "text/plain" } ``` ### 3. file_path_to_data_uri 将本地文件路径转换为 data URI。 **入参** ```json { "file_path": "e:\\lzwcai-mcp\\README.md", "type": "text/plain" } ``` ### 4. url_to_data_uri 将文件 URL 转换为 data URI。 **入参** ```json { "url": "https://example.com/image.png" } ``` ## 启动方式 ### uvx ```json { "mcpServers": { "file-tools-mcp": { "command": "uvx", "type": "stdio", "args": [ "lzwcai-mcpskills-file-tools-mcp" ], "env": {} } } } ``` ### python ```json { "mcpServers": { "file-tools-mcp": { "disabled": false, "type": "stdio", "timeout": 30, "command": "python", "args": [ "-m", "file_tools.main" ] } } } ```