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
DocuMind MCP Server
An MCP server for analyzing documentation quality using advanced neural processing.
Tenets
Offline MCP server that ranks & summarizes code using BM25, TF-IDF, embeddings & git signals; integrates with Cursor, Claude Desktop and Windsurf; privacy preserving.
android-mcp-toolkit
A growing collection of MCP tools for Android Development. Currently features a deterministic Figma-SVG-to-Android-XML converter, with plans for Gradle analysis, Resource management, and ADB integration tools.
Authenticator App MCP Server
A secure MCP server for AI agents to interact with the Authenticator App for 2FA codes and passwords.
pageguard-mcp
Privacy compliance scanner for AI coding tools. Detects tracking technologies, cookies, and third-party data collection from local projects and live websites.
mcp-airflow-simple
simple mcp server for Airflow 3 (API version 2)
OPNSense MCP Server
Manage OPNsense firewalls using Infrastructure as Code (IaC) principles.
Javadoc MCP
A Model Context Protocol (MCP) server for searching Java documentation. This server enables AI assistants to search and retrieve Java API documentation from JSON files.
PageLens AI
Your AI assistant, plugged into your PageLens audits.
Postman MCP Generator
Provides JavaScript tools for making API requests, generated by the Postman MCP Generator.