EmDash には組み込みの Model Context Protocol (MCP) サーバーがあり、AI アシスタントがサイトのコンテンツを直接扱えます。Claude、ChatGPT、その他のツールに投稿の下書き、ページの更新、メディア管理、コンテンツ検索などを自然な会話で依頼できます。
サイトの MCP サーバー
MCP サーバーはデフォルトで有効です。オフにしない限り、EmDash は /_emdash/api/mcp をマウントします。エンドポイントは OAuth または個人アクセスのベアラートークンを受け付けます。管理ブラウザセッションだけでは MCP リクエストは認証されません。OAuth では、接続する人が EmDash がトークンを発行する前にスコープを選べます。
無効にするには、Astro 設定で mcp: false を設定します。
emdash({
mcp: false,
});
AI クライアントを接続する
サイトの MCP サーバー URL は次のとおりです。
https://example.com/_emdash/api/mcp
example.com を自分のドメインに置き換えてください。ローカル開発では http://localhost:4321/_emdash/api/mcp を使います。
Claude
URL をリモートのカスタムコネクタとして追加します。Claude は EmDash の OAuth フローを開き、サインインして権限を選べます。Anthropic は EmDash とは別にコネクタ画面を変更するため、正確な操作とプラン要件は 現行のカスタムコネクタ手順 に従ってください。
ChatGPT
ChatGPT の開発者モードはリモート MCP サーバーに接続でき、OAuth 認証のツールをサポートします。資格と設定画面は変わることがあるため、公式の ChatGPT 開発者モードガイド に従い、アプリ作成時にサイトの MCP URL を使ってください。書き込み呼び出しは承認前に確認してください。
Codex
Codex CLI からリモートサーバーを追加し、OAuth ログインを開始します。
codex mcp add emdash-site --url https://example.com/_emdash/api/mcp
codex mcp login emdash-siteChatGPT デスクトップアプリ、Codex CLI、IDE 拡張は同じ Codex ホストの MCP 設定を共有します。設定ファイル、OAuth、サポートされるトランスポートは 公式 Codex MCP ドキュメント を参照してください。
サイトコンテンツを扱う
接続後、自然言語でこれらの操作のいずれかを AI アシスタントに依頼できます。ツール名を知る必要はありません — 欲しいことを説明するだけで構いません。
Content
- コンテンツを閲覧 — “Show me the latest 10 blog posts” または “Find all draft pages”
- コンテンツを読む — “Get the post called ‘hello-world’ and summarize it”
- コンテンツを作成 — “Write a new blog post about our summer sale” または “Create a draft page for the About section”
- コンテンツを編集 — “Update the pricing page to mention the new plan” または “Fix the typo in the FAQ post”
- 公開とスケジュール — “Publish the summer sale post”、“Schedule the announcement for June 1st at 9am”、または “Cancel the schedule on the launch post”
- バージョンを比較 — “Show me what changed in the homepage since it was last published”
- 下書きを管理 — “Discard the draft changes on the about page” または “Duplicate the newsletter template”
- 翻訳 — “What translations exist for the welcome post?” または “Create a French draft linked to this English post”(i18n が有効なとき)
Bylines
- バイラインを閲覧 — “List the guest contributors whose names contain ‘Lee’”
- コンテンツにクレジット — “Add Priya Shah as the primary byline on this post”
- バイラインを管理 — “Create a guest byline for Sam Rivera” または “Update this contributor’s bio”
- バイラインを翻訳 — “Show the locale variants of this byline”
バイラインの作成・更新・削除・翻訳には Editor ロールが必要です。コンテンツ書き込みツールは、呼び出し元がそのコンテンツを作成または編集する権限を持つとき、既存のバイライン ID を受け付けます。
Media
- メディアを閲覧 — “List all uploaded images” または “Show me PDFs in the media library”
- 詳細を確認 — “Get the details for this media item”
- ファイルをアップロード — “Upload this base64 image as
banner.png” - 署名付きアップロードを確認 — “Confirm the upload with this storage key”
- メタデータを更新 — “Set the alt text on the hero image to ‘Mountain sunset’”
- ファイルを削除 — “Delete the old banner image”
media_upload は base64 エンコードされたバイトを受け取り、ファイルを保存し、メディア項目を登録し、ID と URL を返します。サイトの MIME タイプとアップロードサイズ制限を適用します。
media_create は POST /_emdash/api/media/upload-url で作成された保留中のアップロードを完了します。返された署名付き URL でファイルをアップロードし、同じユーザーアカウントからその storageKey を media_create に渡してください。確認では、保存されたファイルが存在し、アップロード URL 要求時に指定したサイズと一致することを調べます。このワークフローには Author 以上のロールが必要です。Contributor は media_upload を使えます。
Search
- コンテンツを探す — “Search for posts mentioning ‘accessibility’” または “Find anything about TypeScript across all collections”
Taxonomies
- 閲覧 — “List all categories” または “Show me the tags”
- 用語を作成 — “Add a ‘tutorials’ tag” または “Create a ‘Frontend’ subcategory under ‘Engineering’”
- 用語をリネーム — “Rename the ‘frontend’ category to ‘Web Frontend’”
- 用語を移動 — “Move the ‘tutorials’ tag under the ‘guides’ category” または “Detach ‘react’ from its parent”
- 用語を削除 — “Delete the unused ‘archive’ tag”
Menus
- メニューを表示 — “Show me the main navigation menu” または “What’s in the footer menu?”
- メニューを作成 — “Create a new ‘sidebar’ menu”
- メニューを編集 — “Rename the ‘main’ menu to ‘Primary navigation’”
- 項目を設定 — “Replace the items in the main menu with Home, Blog, About, and Contact”
- メニューを削除 — “Delete the unused ‘mobile’ menu”
Site settings
- 確認 — “What’s the current site title?” または “Show me the social links”
- アイデンティティを更新 — “Set the site title to ‘Acme Blog’ and tagline to ‘Stories from the team’”
- ロゴ / ファビコンを設定 — “Use this image as the site logo”(
media_uploadでアップロードした後) - SEO デフォルト — “Set the default OG image to the new banner” または “Update the title separator to a vertical bar”
- ソーシャルハンドル — “Add our GitHub and YouTube links to the social settings”
Schema(Admin のみ)
- 確認 — “What collections exist?” または “Show me the fields on the posts collection”
- コレクションを作成 — “Create a new ‘testimonials’ collection with name and quote fields”
- スキーマを変更 — “Add a ‘featured’ boolean field to posts”
Revisions
- 履歴を表示 — “Show the revision history for this post”
- 復元 — “Restore the post to its previous version”
権限
MCP クライアントが OAuth 同意ページを開くと、要求したすべての権限がデフォルトで選択されます。アクセスを承認する前に、クライアントが必要としない権限の選択を外してください。結果のトークンは、選択したままにした権限と EmDash ロールが許可する権限に制限されるため、権限を減らしてもクライアントができることが増えることはありません。
| ロール | AI ができること |
|---|---|
| Admin | スキーマ変更とサイト設定の更新を含むすべて |
| Editor | すべてのコンテンツ、メディア、バイライン、タクソノミー、メニューを管理。スキーマの表示と設定の読み取り。 |
| Author | コンテンツの作成、所有コンテンツの編集と公開、メディアのアップロードと所有メディアの管理。 |
| Contributor | 下書きコンテンツの作成とメディアのアップロード(公開なし)。 |
トークンスコープまたはユーザーロールが不十分な場合、EmDash はツール呼び出しを拒否します。クライアントがそのエラーを説明することはできますが、強制する権威は EmDash のままです。
ヒント
- コレクションについて具体的に。 複数のコレクションがある場合は「create a post」ではなく「create a blog post」と言ってください。
- まずスキーマを聞く。 コレクションのフィールドが不明なら、作成や編集の前に「What fields does the posts collection have?」と聞いてください。
- 公開前に確認する。 AI に下書きとして作成させ、管理パネルで確認してから公開を依頼する — または自分で公開する。
- 確認には compare を使う。 公開前に「Compare the live and draft versions of this post」と聞き、何が変わるかを正確に見てください。
- リッチテキストフィールドは Portable Text。 AI はリッチテキスト用の内容を書けますが、複雑な書式は管理エディターが最適です。
開発者向け
MCP サーバーエンドポイント、認証方法、OAuth ディスカバリ、ツールパラメータ、エラー処理は MCP サーバーリファレンス に記載されています。