← Blog 一覧へ
Guides

MCP から LUNO を操作する

MCP を使い、AI coding agent が LUNO の backend を発見・構築・操作できるようにする。人とアプリケーションは同じ正本を使い続ける。

LUNO Team編集

luno.rest の編集。AI-era Backend Platform。

MCP から LUNO を操作する

AI coding agent は、いまやアプリケーションのかなりの部分を作れるようになりました。それでも、データ・フォーム・コンテンツ・ファイル・API・業務状態を置く backend は必要です。

agent に毎回別の backend を作らせるのではなく、LUNO は操作できる既存の backend を渡します。

Your coding agent can build the frontend. LUNO gives it a backend to operate.

MCP(Model Context Protocol)は、それを可能にする interface です。MCP 自体が backend ではありません。AI agent が LUNO を発見し、操作するための経路です。

この記事が答えるのは、「AI coding agent は実際にどう backend を操作するのか?」です。カテゴリ定義は /blog/what-is-ai-era-backend-platform、なぜ backend を作り直すべきでないかは /blog/never-build-backends-again を参照してください。

AI coding agent はアプリケーションを作れる

典型的な流れでは、agent は次のような仕事を担います。

User
 ↓
AI Coding Agent
 ↓
Generate application code
 ↓
Connect APIs
 ↓
Deploy application

UI、frontend、application logic、連携、デプロイ設定——ここが coding agent の本領です。

それでもアプリケーションには backend が必要

コードが動くだけでは終わりません。データ、コンテンツ、フォーム、メディア、API、公開、運用など、生成リポジトリを超えて残る backend capabilities が必要です。

既存の backend がない場合、仕事はこう膨らみがちです。

AI Agent
 ↓
Generate backend
 ↓
Generate database
 ↓
Generate auth
 ↓
Deploy infrastructure
AI is rebuilding the backend for every project.

これは /blog/never-build-backends-again の反対です。所有するスタック、運用面、人と agent の分岐がまた一つ増えます。

なぜ AI に backend を毎回作らせるのか

scaffold が速いと生産的に見えます。しかし一日目のあとに効くのは、所有・一貫性・運用です。

より良い既定は単純です。agent に backend を発明させるのではなく、理解して操作できる既存の backend を渡す。

既存の backend を渡す

LUNO を使うと構造はこう変わります。

User
 ↓
AI Coding Agent
 ↓
MCP
 ↓
LUNO Backend
 ↓
Application

agent はプロジェクトごとに backend を生成しません。既存の backend capabilities を発見し、操作します。

AI Coding Agent
      │
      │ MCP
      ▼
     LUNO
 Backend Platform
      │
      ├── Content
      ├── Forms
      ├── Media
      ├── API
      ├── Publishing
      └── Operations

これが本記事の中心です。LUNO は AI時代の Backend Platform。MCP はその platform への agent interface であり、platform そのものの代替ではありません。

MCP が変えること

MCP を「ただの別形式の API」と説明すべきではありません。

API は endpoint を露出します。MCP は agent が推論できる operations——tools、schemas、descriptions、structured input/output、errors、capabilities——を露出します。

An API exposes endpoints. MCP exposes operations an agent can reason about.

だからといって、MCP があれば agent が必ず正しく動くわけではありません。backend が、agent 向けに操作可能な仕事として提示できる、という意味です。

MCP は agent interface であり、backend ではない

                 LUNO
                  │
       ┌──────────┼──────────┐
       │          │          │
    Console      API        MCP
       │          │          │
     Human    Application   Agent
Different interfaces, same backend.

MCP が Console を置き換えるわけではありません。人・アプリケーション・AI agent が、同じ正本に対する三種類の backend operator になります。

従来の利用者が Human と Application だったところに Agent が加わる——それが AI-era Backend Platform の重要な変化です。関連: /blog/console-and-api-same-record

Agent-ready は「つながる」ではなく「理解できる」

tool list を渡すだけでは足りません。agent が有用な仕事を終えるには、次を理解する必要があります。

- 何が既にあるか
- 何を作れるか
- どの順番で操作すべきか
- 何が依存関係を持つか
- 何が production-impacting か
Agent-ready does not mean “has an API.” It means the backend is understandable and operable by an agent.

MCP tool 設計は、agent が backend operations をどれだけ推論できるかに影響します。計測や tool 粒度の詳細は別記事へ委譲し、本稿は操作モデルに留めます。

Tool call から task completion へ

MCP connectivity is not task completion

