About
基于 MCP 的今日头条创作者平台服务,使 AI 助手能够通过标准化协议完成内容发布、管理和数据分析。
README
基于 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 ./...
Installing Toutiao
This server has no published package — it is built from source. Open the repository and follow its README.
▸ github.com/IronRookieCoder/toutiao-mcp-serverFAQ
Is Toutiao MCP free?
Yes, Toutiao MCP is free — one-click install via Unyly at no cost.
Does Toutiao need an API key?
No, Toutiao runs without API keys or environment variables.
Is Toutiao hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Toutiao in Claude Desktop, Claude Code or Cursor?
Open Toutiao on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
by modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
by xuzexin-hzCompare Toutiao with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All ai MCPs
