mcpField
D
DevTo Agent

DevTo Agent

本地服务
github.com/HeetVekariyaAI 与智能体774 周前更新

关于 DevTo Agent

DevTo Agent 是面向 Dev.to 用户的多 Agent 系统,可自动处理文章与账户相关任务。它结合 Google ADK Agent 和 Dev.to API,并提供 A2A 与 MCP 接口。

主要功能

  1. 01按页、标签或作者获取文章
  2. 02生成并发布 Markdown 文章
  3. 03获取个人资料和阅读列表
  4. 04管理评论与关注者
  5. 05支持 SSE 和 STDIO 通信

适用场景

  1. 01查找特定标签的 Dev.to 文章
  2. 02起草并发布 Markdown 帖子
  3. 03获取账户资料和已保存文章

MCP 相关

其 MCP 服务向 MCP 客户端提供 Dev.to 文章、发布、个人资料和阅读列表工具,并支持 SSE 与 STDIO 接口。

配置

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

暂未收录安装方式

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

代码仓库

工具

还没有获取到工具列表

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

详细介绍

DevTo Agent

一个功能全面的多 Agent 系统,用于与 Dev.to(DevTo)平台交互,使用 Google ADK(Agent Development Kit)和 Model Context Protocol(MCP)构建。该项目通过 Agent-to-Agent(A2A)通信和 MCP 服务实现,支持在 Dev.to 上自动创建内容、管理文章以及与用户个人资料交互。

你可以在这里查看配套博客

项目概览

该项目实现了一种先进的 Agent 架构,可用于:

  • 按标签或作者获取和管理 Dev.to 文章
  • 生成 Markdown 内容并发布到 Dev.to
  • 获取用户个人资料和阅读列表
  • 管理文章评论和关注者
  • 提供 SSE(Server-Sent Events)和 STDIO 接口,以满足不同的集成需求

目录

架构概览

该项目采用模块化架构,包含三种主要通信模式:

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Client App    │───▶│  A2A Server     │───▶│   DevTo API     │
│   (main.py)     │    │ (devto_agent)   │    │                 │
└─────────────────┘    └─────────────────┘    └─────────────────┘
         │                       │                       ▲
         │                       ▼                       │
         │              ┌─────────────────┐              │
         └─────────────▶│   MCP Server    │──────────────┘
                        │ (SSE/STDIO)     │
                        └─────────────────┘
核心组件:
  1. A2A Agent 服务:使用 Google ADK 提供高级 Agent 接口
  2. MCP 服务:使用 Model Context Protocol 提供底层工具接口
  3. DevTo 服务:直接集成 Dev.to API
  4. 工具连接器:连接 Agent 与 MCP 服务的桥梁

项目结构

devto-agent/
├── a2a_servers/              # Agent-to-Agent server implementations
│   ├── agent_server/         # Individual agent definitions
│   │   ├── devto_agent.py   # Main DevTo agent server
│   │   ├── host_agent.py    # Host agent coordinator
│   │   └── utils.py         # Agent utilities
│   ├── agents/              # Agent base classes and implementations
│   │   ├── adk_agent.py     # Google ADK agent wrapper
│   │   └── utils/           # Agent utilities
│   └── common/              # Shared components
│       ├── client/          # A2A client implementations
│       ├── server/          # A2A server implementations
│       └── types.py         # Common type definitions
├── connector/               # Tool connectors
│   └── tools/
│       └── devto_tools.py   # DevTo MCP tool connector
├── mcp_servers/             # Model Context Protocol servers
│   ├── sse/                 # Server-Sent Events implementation
│   │   └── devto_server.py  # SSE-based MCP server
│   └── stdio/               # Standard I/O implementation
│       └── devto_server.py  # STDIO-based MCP server
├── services/                # Core business logic
│   └── devto_service.py     # DevTo API service wrapper
├── test/                    # Test files
├── main.py                  # Main client application
└── pyproject.toml          # Project dependencies

组件详情

1. A2A 服务(a2a_servers/)

用途:使用 Google ADK 框架实现高级 Agent 接口。