MCP server に接続でき、tools が見え、tool call が成功すること——それは前提です。「agent が期待どおり backend を作り終えた」証明ではありません。

完了の確認は次のような状態です。

- expected resources exist
- schema is correct
- data exists
- publishing state is correct
- API returns expected data
- the application can consume the result
Connection is a prerequisite. Completion is the outcome.

MCP call 数が少ないことを成功指標にしないでください。タスクを完遂する 10 calls の方が、不完全な backend を残す 2 calls より価値があります。

The goal is not fewer tool calls. The goal is fewer unfinished tasks.

Discover → Plan → Execute → Observe → Verify

検証・開発では、agent はだいたい次の loop で動きます。

Intent
  ↓
Discover
  ↓
Plan
  ↓
Execute
  ↓
Observe
  ↓
Verify
  ↓
Done

特に重要なのが Observe です。結果状態を確認できなければ、欠けたフィールドや誤設定、意図しない公開状態を検出できません。

だから agent interface は mutation だけでなく、結果状態を inspect できる tools も必要です。

本番のガバナンスは別の loop です。高リスク変更では次が必要になることがあります。

Intent
→ Change Plan
→ Human Approval
→ Execute
→ Observe
→ Recover
Agent operation and production authority are separate concerns.

開発は execute → observe → retry。本番は propose → approve → execute → observe → recover になり得ます。詳細は Agent Governance シリーズへ。入口: /blog/agent-autonomy-without-production-authority

Agent の権限は人の権限ではない

Authentication is not authorization

「AI agent に LUNO アカウントへのアクセスを渡す」という言い方は避けます。正しくは、明示的な権限境界の中で、必要な backend capabilities へのアクセスを渡す、です。

Agent Key
  ↓
Who is calling?

Human Approval
  ↓
Who authorized this high-risk change?

Agent Key は「誰が呼んでいるか」に答えます。すべての本番 mutation が自動で許可されるという意味ではありません。有用な操作を可能にしつつ、authority を明示し続けることが目的です。

具体例

例えば、こう指示したとします。

Build a corporate website backend with a contact form and a blog. Create one published blog post.

有用な経路は、人が tool を一つずつ叩くことではありません。ユーザーは成果を述べ、agent が backend operations を組み立てます。

1. Discover available backend capabilities
2. Create the required content model
3. Create the contact form
4. Configure fields / validation
5. Create the blog entry
6. Publish the entry
7. Verify the resulting backend state

MCP は interface を与えます。タスクを推論するのは依然として agent です。良い agent tooling は、tool を増やすことではなく、正しい仕事を理解可能で実行可能にすることです。

Coding agent と LUNO の役割分担

AI coding agentLUNO
FocusUI / frontend / app logic / integration / deploy configContent / forms / media / APIs / publishing / backend ops
ProducesApplication code操作対象の backend capabilities
Interfaceコード生成・クライアント接続Console / API / MCP(同一正本)

プロジェクトごとに backend を生成する場合との比較:

AI-generated backendLUNO + MCP
Backend creationEvery projectAlready exists
AuthRebuild/configurePlatform capability
Data modelProject-specific codePlatform-managed
Agent interfaceGenerated/API-dependentMCP
OperationsProject-ownedPlatform
Human + AgentOften separateSame backend
Backend maintenanceYour responsibilityPlatform responsibility

LUNO が backend のすべてを自動管理する、という未実装の断定ではありません。所有と運用がどこにあるべきか、という主張です。

Get started

モデルがクリアになったら、セットアップは短く保ちます。

1. Create or open a LUNO project
2. Create an Agent Key
3. Connect your coding agent (Claude Code / Cursor / Codex — 対応範囲内)
4. Run MCP setup from your site repo
5. Ask the agent to inspect the backend
6. Let it create and operate the required resources
7. Verify the resulting state

コマンドや環境変数は技術ドキュメント側へ。接続の入口: https://docs.luno.rest/en/guide/paths/agents

agent には tool 名のチェックリストではなく、成果(outcome)を渡してください。

操作の単位が backend なら、料金の単位も backend に近づく — /blog/pricing-without-seat-tax。

Conclusion

AI agents can write code.
But code is not the backend.

The backend is where the application's
data, capabilities, state, and operations live.

LUNO gives agents an existing backend.

MCP gives them a way to understand and operate it.

The result is simple:

The agent builds the application.
LUNO provides the backend.
Humans remain in control of authority.
Let the agent build the application. Don't make it rebuild the backend.

Build with your agent. Operate the backend through LUNO.

ほかの投稿