MCP WordPress Post Server
Manage WordPress posts and upload images directly from file paths.
MCP WordPress Post Server
WordPress投稿管理に特化したファイルパス方式画像アップロード機能を持つMCP(Model Context Protocol)サーバーです。
本プロジェクトは@prathammanocha氏の優秀なwordpress-mcp-serverをベースに、画像処理機能を大幅に改善したものです。
✨ 主な機能
🖼️ 高度な画像アップロードシステム
- ファイルパス方式: ファイルシステムへの直接アクセス(Base64エンコード不要)
- 大容量ファイル対応: WordPressの制限内でデータ損失なしに処理
- multipart/form-data: WordPress標準メディアアップロードAPI使用
- 自動最適化: WordPress内蔵画像処理機能を活用
- レスポンシブ画像: 異なる画面サイズ用のsrcsetを自動生成
📝 投稿管理機能
- 投稿作成: 複数画像添付対応
- 投稿更新: 既存投稿の編集
- 投稿一覧: ページネーション対応
- 投稿詳細取得: フルコンテンツ表示
- 下書き/公開ワークフロー: ステータス管理
🔧 技術的改善点
- メモリ使用量33%削減: Base64エンコードの排除
- データ整合性: Base64方式で発生していた95-98%のデータ損失を解決
- エラーハンドリング: ファイル存在確認やアップロード検証の充実
- デバッグログ: トラブルシューティング用の詳細ログ
🚀 クイックスタート
前提条件
- Node.js v18以上
- REST API有効なWordPressサイト
- WordPressアプリケーションパスワード
インストール
- リポジトリのクローン:
git clone [your-repo-url]
cd mcp-wordpress-post
- 依存関係のインストール:
npm install
- 環境設定:
cp .env.example .env
# .envファイルを編集してWordPressの認証情報を設定
- ビルド:
npm run build
- サーバー起動:
npm start
📖 使用方法
MCP設定
MCPクライアントの設定ファイルに追加してください:
{
"mcpServers": {
"wordpress-post": {
"command": "node",
"args": ["/path/to/mcp-wordpress-post/build/posts-only.js"]
}
}
}
画像付き投稿の作成
改善された画像アップロードシステムではファイルパスを使用します:
// 新しいファイルパス方式(推奨)
{
"tool": "create-post",
"title": "画像付きの投稿",
"content": "この画像をご覧ください: {IMAGE1}",
"images": [{
"filePath": "/絶対パス/to/image.png",
"filename": "カスタム名.png", // 省略可能
"placeholder": "{IMAGE1}"
}]
}
利用可能なツール
create-post
画像添付対応の新規WordPress投稿作成
パラメータ:
siteUrl(文字列): WordPressサイトURLusername(文字列): WordPressユーザー名password(文字列): アプリケーションパスワードtitle(文字列): 投稿タイトルcontent(文字列): 画像プレースホルダーを含む投稿内容status(列挙型):"draft"|"publish"|"private"(デフォルト:"draft")images(配列, 省略可能):filePath、placeholder、省略可能なfilenameを持つ画像オブジェクト
list-posts
ページネーション対応でWordPress投稿を取得
get-post
特定の投稿の詳細情報を取得
update-post
既存のWordPress投稿を更新
🔄 Base64方式からの移行
Base64ベースのシステムから移行する場合:
従来方式(Base64 - 非推奨):
images: [{
data: "iVBORw0KGgoAAAANSUhEUgAAAAE...", // 大きなBase64文字列
filename: "image.png",
placeholder: "{IMAGE1}"
}]
新方式(ファイルパス - 現在):
images: [{
filePath: "/path/to/image.png", // ファイルシステムパス
filename: "カスタム名.png", // 省略可能なカスタム名
placeholder: "{IMAGE1}"
}]
🐛 トラブルシューティング
よくある問題
-
ファイルが見つからないエラー:
- ファイルパスが絶対パスであることを確認
- ファイルのアクセス権限を確認
-
大容量ファイルのアップロード失敗:
- WordPressの
upload_max_filesize設定を確認 post_max_sizeとmemory_limitを確認
- WordPressの
-
画像が表示されない:
- プレースホルダーの形式が正確に一致していることを確認
/tmp/mcp-debug.logのデバッグログを確認
デバッグモード
詳細ログを有効にする:
npm run debug-mcp
📊 パフォーマンス比較
| 項目 | Base64方式 | ファイルパス方式 |
|---|---|---|
| メモリ使用量 | 高い (+33%) | 効率的 |
| データ損失 | 大容量ファイルで95-98% | 0% |
| 処理速度 | 遅い | 高速 |
| ファイルサイズ制限 | 実用的には~100KB | WordPress制限まで |
🤝 貢献
このプロジェクトはprathammanocha/wordpress-mcp-serverの基盤の上に構築されています。
開発環境セットアップ
- サブモジュール付きクローン:
git clone --recursive [your-repo-url]
- 依存関係のインストール:
npm install
- 開発モード:
npm run dev
テスト
機能をテストするためのデバッグスクリプトを実行:
npm run debug-playwright # WordPress統合テスト
npm run debug-mcp # MCPサーバーテスト
📊 解決された問題
Base64方式の問題点
- 98%のデータ損失: 85KB → 1.5KB という深刻な問題
- メモリ効率の悪さ: 33%の無駄なメモリ使用
- 処理速度の低下: エンコード/デコード処理のオーバーヘッド
ファイルパス方式の利点
- データ損失ゼロ: 85KB → 50KB(正常な最適化)
- メモリ効率: Base64エンコード処理の排除
- 高速処理: ファイル直接読み取りによる高速化
- 安定性: WordPress標準API使用による安定動作
📄 ライセンス
MIT License - 詳細はLICENSEファイルを参照してください。
🙏 謝辞
- @prathammanocha - オリジナルのwordpress-mcp-server
- WordPress REST API チーム - 優秀なドキュメント
- Model Context Protocol 仕様作成者
🔗 関連プロジェクト
- オリジナルサーバー: prathammanocha/wordpress-mcp-server
- MCP SDK: @modelcontextprotocol/sdk
より良いWordPress自動化のために ❤️ で作成
เซิร์ฟเวอร์ที่เกี่ยวข้อง
Alpha Vantage MCP Server
ผู้สนับสนุนAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
jpx
JMESPath query tool with 320+ extended functions for JSON transformation and analysis
mcp-server template
A template for creating MCP (ModelContextProvider) servers, configurable via environment variables.
Ansible & OpenShift Automation
Provides tools to interact with the Ansible Automation Platform API for automation tasks.
Apifox MCP Pro
An enhanced Apifox MCP service providing comprehensive API management capabilities for Claude Desktop and Cursor.
Kodus OSV
Open source vulnerability lookup via osv_query/osv_query_batch tools.
Cache Overflow
knowledge network for AI coding agents. Developers connect their agents to a shared pool of verified solutions — saving tokens, reducing debugging time, and getting better results. Solution authors earn when their work helps others.
Tox Testing
Executes tox commands to run Python tests with pytest. Requires the TOX_APP_DIR environment variable to be set.
MCP-guide
A guide for setting up an MCP server using a Python virtual environment and integrating it with the Cline VS Code extension.
Remote MCP Server (Authless)
A remote MCP server for Cloudflare Workers, authless by default with optional token-based authentication.
UI Prototype
A modern web application prototype built with React, TypeScript, and Material-UI, featuring authentication, internationalization, and Figma integration.