mcpField
W
Wikipedia MCP Server

Wikipedia MCP Server

本地服务
github.com/simakovvv记忆与知识080 周前更新

关于 Wikipedia MCP Server

这是一个使用 AI 模型搜索 Wikipedia 条目,并评估或分析单篇条目的服务。搜索结果以流式进度返回,可选择支持的模型;运行需要 OpenRouter 凭据。

主要功能

  1. 01按主题搜索 Wikipedia 条目
  2. 02流式返回搜索进度与结果
  3. 03评估条目相关性
  4. 04生成条目分析
  5. 05选择支持的 AI 模型

适用场景

  1. 01查找研究主题相关的 Wikipedia 条目
  2. 02评估条目与查询的相关性
  3. 03生成条目分析

MCP 相关

README 介绍了 HTTP 端点和 SSE 响应,但未说明 MCP 工具或协议集成。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

Wikipedia MCP 服务

使用 AI 模型搜索和分析 Wikipedia 文章的服务。

API 参考

搜索文章

端点:/search 方法:POST Content-Type:application/json

请求正文:

{
    "topic": "string",
    "limit": 5,  // optional, default: 5
    "model": "gpt-3.5-turbo"  // optional
}

响应为 Server-Sent Events(SSE)流,包含以下事件类型:

  1. 开始事件:
{
    "status": "started"
}
  1. 处理中事件(每篇文章发送一次):
{
    "status": "processing",
    "article": {
        "title": "string",
        "url": "string",
        "snippet": "string",
        "relevance_score": float
    }
}
  1. 完成事件:
{
    "status": "completed"
}
  1. 错误事件(发生问题时):
{
    "status": "error",
    "error": "error message"
}
评估文章

端点:/evaluate 方法:POST Content-Type:application/json

请求正文:

{
    "article": {
        "title": "string",
        "snippet": "string",
        "url": "string"
    },
    "model": "gpt-3.5-turbo"  // optional
}

响应:

{
    "relevance": "string",
    "article": {
        "title": "string",
        "snippet": "string",
        "url": "string"
    }
}
分析文章

端点:/analyze 方法:POST Content-Type:application/json

请求正文:

{
    "article": {
        "title": "string",
        "snippet": "string",
        "url": "string"
    },
    "model": "gpt-3.5-turbo"  // optional
}

响应:

{
    "analysis": "string",
    "article": {
        "title": "string",
        "snippet": "string",
        "url": "string"
    }
}
服务统计信息

端点:/stats 方法:GET

响应:

{
    "total_requests": int,
    "endpoints": {
        "search": int,
        "evaluate": int,
        "analyze": int
    },
    "models": {
        "gpt-3.5-turbo": int,
        "gpt-4": int,
        "claude-2": int,
        "mistral-7b": int
    },
    "errors": int,
    "last_update": timestamp
}

环境变量

必需:

  • OPENROUTER_API_KEY:OpenRouter 的 API 密钥

可选:

  • SERVER_TIMEOUT:服务超时时间,单位为秒(默认值:300)
  • KEEPALIVE_TIMEOUT:保持连接超时时间,单位为秒(默认值:60)
  • MAX_CONNECTIONS:最大并发连接数(默认值:100)

运行服务

  1. 安装依赖项:
pip install -r requirements.txt
  1. 设置环境变量:
export OPENROUTER_API_KEY=your_api_key
  1. 运行服务:
python wiki_mcp_server.py

服务将在 http://localhost:8000 启动

集成示例

使用 SSE 客户端的 Python 示例
from sseclient import SSEClient
import json

def search_articles(topic, max_results=3):
    url = "http://localhost:8000/search"
    headers = {
        "Content-Type": "application/json",
        "Accept": "text/event-stream"
    }
    payload = {
        "topic": topic,
        "limit": max_results,
        "model": "gpt-3.5-turbo"
    }
    
    try:
        response = requests.post(url, 
                               json=payload,
                               headers=headers, 
                               stream=True)
        
        if response.status_code != 200:
            print(f"Error: {response.status_code}")
            print(response.text)
            return
            
        client = SSEClient(response)
        for event in client.events():
            try:
                data = json.loads(event.data)
                print(f"Event: {data}")
            except json.JSONDecodeError as e:
                print(f"Error parsing event data: {e}")
                
    except Exception as e:
        print(f"Error: {e}")

# Example usage
search_articles("King penguin", 3)
Curl 示例
curl -X POST http://localhost:8000/search \
  -H "Content-Type: application/json" \
  -H "Accept: text/event-stream" \
  -d '{"topic": "King penguin", "limit": 3}'

可用模型

服务支持以下 AI 模型:

  • gpt-3.5-turbo(默认)
  • gpt-4
  • claude-2
  • mistral-7b

许可证

MIT 许可证

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。