cnblogs-mcp
cnblogs MCP-Dienst
Durch das MCP (Model Context Protocol) werden die Open APIs von cnblogs als KI-aufrufbare Werkzeuge gekapselt. Dies ermöglicht es dir, in jedem beliebigen MCP-Client (QwenPaw, Claude Desktop, Cline usw.) Blogbeiträge für cnblogs direkt in natürlicher Sprache zu veröffentlichen.
Funktionen
✅
create_post— Veröffentlichen von Markdown-Blogbeiträgen auf cnblogs✅ Token-Verwaltung über
.env, kein Hardcoding✅ Unterstützung für die Anbindung an jeden MCP-Client
Related MCP server: feishu-markdown-mcp
Inhaltsverzeichnis
Schnellstart
1. Projekt klonen / herunterladen
git clone https://github.com/你的用户名/cnblogs-mcp.git
cd cnblogs-mcp2. Virtuelle Umgebung erstellen
python -m venv .venv
source .venv/bin/activate # macOS / Linux
# .venv\Scripts\activate # Windows3. Abhängigkeiten installieren
pip install -r requirements.txt4. Token konfigurieren
cp .env.example .envBearbeite die .env-Datei und trage deinen Personal Access Token von cnblogs ein:
CNBLOGS_TOKEN=your_token_here5. Test ausführen
# 验证 MCP 服务能正常启动
printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}\n{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}\n' \
| python cnblogs_mcp.py 2>/dev/null | grep '"name"'Normale Ausgabe:
{"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"create_post",...}]}}Token abrufen
Melde dich bei cnblogs an.
Gehe zu Persönliche Einstellungen → Sicherheitseinstellungen → Personal Access Token.
Klicke auf „Token erstellen“, gib einen Namen ein und wähle die Berechtigungen (die Berechtigung „Beiträge veröffentlichen“ ist erforderlich).
Kopiere den generierten Token und füge ihn in die
.env-Datei ein.
⚠️ Der Token wird nur einmal angezeigt, bitte bewahre ihn sicher auf.
Client-Anbindung
1. QwenPaw
Suche im Arbeitsverzeichnis von QwenPaw nach agent.json und füge den MCP-Client hinzu:
{
"mcp": {
"clients": {
"cnblogs": {
"name": "cnblogs",
"description": "博客园博文发布",
"enabled": true,
"transport": "stdio",
"command": "/absolute/path/to/cnblogs-mcp/.venv/bin/python",
"args": ["/absolute/path/to/cnblogs-mcp/cnblogs_mcp.py"],
"env": {
"DOTENV_PATH": "/absolute/path/to/cnblogs-mcp/.env"
}
}
}
}
}Starte QwenPaw neu:
qwenpaw daemon restart2. Claude Desktop
Füge Folgendes in ~/Library/Application Support/Claude/claude_desktop_config.json hinzu:
{
"mcpServers": {
"cnblogs": {
"command": "/absolute/path/to/cnblogs-mcp/.venv/bin/python",
"args": ["/absolute/path/to/cnblogs-mcp/cnblogs_mcp.py"],
"env": {
"DOTENV_PATH": "/absolute/path/to/cnblogs-mcp/.env"
}
}
}
}Starte Claude Desktop neu.
3. Cline / Roo Code
Suche in den VS Code-Einstellungen nach „MCP“, finde MCP Servers und füge Folgendes hinzu:
{
"cnblogs": {
"command": "/absolute/path/to/cnblogs-mcp/.venv/bin/python",
"args": ["/absolute/path/to/cnblogs-mcp/cnblogs_mcp.py"],
"env": {
"DOTENV_PATH": "/absolute/path/to/cnblogs-mcp/.env"
}
}
}4. Andere MCP-Clients
Allgemeine Konfigurationsvorlage:
Parameter | Wert |
|
|
|
|
| Absoluter Pfad zur |
💡 Wenn der MCP-Client
DOTENV_PATHnicht unterstützt, kann der Token auch direkt überenv.CNBLOGS_TOKENübergeben werden.
Manuelle Tests
cd cnblogs-mcp
# 测试 1:初始化 + 工具列表
printf '...' | python cnblogs_mcp.py
# 测试 2:发布一篇博文
printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}\n{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"create_post","arguments":{"title":"测试","body":"## 你好\n\n这是一篇测试文章。"}}}\n' | python cnblogs_mcp.py 2>/dev/nullNormale Rückgabe:
{"success": true, "postId": 12345678, "postUrl": "https://www.cnblogs.com/你的博客名/p/12345678"}Fehlerbehebung
Fehlermeldung | Ursache | Lösung |
|
| Überprüfe, ob die |
| Token ungültig oder abgelaufen | Erstelle einen neuen Token auf cnblogs |
| Token-Berechtigungen unzureichend | Stelle sicher, dass beim Erstellen des Tokens „Beiträge veröffentlichen“ ausgewählt wurde |
| Anfrageformat fehlerhaft | Überprüfe, ob Titel und Textkörper leer sind |
| Netzwerkproblem | Überprüfe die Netzwerkverbindung und versuche es erneut |
MCP-Toolliste nach Verbindung leer |
| Stelle sicher, dass |
API-Referenz
Werkzeug: create_post
Parameter:
Parameter | Typ | Erforderlich | Beschreibung |
| string | ✅ | Titel des Blogbeitrags |
| string | ✅ | Textkörper des Blogbeitrags (Markdown-Format) |
Rückgabewert:
{
"success": true,
"postId": 19246558,
"postUrl": "https://www.cnblogs.com/你的博客名/p/19246558"
}Oder bei einem Fehler:
{
"success": false,
"error": "错误描述"
}Entwicklung
Projektstruktur
cnblogs-mcp/
├── cnblogs_mcp.py # MCP 服务主文件
├── requirements.txt # Python 依赖
├── .env.example # 环境变量模板(不含真实 Token)
├── .env # 你的本地配置(已在 .gitignore 中)
├── .gitignore
├── README.md
└── LICENSEAbhängigkeiten
fastmcp>=3.0.0
python-dotenv>=1.0.0
requests>=2.31.0Lizenz
MIT — Über Sterne, Forks und PRs freuen wir uns!
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseAqualityFmaintenanceEnables AI agents to publish articles to WeChat Official Account (微信公众号). Supports image upload, draft creation, and publishing via standardized MCP protocol.51
- AlicenseNot gradedqualityFmaintenanceConverts Markdown to Feishu/Lark document format and provides an MCP service for integration with the Model Context Protocol.29MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for managing Blogger posts: create, update, retrieve posts, and upload images to GCS via natural language.2MIT
- AlicenseAqualityAmaintenanceEnables publishing local Markdown files to Velog with idempotent updates. Supports login, post management, and series operations through natural language.10MIT
Related MCP Connectors
Create, update, and publish changelog entries on your Patchlog changelog from any MCP client.
MCP-native collaborative markdown editor with real-time AI document editing
Publish AI-generated HTML & Markdown to a hosted, shareable URL via MCP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mintonzhang/cnblogs-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server