cnblogs-mcp
博客园 (cnblogs) MCP サービス
MCP(Model Context Protocol) プロトコルを通じて、博客园 (cnblogs) の Open API を AI が呼び出せるツールとしてラップします。あらゆる MCP クライアント(QwenPaw、Claude Desktop、Cline など)から、自然言語を使って直接博客园に記事を投稿できるようになります。
機能
✅
create_post— Markdown 形式のブログ記事を博客园に投稿✅ トークンは
.envで管理し、ハードコーディングを排除✅ あらゆる MCP クライアントからの接続をサポート
Related MCP server: feishu-markdown-mcp
目次
クイックスタート
1. プロジェクトのクローン / ダウンロード
git clone https://github.com/你的用户名/cnblogs-mcp.git
cd cnblogs-mcp2. 仮想環境の作成
python -m venv .venv
source .venv/bin/activate # macOS / Linux
# .venv\Scripts\activate # Windows3. 依存関係のインストール
pip install -r requirements.txt4. トークンの設定
cp .env.example .env.env を編集し、博客园の Personal Access Token を入力します:
CNBLOGS_TOKEN=your_token_here5. テストの実行
# 验证 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"'正常な出力:
{"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"create_post",...}]}}トークンの取得
博客园 にログイン
「トークンを作成」をクリックし、名前と権限(「随筆の投稿」権限が必要)を入力
生成されたトークンをコピーし、
.envファイルに貼り付け
⚠️ トークンは一度しか表示されません。大切に保管してください。
クライアント接続
1. QwenPaw
QwenPaw の作業ディレクトリにある agent.json を探し、MCP クライアントを追加します:
{
"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"
}
}
}
}
}QwenPaw を再起動します:
qwenpaw daemon restart2. Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json に以下を追加します:
{
"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"
}
}
}
}Claude Desktop を再起動します。
3. Cline / Roo Code
VS Code の設定で「MCP」を検索し、MCP Servers を見つけて以下を追加します:
{
"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. その他の MCP クライアント
汎用設定テンプレート:
パラメータ | 値 |
|
|
|
|
|
|
💡 MCP クライアントが
DOTENV_PATHをサポートしていない場合は、env.CNBLOGS_TOKENを使用して直接トークンを渡すことも可能です。
手動テスト
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/null正常な戻り値:
{"success": true, "postId": 12345678, "postUrl": "https://www.cnblogs.com/你的博客名/p/12345678"}エラー処理
エラーメッセージ | 原因 | 解決策 |
|
|
|
| トークンが無効または期限切れ | 博客园でトークンを再作成 |
| トークンの権限不足 | トークン作成時に「随筆の投稿」にチェックが入っているか確認 |
| リクエスト形式が不正 |
|
| ネットワークの問題 | ネットワークを確認して再試行 |
MCP 接続後にツールリストが空 |
|
|
API リファレンス
ツール:create_post
パラメータ:
パラメータ | 型 | 必須 | 説明 |
| string | ✅ | ブログ記事のタイトル |
| string | ✅ | ブログ記事の本文(Markdown 形式) |
戻り値:
{
"success": true,
"postId": 19246558,
"postUrl": "https://www.cnblogs.com/你的博客名/p/19246558"
}またはエラー時:
{
"success": false,
"error": "错误描述"
}開発
プロジェクト構造
cnblogs-mcp/
├── cnblogs_mcp.py # MCP 服务主文件
├── requirements.txt # Python 依赖
├── .env.example # 环境变量模板(不含真实 Token)
├── .env # 你的本地配置(已在 .gitignore 中)
├── .gitignore
├── README.md
└── LICENSE依存関係
fastmcp>=3.0.0
python-dotenv>=1.0.0
requests>=2.31.0ライセンス
MIT — Star、Fork、PR を歓迎します!
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