About Juejin
Juejin is an MCP server published by CorgiBoyG in the Other category.
The repository has 8 stars and 1 forks, with the last commit 11 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/CorgiBoyG/mcp-server-juejinThis 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 Juejin
Powered by Claude · Grounded in docs
Security checks
- ✓README presentThe repository ships documentation.
5 checks have not been run yet.
README
MCP Server - JueJin
一个基于 Spring AI MCP Server 的掘金文章发布服务,支持通过 AI 自动创建和发布文章到掘金社区。
功能特性
- ✅ 创建文章草稿到掘金
- ✅ 发布文章到掘金社区
- ✅ 支持 Markdown 格式内容
- ✅ 支持文章标签设置
- ✅ 基于 Spring AI MCP Server 标准协议
- ✅ 支持 stdio 模式
技术栈
- Java 17
- Spring Boot 3.4.3
- Spring AI 1.0.0-M6
- Retrofit 2.9.0 - HTTP 客户端
- Flexmark 0.64.8 - Markdown 解析器
- Lombok
- FastJSON 2.0.28
项目结构
mcp-server-juejin/
├── src/
│ └── main/
│ ├── java/
│ │ └── cn/bugstack/mcp/server/juejin/
│ │ ├── domain/ # 领域层
│ │ │ ├── adapter/ # 端口接口
│ │ │ ├── model/ # 领域模型
│ │ │ └── service/ # 领域服务
│ │ ├── infrastructure/ # 基础设施层
│ │ │ └── adapter/ # 适配器实现
│ │ ├── gateway/ # 网关层
│ │ │ └── dto/ # 数据传输对象
│ │ ├── types/ # 类型定义
│ │ │ ├── properties/ # 配置属性
│ │ │ └── utils/ # 工具类
│ │ └── McpServerApplication.java
│ └── resources/
│ └── application.yml
└── pom.xml
快速开始
环境要求
- JDK 17+
- Maven 3.6+
配置说明
在 src/main/resources/application.yml 中配置掘金 Cookie:
juejin:
api:
cookie: your-juejin-cookie-here # 掘金登录 Cookie
spring:
application:
name: mcp-server-juejin
ai:
mcp:
server:
name: ${spring.application.name}
version: 1.0.0
main:
web-application-type: none # stdio 模式
如何获取掘金 Cookie:
- 登录掘金网站(https://juejin.cn)
- 打开浏览器开发者工具(F12)
- 在 Network 标签中找到任意请求
- 复制请求头中的
Cookie值
构建项目
mvn clean package
运行项目
java -jar target/mcp-server-juejin-1.0.0.jar
功能说明
发布文章到掘金
通过 @Tool 注解暴露的工具方法,AI 可以调用 saveArticleToJueJin 方法发布文章。
功能流程:
- 创建文章草稿(调用掘金创建 API)
- 发布文章(调用掘金发布 API)
请求参数:
title: 文章标题markdowncontent: Markdown 格式的文章内容tags: 文章标签(多个标签用逗号分隔)
返回信息:
- 文章发布结果
- 文章 ID(如果成功)
- 文章链接(如果成功)
架构设计
项目采用 DDD(领域驱动设计)架构:
- 领域层(Domain): 包含业务逻辑和领域模型
- 基础设施层(Infrastructure): 实现外部接口适配
- 网关层(Gateway): 处理外部 API 调用
数据流转:
AI → @Tool 方法 → JueJinArticleService → IJueJinPort → JueJinPort → IJueJinService → 掘金 API
使用示例
当作为 MCP Server 运行时,AI 可以通过以下方式调用:
{
"method": "tools/call",
"params": {
"name": "saveArticleToJueJin",
"arguments": {
"title": "深入理解 Spring Boot 自动配置",
"markdowncontent": "# 深入理解 Spring Boot 自动配置\n\nSpring Boot 的自动配置机制...",
"tags": "Spring Boot,Java,后端开发"
}
}
}
开发说明
核心类说明
- McpServerApplication: Spring Boot 主启动类
- JueJinArticleService: 领域服务,提供
saveArticleToJueJin工具方法 - JueJinPort: 适配器实现,连接领域层和网关层
- IJueJinService: Retrofit 接口,定义掘金 API 调用
createArticle: 创建文章草稿publishArticle: 发布文章
- MarkdownConverter: Markdown 转换工具
添加新功能
- 在
JueJinArticleService中添加新的@Tool注解方法 - 在
IJueJinPort接口中定义新的端口方法 - 在
JueJinPort中实现适配逻辑 - 在
IJueJinService中添加对应的 API 接口 - 重新构建并运行
掘金 API 说明
项目使用掘金开放 API:
- Base URL:
https://api.juejin.cn/ - 创建文章:
/content_api/v1/article_draft/create - 发布文章:
/content_api/v1/article/publish
日志
日志文件位置:data/log/mcp-server-juejin.log
注意事项
- Cookie 会过期,需要定期更新
- 发布文章需要遵守掘金社区规范
- 建议在测试环境先验证功能
- 掘金 API 可能有调用频率限制
许可证
本项目采用 MIT 许可证。
作者
Daniel G
README copy captured when this server was indexed; it may lag the repository. The original is authoritative.