
Emlog MCP Server
Enables AI assistants to interact with Emlog blog systems through a standardized Model Context Protocol interface, supporting content management operations like creating/updating articles, managing comments, uploading files, and accessing blog resources.
Tools
create_article
Create a new blog article
update_article
Update an existing blog article
get_article
Get a specific article by ID
search_articles
Search articles by keyword, tag, or category
add_comment
Add a comment to an article
get_comments
Get comments for an article
like_article
Like an article
create_note
Create a new micro-note
get_user_info
Get current user information
upload_file
Upload a file (image, document, etc.)
README
Emlog MCP Server
一个基于 Model Context Protocol (MCP) 的 Emlog 博客系统集成服务,允许 AI 助手通过标准化接口与 Emlog 博客进行交互。
项目信息
- 项目名称: emlog-mcp
- 包名: emlog-mcp
- 作者: Yiklam
- 仓库地址: https://github.com/eraincc/emlog-mcp
- 许可证: MIT
功能特性
资源 (Resources)
- 博客文章 (
emlog://articles
) - 获取所有博客文章列表 - 分类 (
emlog://categories
) - 获取所有分类信息 - 评论 (
emlog://comments
) - 获取评论列表(基于最新文章) - 微语笔记 (
emlog://notes
) - 获取微语笔记列表 - 用户信息 (
emlog://user
) - 获取当前用户信息
工具 (Tools)
- create_article - 创建新的博客文章
- update_article - 更新现有博客文章
- get_article - 获取指定文章详情
- search_articles - 搜索文章(支持关键词、标签、分类等筛选)
- like_article - 为文章点赞
- add_comment - 添加评论
- get_comments - 获取指定文章的评论列表
- create_note - 创建微语笔记
- upload_file - 上传文件(图片等媒体资源)
- get_user_info - 获取用户信息
技术栈
- TypeScript - 类型安全的 JavaScript 超集
- Node.js - JavaScript 运行时环境
- MCP SDK - Model Context Protocol TypeScript SDK
- Axios - HTTP 客户端库
- Zod - TypeScript 优先的模式验证库
- form-data - 多部分表单数据处理
安装和配置
方式一:使用已发布的 npm 包(推荐)
直接在 Claude Desktop 配置中使用 emlog-mcp
,无需本地安装。跳转到 MCP 客户端配置 部分。
方式二:本地开发安装
1. 克隆项目
git clone https://github.com/eraincc/emlog-mcp.git
cd emlog-mcp
2. 安装依赖
npm install
3. 环境变量配置
复制示例配置文件并编辑:
cp .env.example .env
在 .env
文件中设置以下环境变量:
# Emlog API 基础 URL(必需)
EMLOG_API_URL=https://your-emlog-site.com
# Emlog API 密钥(必需)
EMLOG_API_KEY=your_api_key_here
获取 API 密钥:
- 登录你的 Emlog 后台管理系统
- 进入「设置」→「API 接口」
- 启用 API 功能并生成 API 密钥
- 将生成的密钥复制到
.env
文件中
4. 构建项目
npm run build
5. 运行服务
npm start
或者开发模式:
npm run dev
MCP 客户端配置
Claude Desktop 配置
在 Claude Desktop 的配置文件中添加(通常位于 ~/Library/Application Support/Claude/claude_desktop_config.json
):
{
"mcpServers": {
"emlog": {
"command": "npx",
"args": ["emlog-mcp"],
"env": {
"EMLOG_API_URL": "https://your-emlog-site.com",
"EMLOG_API_KEY": "your_api_key_here"
}
}
}
}
注意: 现在配置直接使用已发布的 npm 包 emlog-mcp
,无需本地安装或编译,npx
会自动下载并运行最新版本。
项目还提供了一个示例配置文件 claude-desktop-config.json
,你可以参考其中的配置格式。
其他 MCP 客户端
对于其他支持 MCP 的客户端,请参考相应的文档来配置 stdio 传输。
API 接口说明
本服务基于 Emlog 的 REST API 构建,支持以下主要操作:
文章管理
GET /api/article_list
- 获取文章列表GET /api/article_view
- 获取指定文章详情POST /api/article_save
- 创建/更新文章POST /api/article_like
- 文章点赞
分类管理
GET /api/sort_list
- 获取分类列表
评论管理
GET /api/comment_list
- 获取评论列表POST /api/comment_save
- 发布评论
微语笔记
GET /api/note_list
- 获取微语笔记列表POST /api/note_save
- 发布微语笔记
文件上传
POST /api/upload
- 上传文件
用户管理
GET /api/userinfo
- 获取用户信息
使用示例
创建博客文章
// 通过 MCP 工具调用
{
"name": "create_article",
"arguments": {
"title": "我的新文章",
"content": "这是文章内容,支持 HTML 和 Markdown 格式。",
"sort_id": 1,
"tag": "技术,编程,MCP",
"is_private": "n",
"allow_comment": "y"
}
}
搜索文章
// 搜索包含关键词的文章
{
"name": "search_articles",
"arguments": {
"keyword": "技术",
"page": 1,
"count": 10
}
}
获取文章列表
// 通过 MCP 资源访问
{
"uri": "emlog://articles"
}
上传文件
// 上传图片文件
{
"name": "upload_file",
"arguments": {
"file_path": "/path/to/image.jpg"
}
}
创建微语笔记
// 发布微语笔记
{
"name": "create_note",
"arguments": {
"content": "这是一条微语笔记",
"is_private": false
}
}
错误处理
服务包含完整的错误处理机制:
- 网络错误 - 自动重试和超时处理
- API 错误 - 详细的错误信息返回
- 认证错误 - API 密钥验证失败提示
- 参数错误 - 输入参数验证和提示
开发和调试
可用脚本
# 构建项目
npm run build
# 启动服务
npm start
# 开发模式(自动重启)
npm run dev
# 监视模式(自动编译)
npm run watch
# 运行测试
npm test
日志输出
服务会在 stderr 输出运行状态信息,便于调试:
Emlog MCP server running on stdio
测试服务
项目包含一个简单的测试脚本 test-server.js
,可以用来验证服务是否正常工作:
node test-server.js
安全注意事项
- API 密钥保护 - 确保 API 密钥不被泄露,使用环境变量存储
- HTTPS 连接 - 生产环境建议使用 HTTPS 连接 Emlog API
- 权限控制 - 确保 API 密钥具有适当的权限范围
- 输入验证 - 所有用户输入都经过验证和清理
故障排除
常见问题
-
连接失败
- 检查
EMLOG_API_URL
是否正确 - 确认 Emlog 站点可访问
- 检查
-
认证失败
- 验证
EMLOG_API_KEY
是否有效 - 检查 API 密钥权限
- 验证
-
工具调用失败
- 查看错误信息中的具体原因
- 确认参数格式正确
项目结构
emlog-mcp/
├── src/ # 源代码目录
│ ├── index.ts # MCP 服务主入口
│ └── emlog-client.ts # Emlog API 客户端
├── dist/ # 编译输出目录
├── docs/ # 文档目录
│ └── api_doc.md # Emlog API 详细文档
├── .env.example # 环境变量示例文件
├── .gitignore # Git 忽略文件配置
├── claude-desktop-config.json # Claude Desktop 配置示例
├── test-server.js # 测试脚本
├── package.json # 项目配置和依赖
├── tsconfig.json # TypeScript 配置
└── README.md # 项目说明文档
贡献
欢迎提交 Issue 和 Pull Request 来改进这个项目。在提交代码前,请确保:
- 代码通过 TypeScript 编译检查
- 遵循项目的代码风格
- 添加适当的错误处理
- 更新相关文档
许可证
MIT License
相关链接
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.