About Toutiao MCP Server
Toutiao MCP Server is an MCP server published by IronRookieCoder in the Developer Tools category: 基于 MCP 的今日头条创作者平台服务,使 AI 助手能够通过标准化协议完成内容发布、管理和数据分析。.
The repository has 8 stars and 1 forks, with the last commit 7 months ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.
Install
git clone https://github.com/IronRookieCoder/toutiao-mcp-serverThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Ask AI
Ask AI about Toutiao MCP Server
Powered by Claude · Grounded in docs
Security checks
Static checks derived from the repository 5 days ago. Heuristics on the source, not an audit.
- ✓README presentThe repository ships documentation.
- !License declaredNo license file. Legally you have no right to use it in a product.
- ✓Tests presentA test suite exists in the repository.
- ✓Dependencies pinnedA lockfile pins dependency versions.
- ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.
1 check has not been run yet.
README
今日头条 MCP Server
基于 Model Context Protocol 的今日头条创作者平台服务,使 AI 助手能够通过标准化协议完成内容发布、管理和数据分析。
功能
认证管理
login_with_credentials— 账密登录(浏览器自动化,支持人工补充验证码)check_login_status— 检查登录状态delete_cookies— 删除 Cookie,重置登录
内容发布
publish_article— 发布图文文章(标题、正文、图片、标签、分类、封面、原创标记)publish_micro_post— 发布微头条(文本、图片最多 9 张、话题)save_micro_post_draft— 保存微头条草稿
内容管理
get_article_list— 获取内容列表(支持 all/published/draft/review 筛选)delete_article— 删除文章或草稿
数据分析
get_account_overview— 账户数据概览(粉丝、阅读、获赞)get_article_stats— 单篇文章统计(阅读、点赞、评论、转发)generate_report— 生成分析报告(日报/周报/月报)
技术栈
| 组件 | 选型 |
|---|---|
| 语言 | Go 1.25+ |
| MCP SDK | github.com/modelcontextprotocol/go-sdk |
| 浏览器自动化 | github.com/go-rod/rod + github.com/xpzouying/headless_browser |
| HTTP 框架 | github.com/gin-gonic/gin |
| 日志 | github.com/sirupsen/logrus |
快速开始
编译
go build -o toutiao-mcp-server.exe .
运行
# 默认端口 8080
./toutiao-mcp-server
# 指定端口
./toutiao-mcp-server -port 9000
MCP 客户端配置
{
"mcpServers": {
"toutiao": {
"url": "http://localhost:8080/mcp"
}
}
}
API 端点
服务同时提供 MCP 协议和 REST API 两种接入方式。
MCP
POST /mcp— MCP Streamable HTTP 端点
REST API
| 方法 | 路径 | 说明 |
|---|---|---|
| POST | /api/v1/login |
登录 |
| GET | /api/v1/login/status |
检查登录状态 |
| DELETE | /api/v1/login/cookies |
删除 Cookie |
| POST | /api/v1/publish/article |
发布文章 |
| POST | /api/v1/publish/micro |
发布微头条 |
| POST | /api/v1/publish/micro/draft |
保存微头条草稿 |
| GET | /api/v1/articles |
获取文章列表 |
| POST | /api/v1/articles/delete |
删除文章 |
| GET | /api/v1/analytics/overview |
账户概览 |
| GET | /api/v1/analytics/article |
文章统计 |
| GET | /api/v1/analytics/report |
生成报告 |
| GET | /health |
健康检查 |
项目结构
toutiao-mcp-server/
├── main.go # 入口
├── app_server.go # AppServer 聚合(Service + MCP + HTTP)
├── mcp_server.go # MCP 工具注册、参数结构体、panic 恢复
├── mcp_handlers.go # MCP handler(参数校验 + 调用 Service)
├── handlers_api.go # REST API handler
├── routes.go # 路由配置
├── service.go # 业务编排层
├── types.go # 公共类型(MCPToolResult 等)
├── middleware.go # CORS、错误恢复
├── configs/
│ ├── urls.go # URL 常量
│ ├── content.go # 内容限制常量
│ └── browser.go # 浏览器配置
├── cookies/
│ └── cookies.go # Cookier 接口 + FileCookieStore
├── browser/
│ └── browser.go # 浏览器工厂(Option 模式 + Cookie 自动注入)
├── toutiao/
│ ├── login.go # 登录流程
│ ├── publish_micro.go # 微头条发布 + 参数校验
│ ├── publish_article.go # 文章发布 + 参数校验
│ ├── draft_micro.go # 微头条草稿保存(HTTP API)
│ ├── article_list.go # 文章列表 + 删除(HTTP API)
│ ├── analytics.go # 数据分析(HTTP API)
│ ├── navigate.go # 页面导航辅助
│ ├── selectors.go # 页面选择器常量
│ └── types.go # 业务层类型
└── pkg/downloader/
└── image.go # 图片下载与校验
环境变量
| 变量 | 说明 | 默认值 |
|---|---|---|
TOUTIAO_COOKIES_PATH |
Cookie 文件路径 | cookies.json |
TOUTIAO_PROXY |
代理地址 | 无 |
测试
go test ./...
README fetched from the repository 5 days ago. The original is authoritative.