
Emlog博客
STDIO基于MCP的Emlog博客集成服务
基于MCP的Emlog博客集成服务
An Emlog blog system integration service based on Model Context Protocol (MCP), allowing AI assistants to interact with Emlog blogs through standardized interfaces.
emlog://articles
) - Get all blog article listsemlog://categories
) - Get all category informationemlog://comments
) - Get comment lists (based on latest articles)emlog://notes
) - Get micro note listsemlog://drafts
) - Get all draft article listsemlog://user
) - Get current user informationUse emlog-mcp
directly in Claude Desktop configuration without local installation. Jump to MCP Client Configuration section.
git clone https://github.com/eraincc/emlog-mcp.git cd emlog-mcp
npm install
Copy the example configuration file and edit:
cp .env.example .env
Set the following environment variables in the .env
file:
# Emlog API base URL (required) EMLOG_API_URL=https://your-emlog-site.com # Emlog API key (required) EMLOG_API_KEY=your_api_key_here
Getting API Key:
.env
filenpm run build
npm start
Or development mode:
npm run dev
Add to Claude Desktop configuration file (usually located at ~/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" } } } }
Note: The configuration now directly uses the published npm package emlog-mcp
, no local installation or compilation required. npx
will automatically download and run the latest version.
The project also provides an example configuration file claude-desktop-config.json
for reference.
For other MCP-supporting clients, please refer to their respective documentation for stdio transport configuration.
This service is built on Emlog's REST API, supporting the following main operations:
GET /api/article_list
- Get article listsGET /api/article_view
- Get specific article detailsPOST /api/article_save
- Create/update articlesPOST /api/article_like
- Like articlesGET /api/draft_list
- Get draft listsGET /api/draft_detail
- Get specific draft detailsGET /api/sort_list
- Get category listsGET /api/comment_list
- Get comment listsPOST /api/comment_save
- Publish commentsGET /api/note_list
- Get micro note listsPOST /api/note_save
- Publish micro notesPOST /api/upload
- Upload filesGET /api/userinfo
- Get user information// Through MCP tool call { "name": "create_article", "arguments": { "title": "My New Article", "content": "This is the article content, supporting HTML and Markdown formats.", "sort_id": 1, "tag": "technology,programming,MCP", "is_private": "n", "allow_comment": "y" } }
// Search articles containing keywords { "name": "search_articles", "arguments": { "keyword": "technology", "page": 1, "count": 10 } }
// Through MCP resource access { "uri": "emlog://articles" }
// Get draft list { "name": "get_draft_list", "arguments": { "count": 10 } }
// Get detailed information of specific draft { "name": "get_draft_detail", "arguments": { "id": 123 } }
// Upload image file { "name": "upload_file", "arguments": { "file_path": "/path/to/image.jpg" } }
// Publish micro note { "name": "create_note", "arguments": { "content": "This is a micro note", "is_private": false } }
The service includes comprehensive error handling mechanisms:
# Build project npm run build # Start service npm start # Development mode (auto restart) npm run dev # Watch mode (auto compile) npm run watch # Run tests npm test
The service outputs runtime status information to stderr for debugging:
Emlog MCP server running on stdio
The project includes a simple test script test-server.js
to verify if the service is working properly:
node test-server.js
Connection Failure
EMLOG_API_URL
is correctAuthentication Failure
EMLOG_API_KEY
is validTool Call Failure
emlog-mcp/
├── src/ # Source code directory
│ ├── index.ts # MCP service main entry
│ └── emlog-client.ts # Emlog API client
├── dist/ # Compiled output directory
├── docs/ # Documentation directory
│ └── api_doc.md # Detailed Emlog API documentation
├── .env.example # Environment variable example file
├── .gitignore # Git ignore file configuration
├── claude-desktop-config.json # Claude Desktop configuration example
├── test-server.js # Test script
├── package.json # Project configuration and dependencies
├── tsconfig.json # TypeScript configuration
└── README.md # Project documentation
Welcome to submit Issues and Pull Requests to improve this project. Before submitting code, please ensure:
MIT License