MCP News Server

by eluc1a

新闻-mcp MCP 服务器

mcp新闻服务器

成分

资源

服务器通过资源 URI 公开存储在数据库中的新闻文章:

  • news://{category}/{limit} :检索给定类别的最新文章列表。
    • {category} :按类别过滤文章(例如, techdata_sciencenews )。完整列表请参阅工具说明。
    • {limit} (可选,默认为 10):指定要返回的最大文章数量。
  • 每篇返回的文章都包含标题、链接、发布日期和来源。

提示

服务器目前未公开任何提示。(摘要逻辑存在于内部,但无法通过 MCP 提示使用)。

工具

服务器实现了一个工具:

  • summarize_news :从数据库中检索原始新闻文章,允许客户端(LLM)对其进行总结。
    • 采用可选的category (字符串)和limit (整数,默认 20)参数。
    • 返回文章字典列表,每个字典包含idtitlelinkpublishedsourcecontent
    • 可用类别: techdata_sciencellm_toolscybersecuritylinuxaudio_dspstartupsnewsscienceresearchpolicy

配置

该服务器依赖于通过DATABASE_URL环境变量配置的 PostgreSQL 数据库(默认为postgresql://localhost/mcp_news )。

news_gatherer.py脚本(旨在单独运行/安排)从各种 RSS 提要填充数据库。

摘要逻辑(内部,不通过 MCP 公开)使用 OpenAI API,通过OPENAI_API_KEY环境变量进行配置。

其他配置(通过环境变量或默认值):

  • LOOKBACK_HOURSnews_gatherer.py回溯多久以前查找新文章(默认值:6)。
  • SUMMARY_WORD_TARGET :内部摘要的目标字数(默认值:500)。
  • MAX_ARTICLES_PER_SUMMARY :一批摘要中包含的最大文章数(默认值:25)。
  • KEYWORD_FILTER :内部摘要逻辑使用的关键字。

快速入门

安装

克劳德桌面

在 MacOS 上: ~/Library/Application\ Support/Claude/claude_desktop_config.json在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json

发展

构建和发布

准备分发包:

  1. 同步依赖项并更新锁文件:
uv sync
  1. 构建软件包分发版:
uv build

这将在dist/目录中创建源和轮子分布。

  1. 发布到 PyPI:
uv publish

注意:您需要通过环境变量或命令标志设置 PyPI 凭据:

  • 令牌: --tokenUV_PUBLISH_TOKEN
  • 或用户名/密码: --username / UV_PUBLISH_USERNAME--password / UV_PUBLISH_PASSWORD

调试

由于 MCP 服务器通过 stdio 运行,调试起来可能比较困难。为了获得最佳调试体验,我们强烈建议使用MCP Inspector

您可以使用以下命令通过npm启动 MCP Inspector:

npx @modelcontextprotocol/inspector uv --directory ~/dev/news-mcp run news-mcp

启动后,检查器将显示一个 URL,您可以在浏览器中访问该 URL 以开始调试。

-
security - not tested
-
license - not tested
-
quality - not tested

该服务器提供对各种类别的新闻文章的访问,包括技术、数据科学、网络安全等,允许检索和总结最新内容。

  1. Components
    1. Resources
    2. Prompts
    3. Tools
  2. Configuration
    1. Quickstart
      1. Install
    2. Development
      1. Building and Publishing
      2. Debugging

    Related MCP Servers

    • A
      security
      F
      license
      A
      quality
      This server allows users to perform web searches using Perplexity AI, providing a tool for retrieving search results through a simple API interface.
      Last updated -
      1
      2
      TypeScript
    • A
      security
      A
      license
      A
      quality
      A server allowing interaction with Reddit via the public API, enabling browsing frontpage posts, retrieving subreddit details, and reading post comments through a Model Context Protocol.
      Last updated -
      8
      30
      Python
      MIT License
      • Apple
      • Linux
    • A
      security
      A
      license
      A
      quality
      A server that enhances AI assistants with the ability to update your JSON Resume by analyzing your coding projects, automatically extracting skills and generating professional descriptions.
      Last updated -
      3
      216
      28
      TypeScript
      The Unlicense
      • Apple
      • Linux
    • -
      security
      A
      license
      -
      quality
      A server that allows AI assistants to search for research papers, read their content, and access related code repositories through the PapersWithCode API.
      Last updated -
      4
      Python
      MIT License

    View all related MCP servers

    ID: 9vuy62f77m