MT Content Refactor MCP Server
Enables AI-driven batch refactoring of Movable Type content via the MT Data API using natural language instructions. It provides a secure workflow featuring automated backups, visual diff reports, and rollback capabilities for safe HTML transformations.
README
MT Content Refactor MCP Server
Movable Type の記事コンテンツを AI で一括変換するための MCP(Model Context Protocol)サーバーです。
Claude Desktop などの MCP 対応 AI クライアントから、MT Data API を通じて記事の HTML を一括で変換できます。
特徴
- AI による柔軟な変換: 自然言語で変換ルールを指示するだけで、Claude が HTML を解析・変換
- 安全なワークフロー: バックアップ → 変換 → 差分確認 → 適用の段階的プロセス
- 差分レポート: 変更前後を比較できる HTML レポートを自動生成
- ロールバック対応: いつでも元の状態に復元可能
- セッション管理: 作業状態を保存し、後から再開可能
使用例
あなた: サイト1の記事をバックアップして
Claude: 45件の記事をバックアップしました。セッション: 20251208_150000
あなた: 以下のルールで変換して:
- <p> 内に画像がある場合、<figure class="m-media"> で囲む
- テキストのみの <p> には class="m-text" を追加
Claude: 12件に変更が必要です。変換を実行しました。
あなた: 差分レポートを見せて
Claude: 差分レポートを生成しました: ~/.config/mt-content-refactor/backups/20251208_150000/diff-report.html
あなた: 問題なさそうなので適用して
Claude: 12件の変更を MT に反映しました。
必要環境
- Node.js 18 以上
- Movable Type 6 以上(Data API v4 対応)
- MCP 対応 AI クライアント(Claude Desktop など)
インストール
# リポジトリをクローン
git clone https://github.com/bit-part/mt-content-refactor-mcp.git
cd mt-content-refactor-mcp
# 依存関係をインストール
npm install
# ビルド
npm run build
Claude Desktop への登録
~/Library/Application Support/Claude/claude_desktop_config.json に以下を追加:
{
"mcpServers": {
"mt-content-refactor": {
"command": "node",
"args": ["/path/to/mt-content-refactor-mcp/dist/index.js"]
}
}
}
Volta を使用している場合は、Node.js のフルパスを指定:
{
"mcpServers": {
"mt-content-refactor": {
"command": "/Users/yourname/.volta/bin/node",
"args": ["/path/to/mt-content-refactor-mcp/dist/index.js"]
}
}
}
設定後、Claude Desktop を再起動してください。
使い方
1. 接続先の登録
MT環境を追加して
endpoint: https://example.com/mt/mt-data-api.cgi
username: api-user
password: secret123
2. 接続先の選択
MT環境に接続して
3. サイト・記事の確認
サイト一覧を表示して
サイト1の記事一覧を見せて
4. バックアップの作成
サイト1の記事を全件バックアップして
5. 変換の実行
以下のルールで変換して:
1. <p> 内に <img> がある場合、<figure> で囲む
2. テキストのみの <p> には class="m-text" を追加
6. 差分の確認
差分レポートを生成して
生成された HTML ファイルをブラウザで開いて確認します。
7. 変更の適用
変更を適用して
8. 問題があった場合のロールバック
記事ID 123 を元に戻して
利用可能なツール
接続管理
| ツール | 説明 |
|---|---|
mt_list_connections |
登録済み接続先の一覧 |
mt_add_connection |
新しい接続先を追加 |
mt_use_connection |
使用する接続先を選択 |
mt_remove_connection |
接続先を削除 |
mt_test_connection |
接続テスト |
コンテンツ操作
| ツール | 説明 |
|---|---|
mt_list_sites |
サイト一覧 |
mt_list_entries |
記事一覧 |
mt_get_entry |
記事詳細取得 |
mt_list_pages |
ページ一覧 |
mt_get_page |
ページ詳細取得 |
mt_list_content_types |
コンテンツタイプ一覧 |
mt_list_content_data |
コンテンツデータ一覧 |
mt_get_content_data |
コンテンツデータ詳細取得 |
バックアップ・変換
| ツール | 説明 |
|---|---|
mt_create_backup |
バックアップセッション作成 |
mt_get_backup_items |
バックアップ内容取得 |
mt_set_transform |
単一アイテムの変換結果を設定 |
mt_set_bulk_transform |
複数アイテムの変換結果を一括設定 |
mt_generate_diff_report |
差分レポート生成 |
mt_apply_changes |
変更を MT に適用 |
mt_restore |
ロールバック |
mt_list_sessions |
セッション一覧 |
mt_load_session |
セッション読み込み |
mt_delete_session |
セッション削除 |
データの保存場所
バックアップデータは以下に保存されます:
~/.config/mt-content-refactor/
├── connections.json # 接続先情報
└── backups/
└── 20251208_150000/ # セッションディレクトリ
├── session.json # セッション情報
├── items/ # 各アイテムのバックアップ
│ ├── entry_123.json
│ └── entry_124.json
└── diff-report.html # 差分レポート
開発
# 開発モード(ファイル変更を監視)
npm run dev
# MCP Inspector で動作確認
npm run inspect
注意事項
- 本番環境での使用は慎重に: 必ずテスト環境で動作確認してから使用してください
- バックアップの確認: 変更適用前に必ず差分レポートを確認してください
- 認証情報の管理: 接続情報は
~/.config/mt-content-refactor/connections.jsonに保存されます
ライセンス
MIT License
作者
mersy
関連リンク
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.
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.
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
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.
E2B
Using MCP to run code via e2b.