核心文件:
  • devto_agent.py:主要的 DevTo Agent,负责:

    • 为 DevTo 文章生成内容
    • 获取和管理文章
    • 用户个人资料操作
    • 支持 Markdown 的文章发布
  • host_agent.py:可管理多个子 Agent 的协调 Agent

  • adk_agent.py:将 Google ADK 与 MCP 工具集成的封装类

2. MCP 服务(mcp_servers/)

用途:使用 Model Context Protocol 提供底层工具接口。

SSE 实现(sse/devto_server.py):
# Creates a Starlette web application with:
# - GET /sse: Server-Sent Events endpoint for real-time communication
# - POST /messages/: Message posting endpoint for client commands
3. DevTo 服务(services/devto_service.py)

用途:直接集成 DevTo API。

核心方法:
class DevToService:
    def get_articles(page, per_page)           # Fetch paginated articles
    def get_articles_by_tag(tag)               # Filter by single tag
    def get_articles_by_tags(tags)             # Filter by multiple tags
    def get_article_content(article_id)        # Get full article content
    def post_article(title, body, tags)        # Create new article
    def get_user()                             # Current user info
    def get_user_articles()                    # User's articles
    def get_user_reading_list()                # User's saved articles
    def get_article_comments(article_id)       # Article comments
4. 工具连接器(connector/tools/)

用途:连接 A2A Agent 与 MCP 服务的桥梁。

DevTo 工具连接器:
  • 建立与 MCP 服务的连接
  • 为 Agent 提供异步工具接口
  • 管理连接的生命周期

设置和安装

先决条件
  • Python 3.10 或更高版本
  • 用于运行服务的 UVicorn
  • DevTo API 密钥
  • Google API 密钥(用于 Agent 功能)
安装步骤
  1. 克隆仓库:

    git clone https://github.com/HeetVekariya/devto-agent.git
    cd devto-agent
    
  2. 配置环境: 在项目根目录中创建 .env 文件:

    DEVTO_API_KEY=your_devto_api_key_here
    DEVTO_BASE_URL=https://dev.to/api
    GOOGLE_API_KEY=your_google_api_key_here
    
  3. 安装依赖项:

    uv pip install -e .
    
  4. 启动 Devto MCP 服务

    uv run mcp_servers/sse/devto_server.py
    
  5. 启动 Devto Agent

    uv run a2a_servers/agent_server/devto_agent.py
    
  6. 启动 Host Agent:

    uv run a2a_servers/agent_server/host_agent.py 
    
  7. 运行客户端应用程序:

    uv run main.py
    
交互示例
获取用户个人资料:
# Request:
"Retrieve my profile details"

# The agent response:
Here are your profile details:
{
  "type_of": "user",
  "id": ...,
  "username": "heetvekariya",
  "name": "HeetVekariya",
  "twitter_username": "heet_2104",
  "github_username": "HeetVekariya",
  "summary": "A Tech person doing Non-Tech things.",
  "location": "",
  "website_url": "https://heet-vekariya.vercel.app/",
  "joined_at": "Oct 12, 2023",
  "profile_image": "....jpeg"
}
获取文章:
# Request: 
"How many blogs I have published on devto ?"

# The agent response:
You have published 11 articles on Dev.to.

API 参考

A2A Agent 技能

DevTo Agent 提供以下技能:

  1. SKILL_DEVTO_CONTENT:为 DevTo 文章生成 Markdown 内容
  2. SKILL_DEVTO_ARTICLES:获取文章,可选择是否按标签筛选
  3. SKILL_DEVTO_USER_INFO:获取用户个人资料和统计信息
  4. SKILL_POST_DEVTO_ARTICLE:创建并发布文章
MCP 工具

可通过 MCP 服务使用:

  • get_articles(page, per_page):分页获取文章
  • get_articles_by_tag(tag):按标签筛选
  • get_article_content(article_id):获取完整文章内容
  • post_article(title, body, tags):发布文章
  • get_user():获取用户个人资料信息
  • get_user_reading_list():获取已保存的文章

评论

支持 Markdown

第一次接触 MCP?

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

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