About 自动发文 MCP Server
自动发文 MCP Server provides tools for AI-assisted article creation and publishing to CSDN, 掘金, and 博客园. It also searches 牛客 for interview experience posts and finds current technology news.
Key features
- 01Search 牛客 interview posts
- 02Find technology news
- 03Publish articles to CSDN
- 04Publish articles to 掘金
- 05Publish articles to 博客园
Use cases
- 01Find interview experience material
- 02Gather recent technology topics
- 03Publish generated articles across supported sites
MCP support
Built with MCP Java SDK, it exposes search and article-publishing tools to MCP-compatible assistants and clients.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project README自动发文 MCP Server
简介
本项目实现通过AI生成一篇文章,然后自动发文到CSDN、掘金、博客园。关于MCP协议,详见MCP官方文档。
依赖MCP Java SDK开发,任意支持MCP协议的智能体助手(如Claude、Cursor以及千帆AppBuilder等)都可以快速接入。
以下会给更出详细的适配说明。
工具列表
搜索面经 searchExperienceQuestion
- 从牛客搜索用户发表的面经
- 输出:
面经内容
查询资讯 searchNews
- 从网上查询最新的科技资讯话题内容
- 输出:
资讯标题、资讯内容
发布文章到CSDN publishArticle2Csdn
- 输入:
文章标题、内容、描述 - 输出:
文章id、文章链接
发布文章到掘金 publishArticle2Juejin
- 输入:
文章标题、内容、描述 - 输出:
文章id、文章链接
发布文章到博客园 publishArticle2Cnblog
- 输入:
文章标题、内容、描述 - 输出:
文章id、文章链接
环境参数
JUEJIN_COOKIE
掘金账号的Cookie,主要的请求头Cookie的sessionid字段
CSDN_COOKIE
CSDN账号的Cookie,主要是请求头Cookie的SESSION字段、UserName字段,UserInfo字段、UserToken字段 请求头签名:x-ca-key、x-ca-nonce、x-ca-signature、x-ca-signature-headers、accept、content-type 写死就行了
CNBLOG_COOKIE
博客园账号的Cookie,主要是请求头Cookie的.CNBlogsCookie字段、AspNetCore.Antiforgery.xxxxxxxx字段,.Cnblogs.AspNetCore.Cookies字段
CNBLOG_TOKEN
博客园请求头x-xsrf-token字段
快速开始
使用发文 MCP Server主要通过Java SDK 的形式
Java 接入
前提需要Java 17 运行时环境
安装
git clone https://github.com/yuyuanweb/mcp--server-article
构建
cd mcp--server-article
mvn clean package
使用
-
打开
Cherry Studio的设置,点击MCP 服务器。
-
点击
编辑 JSON,将以下配置添加到配置文件中。
{
"mcpServers": {
"articleServer": {
"command": "java",
"args": [
"-Dspring.ai.mcp.server.stdio=true",
"-Dspring.main.web-application-type=none",
"-Dlogging.pattern.console=",
"-jar",
"/Users/gulihua/IdeaProjects/mcp-server-article/target/mcp-server-0.0.1-SNAPSHOT.jar"
],
"env": {
"JUEJIN_COOKIE": "掘金的cookie",
"CNBLOG_COOKIE": "博客园的cookie",
"CNBLOG_TOKEN": "博客园的x-xsrf-token",
"CSDN_COOKIE": "CSDN的cookie"
}
}
}
}

- 在设置-模型服务里选择一个模型,输入API密钥,选择模型设置,勾选下工具函数调用功能。

- 在输入框下面勾选开启MCP服务。

- 配置完成,然后查询牛客的用户真实面经,AI生成文章,然后发布到CSDN、掘金、博客园。

代码调用
- 引入依赖
<dependency>
<groupId>com.alibaba.cloud.ai</groupId>
<artifactId>spring-ai-alibaba-starter</artifactId>
<version>1.0.0-M6.1</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-mcp-client-spring-boot-starter</artifactId>
<version>1.0.0-M6</version>
</dependency>
- 配置MCP服务器 需要在application.yml中配置MCP服务器的一些参数:
spring:
ai:
mcp:
client:
stdio:
# 指定MCP服务器配置文件
servers-configuration: classpath:/mcp-servers-config.json
mandatory-file-encoding: UTF-8
其中mcp-servers-config.json的配置如下:
{
"mcpServers": {
"articleServer": {
"command": "java",
"args": [
"-Dspring.ai.mcp.server.stdio=true",
"-Dspring.main.web-application-type=none",
"-Dlogging.pattern.console=",
"-jar",
"/Users/gulihua/IdeaProjects/mcp-server-article/target/mcp-server-0.0.1-SNAPSHOT.jar"
],
"env": {
"JUEJIN_COOKIE": "掘金的cookie",
"CNBLOG_COOKIE": "博客园的cookie",
"CNBLOG_TOKEN": "博客园的x-xsrf-token",
"CSDN_COOKIE": "CSDN的cookie"
}
}
}
}
客户端我们使用阿里巴巴的通义千问模型,所以引入spring-ai-alibaba-starter依赖,如果你使用的是其他的模型,也可以使用对应的依赖项,比如openAI引入spring-ai-openai-spring-boot-starter 这个依赖就行了。
配置大模型的密钥等信息:
spring:
ai:
dashscope:
api-key: ${通义千问的key}
chat:
options:
model: qwen-max
通义千问的key可以直接去官网 去申请,模型我们用的是通义千问-Max。 3) 初始化聊天客户端
@Bean
public ChatClient initChatClient(ChatClient.Builder chatClientBuilder,
ToolCallbackProvider mcpTools) {
return chatClientBuilder
.defaultTools(mcpTools)
.build();
}
- 接口调用
@PostMapping(value = "/ai/answer/sse", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux<String> generateStreamAsString(@RequestBody AskRequest request) {
Flux<String> content = chatClient.prompt()
.user(request.getContent())
.stream()
.content();
return content
.concatWith(Flux.just("[complete]"));
}
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.