维基百科文章转换服务

一个基于HTTP SSE的MCP服务器,提供维基百科文章抓取并转换为Markdown格式的功能。

  • by codingaslu
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 codingaslu/http-sse-mcp-starter

使用说明

带维基百科文章工具的MCP服务器

这是一个基于HTTP SSE的MCP(模型上下文协议)服务器,它具有一个用于获取维基百科文章并将其转换为Markdown的工具。

特性

  • 使用FastMCP实现MCP服务器
  • 客户端-服务器通信的服务器发送事件(SSE)
  • 维基百科文章获取工具
  • HTML内容转换为Markdown

需求

  • Python 3.8+
  • requirements.txt中列出的依赖项
  • uv(Python包管理器)

安装

# Clone the repository
git clone https://github.com/codingaslu/http-sse-mcp-starter.git
cd http-sse-mcp-starter

# Install dependencies using uv
uv pip install -r requirements.txt

用法

启动服务器

python server.py

服务器将于启动http://localhost:8000具有以下端点:

  • /sse:用于来自客户端的SSE连接
  • /messages/:用于处理传入的POST消息

使用客户端

# List server capabilities
uv run -- client.py http://localhost:8000/sse

# Fetch a Wikipedia article
uv run -- client.py http://localhost:8000/sse https://en.wikipedia.org/wiki/Python_(programming_language)

MCP服务器功能

MCP服务器提供:

  • 工具:客户端可以调用的函数
  • 资源:客户可用的数据资源
  • 提示:AI助手的预定义提示

这 read_wikipedia_article 该工具从维基百科中获取一篇文章,解析其内容,并将其转换为Markdown格式。

许可证

MIT许可证