Used as the HTTP client for interacting with the Emlog API, enabling article management, comments, and file uploads
Manages environment variables for Emlog API credentials and configuration settings
Integration with GitHub for repository hosting and version control of the Emlog MCP project
Supports Markdown format for creating and editing blog content within Emlog blog system
Runs the Emlog MCP server using Node.js runtime environment to connect AI assistants with Emlog blog systems
Distributes the Emlog MCP server as an npm package for easy installation and updates
Provides type-safe interactions with the Emlog blog platform API through TypeScript implementation
Validates input parameters and API responses for type safety when interacting with Emlog blog systems
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. 克隆项目
2. 安装依赖
3. 环境变量配置
复制示例配置文件并编辑:
在 .env
文件中设置以下环境变量:
获取 API 密钥:
- 登录你的 Emlog 后台管理系统
- 进入「设置」→「API 接口」
- 启用 API 功能并生成 API 密钥
- 将生成的密钥复制到
.env
文件中
4. 构建项目
5. 运行服务
或者开发模式:
MCP 客户端配置
Claude Desktop 配置
在 Claude Desktop 的配置文件中添加(通常位于 ~/Library/Application Support/Claude/claude_desktop_config.json
):
注意: 现在配置直接使用已发布的 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
- 获取用户信息
使用示例
创建博客文章
搜索文章
获取文章列表
上传文件
创建微语笔记
错误处理
服务包含完整的错误处理机制:
- 网络错误 - 自动重试和超时处理
- API 错误 - 详细的错误信息返回
- 认证错误 - API 密钥验证失败提示
- 参数错误 - 输入参数验证和提示
开发和调试
可用脚本
日志输出
服务会在 stderr 输出运行状态信息,便于调试:
测试服务
项目包含一个简单的测试脚本 test-server.js
,可以用来验证服务是否正常工作:
安全注意事项
- API 密钥保护 - 确保 API 密钥不被泄露,使用环境变量存储
- HTTPS 连接 - 生产环境建议使用 HTTPS 连接 Emlog API
- 权限控制 - 确保 API 密钥具有适当的权限范围
- 输入验证 - 所有用户输入都经过验证和清理
故障排除
常见问题
- 连接失败
- 检查
EMLOG_API_URL
是否正确 - 确认 Emlog 站点可访问
- 检查
- 认证失败
- 验证
EMLOG_API_KEY
是否有效 - 检查 API 密钥权限
- 验证
- 工具调用失败
- 查看错误信息中的具体原因
- 确认参数格式正确
项目结构
贡献
欢迎提交 Issue 和 Pull Request 来改进这个项目。在提交代码前,请确保:
- 代码通过 TypeScript 编译检查
- 遵循项目的代码风格
- 添加适当的错误处理
- 更新相关文档
许可证
MIT License
相关链接
Tools
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.
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityEnables AI assistants to interact with Meilisearch via the Model Context Protocol, allowing comprehensive index, document, and search management through a standardized interface.Last updated -684TypeScriptMIT License
- -securityAlicense-qualityA Model Context Protocol server that enables AI assistants to interact with n8n workflows through natural language, supporting actions like listing, creating, updating, executing and monitoring workflows.Last updated -388464TypeScriptMIT License
- -securityFlicense-qualityA comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.Last updated -16TypeScript
- AsecurityFlicenseAqualityA Model Context Protocol server that enables AI assistants to interact with the Omi API for retrieving and creating conversations and memories for users.Last updated -4TypeScript