eco-mcp-app
eco-mcp-app
Eco via Sirensゲームサーバー [1] 用のClaude Desktopインラインウィジェットです。Claudeに「Ecoサーバーの状況はどう?」と尋ねると、メテオのカウントダウン、オンライン/合計プレイヤー数、動植物、ワールドサイズ、法律、経済、Discordへの誘導などが記載されたライブカードが返ってきます。スクリーンショットやタブの切り替えは不要です。
これは技術デモでもあります。バンドラーやReactを使用しない、手書きの最小限のMCP Apps実装 [2] であり、iframe全体が1つの300行のHTMLファイルで構成されています。デフォルトのTypeScript/ext-apps [3] スタックではなく、PythonでMCPアプリを構築する他の開発者にとってのリファレンスとして役立ちます。
レンダリング内容
┌─ Eco via Sirens ─────────── Established · day 2 · HighCollaboration · Slow ─ ● online ─┐
│ │
│ DAYS UNTIL METEOR ☄ ┌─────┐ │
│ 57 days │ 57 │ (cycle ring, │
│ Server running for 2 days · 5% through the cycle │ left│ fills as days │
│ └─────┘ tick down) │
│ │
│ ┌ Players online ┐ ┌ World ┐ ┌ Cycle progress ┐ ┌ Economy & culture ┐ │
│ │ 7 / 67 │ │ 0.52 km² │ │ day 2 │ │ 473 trades, │ │
│ │ peak 38 │ │ 96k plants │ │ 57d until ☄ │ │ 0 contracts │ │
│ │ ░░░░█░░░░░░░░░ │ │ 0 animals │ │ ██░░░░░░░░░░░░░ │ │ 171.0 culture │ │
│ └────────────────┘ └─────────────┘ └─────────────────┘ └───────────────────┘ │
│ │
│ [v 0.13.0.2] [English] [open] [admin online] Fetched 4:12 PM · [Join Discord]│
└───────────────────────────────────────────────────────────────────────────────────────┘
· · · . · . . ·
. · . * . · . (animated starfield, twinkling)
* . * ·
☄ (meteor, floats)
↙
↙Related MCP server: MCP Quickstart Weather Server
仕組み
サーバー (src/eco_mcp_app/server.py) は1つのツール get_eco_server_status を公開します。これは http://eco.coilysiren.me:3001/info (Eco [4] サーバーがデフォルトで公開するパブリックな /info エンドポイント) にアクセスし、プレイヤー名を伏せた上で、テキストのみのホスト用のMarkdownフォールバックと、iframe用のJSONペイロードの2つのコンテンツブロックを返します。ツールの _meta.ui.resourceUri は、リソースとして登録されたiframe HTMLである ui://eco/status.html を指しています。
iframe (src/eco_mcp_app/ui/eco.html) はプレーンなHTML/CSS/JSであり、ビルドステップやバンドラー、Reactは使用していません。仕様 [5] に従って、MCP Appsの初期化ハンドシェイクを手動で行います:
Iframe → ホスト:
ui/initialize(リクエスト、protocolVersion: 2026-01-26を含む)ホスト → Iframe: 初期化結果
Iframe → ホスト:
ui/notifications/initialized(通知)ホスト → Iframe: 対応するツールが実行されるたびに
ui/notifications/tool-result
ハンドシェイクは約30行です。ext-apps SDK [3] はより多くの機能(自動リサイズ、機能ネゴシエーションなど)を提供しますが、読み取り専用のダッシュボードには不要であり、記述することで仕様が読みやすくなります。
参照
このリポジトリは小さなEcoエコシステムの隣に位置しています:eco-cycle-prep [6] はサイクルごとのセットアップ(ワールド生成、Discord通知、MOD同期)を実行し、eco-agent [7] は同じサーバー用の初期のFastAPIコンパニオンサービスでした。eco-mods-public [8] はゲームプレイMODが配置されている場所です。サーバーインフラは infrastructure [9] (k3s + pyinvoke + external-secrets + Traefik) で定義されています。Ecoの標準的なリファレンス:ModKit [10]、MODドキュメント [11]、Eco wikiのMODページ [12]、Discordブリッジプラグイン [13]、MODカタログ [14]。
インストール (ローカル、Claude Desktop)
Claude Desktopは起動時にのみMCPを読み込むため、インストール後に再起動が必要です:
cd /Users/kai/projects/coilysiren/eco-mcp-app
uv sync
python scripts/install-desktop-config.pyその後、Claude Desktopを完全に終了 (⌘Q) して再起動してください。新しいチャットで以下のように入力します:
Use eco-mcp-app to show me the Eco server status.
メテオカードがインラインで表示されるはずです。
デプロイ (ホームラボ)
長期的なターゲットは、すでに eco-agent をホストしている同じk3sクラスター上の eco-mcp.coilysiren.me です。パターンは infrastructure [9] から変更されていません:
Dockerイメージのビルド (
DockerfileTODO)deploy/内のマニフェスト (Deployment, Service, Ingress, cert-manager経由のTLS, ClusterIssuerはインフラリポジトリに既存)シークレットは不要 —
/infoエンドポイントはパブリックであり、サーバーは環境変数なしで実行されます
MCP-over-HTTPには独自の仕様上の落とし穴(セッションIDの分割やリソース登録のスコープなど、ext-apps#481で追跡中)があるため、最初のデプロイは、mcp SDKのHTTPトランスポートを介してStreamable-HTTPサーバーとしてラップされたstdioバイナリと同じものになる可能性が高いです。これは後のサイクルの課題です。
スモークテスト
MCP → iframe → レンダリングのフロー全体は、Claudeなしでstdioを介してテスト可能です:
inv smokeid=2 で両方の形式の _meta.ui.resourceUri、id=3 で実際のサイズのHTMLリソース、id=4 で "view":"eco_status" を含むJSONペイロードを確認してください。
開発ハーネス (Claudeを再起動せずにiframeを反復開発)
dev/harness.html は、Claude DesktopのMCP Appsホストを模倣した最小限のHTMLページであり、通常のブラウザでiframeを開発できるため、変更のたびに ⌘Q / 再起動を行う必要はありません。ハーネスの機能:
src/eco_mcp_app/ui/eco.htmlをiframe (visibility: hidden) として読み込みます。iframeからの
ui/initializeをリッスンし、有効なMcpUiInitializeResult(protocolVersion, hostInfo, hostCapabilities, hostContext) で応答します。ui/notifications/initializedを受け取ると、iframeを表示します。ui/notifications/size-changedをリッスンし、報告された{width, height}をiframe.style.heightに適用します。これはClaude Desktopが実際に使用しているメカニズムであり、claude-ai-mcp#69 で説明されているdocumentElement.heightの読み取りではありません。表示後、モックのEco
/infoペイロードを含むui/notifications/tool-resultをプッシュし、render()を実行させます。
実行コマンド:
inv harness
# then open http://localhost:8765/dev/harness.htmlハーネス上部のステータスバーには、最後に報告された size-changed 値が表示されるため、iframeがホストにリサイズを指示しているかを確認できます。「Loading…」のまま動かない場合は、ハンドシェイクが失敗したか、connect() に到達する前にiframeのスクリプトがエラーをスローしています。DevToolsコンソールを確認してください。
このハーネスは、.claude/launch.json の eco-harness エントリを介してClaude Codeのプレビューパネルからも使用可能です。
MCP Apps — 構築中に学んだ自明ではないこと
_meta.ui.resourceUriは、ネストされた形式 (ui.resourceUri) とフラットな形式 (ui/resourceUri) の 両方 で設定する必要があります。ホストによっては片方しか認識しない場合があります [15]。MIMEタイプは正確に
text/html;profile=mcp-appである必要があります。単なるtext/htmlではMCP Appsのレンダリングはトリガーされません。クライアント側のJSでハンドシェイクを実行しない場合、Claude Desktopはiframeコンテナを
visibility: hiddenのままにします。つまり、スクリプトなしのテストHTMLは有効な分離手段ではなく、壊れたアプリと同一に見えます [16]。Claude Desktopのサンドボックスiframeは、
_meta.ui.csp拡張を無視するハードコードされたCSPを強制します [17]。外部画像のオリジンはブロックされます。サムネイルが必要な場合は、サーバー側でdata:image/...;base64,...URIとしてインライン化してください。これらは常に許可されます。Claude DesktopのチャットUI (
clientInfo.name = "claude-ai") のみがio.modelcontextprotocol/ui拡張機能をアドバタイズします。Claude Code Desktopのエージェントハーネス (clientInfo.name = "local-agent-mode-*") はアドバタイズしないため、iframeはそこでレンダリングされません。フォールバックのインライン可視化パスとして、Launchプレビューパネル(ローカルHTMLファイルに対するWriteまたはEditツール呼び出しでトリガー)を使用してください。
ライセンス
MIT。
参照
Available Tools
1 toolget_eco_server_statusEco via Sirens — server statusA
Show the current state of the 'Eco via Sirens' game server inline: online players, meteor countdown, world stats, economy, version. Renders as a visual widget in Claude Desktop chat UI via the MCP Apps spec; falls back to a plain-text summary in hosts that don't render the iframe.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden and does so effectively by disclosing key behavioral traits: it displays server status inline, renders as a visual widget in Claude Desktop via MCP Apps spec, and falls back to plain-text in other hosts. This covers presentation behavior and compatibility, though it lacks details on error handling or refresh rates.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded, starting with the core purpose and immediately detailing the specific data retrieved and rendering behavior. Every sentence adds essential information without redundancy, making it highly efficient and well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (0 parameters, no output schema, no annotations), the description is nearly complete: it explains what the tool does, what information it returns, and how it behaves in different hosts. It could be slightly more complete by mentioning potential errors or data freshness, but it covers most needed context effectively.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0 parameters with 100% coverage, so the schema fully documents the lack of inputs. The description adds value by explaining that no parameters are needed to retrieve the server status, implicitly confirming the empty schema, which justifies a score above the baseline of 3 for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Show the current state') and resource ('Eco via Sirens game server'), listing exactly what information is retrieved (online players, meteor countdown, world stats, economy, version). It distinguishes this tool's purpose with precision, especially noting the visual widget rendering capability.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage context by mentioning it renders as a visual widget in Claude Desktop and falls back to plain-text elsewhere, but it does not explicitly state when to use this tool versus alternatives. Since there are no sibling tools, this is less critical, but no explicit guidance on prerequisites or exclusions is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v0.1.0- First observed
get_eco_server_status
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is clearly defined and distinct by default.
The single tool follows a clear verb_noun naming pattern (get_eco_server_status), and with no other tools to compare, consistency is inherently perfect.
One tool is too few for a server named 'eco-mcp-app', which suggests a broader scope for managing an 'Eco via Sirens' game server. A single status-check tool feels thin and incomplete for such a domain.
The tool surface is severely incomplete for the inferred domain of game server management. It only provides status information, with no tools for actions like starting/stopping the server, managing players, configuring settings, or other CRUD operations expected in this context.
Maintenance
Related MCP Connectors
- UnifAPIOAuthcom.unifapi
Hosted MCP server for live public-data APIs and Skills for AI agents.
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
MCP server for AI dialogue using various LLM models via AceDataCloud
Related MCP Servers
- AlicenseAqualityCmaintenanceA demonstration MCP server for local development and testing with Claude Desktop on WSL. Provides basic utility tools including greeting messages, echo functionality, and server information retrieval.3MIT
- FlicenseBqualityDmaintenanceA basic MCP server adapted from the official quickstart guide that provides weather data functionality and works with OpenAI chat completions API. Demonstrates MCP server setup with configuration examples for Claude Desktop and development tools.2-
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server built with the mcp-framework for developing and managing custom tools. It provides a structured foundation for building and integrating modular components like data processors and API clients into Claude Desktop.5 npm-
- FlicenseNot gradedqualityDmaintenanceA simple MCP server in Python, configurable via environment variables and database, designed for integration with Claude Desktop.-