新闻事实语料MCP接口文档

接口说明和使用示例

文档概述

本文档详细说明了新闻事实语料MCP接口的使用方法,包括文章数量统计接口和新闻搜索接口。

文章数量统计接口

请求地址: /api/v1/audit_stat/stat
请求方式: GET

请求参数

请求参数 参数类型 是否必传 描述
ts int 时间戳毫秒值
secret string 秘钥

请求示例

URL示例
https://newsdata.peopletech.cn/api/v1/audit_stat/stat?ts=176006496917&secret=aZzAJ53dEKWBght1r0ehEq3QqBRzYxvrvuWXvM1ATHrL4b0AW1Jy010gJnHpotyT

返回参数

参数 类型 描述
totalCount int 总数
avgDayCount int 近14日每日平均数

返回示例

JSON响应
{
    "code": 200,
    "data": {
        "totalCount": 546502,
        "avgDayCount": 137
    },
    "desc": ""
}

新闻事实语料MCP接口

地址: https://newsdata.peopletech.cn/news
工具: search_news

参数

请求参数 参数类型 是否必传 描述
content string 查询内容,标题或正文
apikey string 密钥

请求示例

Python示例
import asyncio
from fastmcp import Client

config = {
    "mcpServers": {
        "server": {
            "url": "https://newsdata.peopletech.cn/news",
            "transport": "streamable-http"
        }
    }
}

# client = Client(config)

async def main():
    async with client:
        print("===== tools ====")
        tools = await client.list_tools()
        print(tools)
        print("===== search_news ====")
        output = await client.call_tool("search_news", {
            "content": "",
            "apikey": "AZZAAJ53dEKWBght1r0ehEq3CqBRzYxvrvuNXvN1ATHrL4bOAMIJyQ1QgJnHpotyT"
        })
        extracted_text = output.content[0].text
        print(extracted_text)

if __name__ == "__main__":
    asyncio.run(main())

返回参数

请求参数 参数类型 描述
id string 文章id
articleId string 文章id
type string 文章类型
title string 标题
content string 正文
categorys string 分类
source string 文章来源
pubTime string 发布时间

返回示例

JSON响应
{
    "code": 200,
    "data": {
        "pageNum": 1,
        "pageSize": 10,
        "totalSize": 709,
        "totalPages": 71,
        "data": [
            {
                "id": "061f93715aa2429392c4c3f6a256ad4b",
                "articleId": "061f93715aa2429392c4c3f6a256ad4b",
                "type": "",
                "title": "“”",
                "content": "

“”

“”

“”“”

", "categorys": "", "source": "", "pubTime": "2023-09-12 00:00:00" }, { "id": "86212fe32cbf4f3e9274c4894f761019", "articleId": "86212fe32cbf4f3e9274c4894f761019", "type": "", "title": "", "content": "

“”

", "categorys": "", "source": "", "pubTime": "2023-09-21 00:00:00" }, { "id": "20a1d0673e8b4340a58eb2d4cece04c1", "articleId": "20a1d0673e8b4340a58eb2d4cece04c1", "type": "", "title": "", "content": "

913

913

913

913

913

", "categorys": "", "source": "", "pubTime": "2023-09-13 17:14:17" } // 更多数据... ] }, "desc": "" }