大家好,我是 Ai 学习的老章
推荐一个实用的项目,最近更新了 MCP 服务,我在本地 Cherry Studio 试了一下,效果还行。
MarkItDown
MarkItDown是一个轻量级的 Python 工具,用于将各种文件转换为 Markdown,以便与 LLMs 和相关的文本分析管道一起使用,将重要的文档结构和内容作为 Markdown 保留(包括:标题、列表、表格、链接等)。
项目地址:https://github.com/microsoft/markitdown
目前,MarkItDown支持:
PDF
PowerPoint
Word
Excel
图像(EXIF 元数据和 OCR)
音频(EXIF 元数据和语音转录)
HTML
基于文本的格式(CSV,JSON,XML)
ZIP 文件(遍历内容)
Youtube 链接
EPubs
直接使用 pip:
pip install 'markitdown[all]'
或从源安装:
git clone git@github.com:microsoft/markitdown.git cd markitdown pip install -e 'packages/markitdown[all]'使用命令行:
markitdown path-to-file.pdf > document.md或使用-o指定输出文件:
markitdown path-to-file.pdf -o document.md通过管道传输内容:
cat path-to-file.pdf | markitdownPython 接口Python 中的基本用法:
from markitdown import MarkItDown md = MarkItDown(enable_plugins=False) # Set to True to enable plugins result = md.convert("test.xlsx") print(result.text_content)Python 中的 Document Intelligence 转换:
from markitdown import MarkItDown md = MarkItDown(docintel_endpoint=" " ) result = md.convert("test.pdf") print(result.text_content)若要将大型语言模型用于图像描述,请提供llm_client和llm_model:
from markitdown import MarkItDown from openai import OpenAI client = OpenAI() md = MarkItDown(llm_client=client, llm_model="gpt-4o") result = md.convert("example.jpg") print(result.text_content)以上都是基础功能
今天我们重点看看 MarkItDown 刚刚新增的 MCP(模型上下文协议)服务器,用于与 LLM Claude Desktop 等应用程序集成。
安装
使用 pip:
pip install markitdown-mcp用法要运行 MCP 服务器,请使用 STDIO(默认),使用以下命令:
markitdown-mcp要使用 SSE 运行 MCP 服务器,请使用以下命令:
markitdown-mcp --sse --host 127.0.0.1 --port 3001Cherry Studio的配置如下,更详细介绍可以看看我之前的文章
命令那里如果直接填写 markitdown-mcp 报错的话,可以用 whereis 看一下自己的 markitdown-mcp 安装位置
whereis markitdown-mcp /Users/zhangbeihai/miniconda/envs/morta/bin/markitdown-mcp使用时,在对话框下面选中该 MCP 即可
结果:
制作不易,如果这篇文章觉得对你有用,可否点个关注。给我个三连击:点赞、转发和在看。若可以再给我加个,谢谢你看我的文章,我们下篇再见!
特别声明:以上内容(如有图片或视频亦包括在内)为自媒体平台“网易号”用户上传并发布,本平台仅提供信息存储服务。
Notice: The content above (including the pictures and videos if any) is uploaded and posted by a user of NetEase Hao, which is a social media platform and only provides information storage services.