feat: mcp-nixosのfaviconをCaddyで直接配信する#1306
Merged
Merged
Conversation
mcp-nixos(fastmcp)自体はfaviconを提供しないため、 以前はCloudflareのリダイレクトルールでGitHub上のfaviconに302で誘導していました。 しかしMCPクライアントが使うfaviconリゾルバ(Google s2など)は、 クロスホストへのリダイレクトを追跡しないため効果がなく、 サブドメインにfaviconが無いと判定されて、 親ドメイン`ncaq.net`のfaviconにフォールバックしてしまっていました。 そこでmicrovm内にCaddyを前段として追加し、 `/favicon.ico`とトップページを200で直接配信します。 faviconはmcp-nixosリポジトリのものをコミットをpinした`fetchurl`で取得します。 `/mcp`はループバックの8081で待ち受けるmcp-nixos本体へリバースプロキシします。 ホスト側のseminarでも既にCaddyを使っているため、 一貫性を考えてリバースプロキシにはCaddyを選びました。 なおCaddyの`reverse_proxy`はtext/event-streamを検出すると、 自動でストリーミングに切り替わるためSSE向けの追加設定は不要です。 対応するCloudflare側のリダイレクトルールの削除は、 infraリポジトリの方で行います。
nvd diff: seminar (base: master)Version changes
Added packages
|
Contributor
There was a problem hiding this comment.
mcp-nixosのfavicon問題を、Cloudflareのクロスホストリダイレクト(302)からmicroVM内Caddyによる200直接配信へ切り替える変更です。faviconリゾルバがクロスホストリダイレクトを追跡しないという根本原因の分析が的確で、faviconはコミットpin付きfetchurlで再現性を確保し、mcp-nixos本体を127.0.0.1:8081のループバック待ち受けに移して外部露出をCaddy(:8080)経由のみに限定するなど、設計・多層防御ともに丁寧に作られています。SSEの自動フラッシュ挙動やメモリ見積もりの根拠もコメントで説明されており、全体として問題ありません。
ビルド評価では検証できない実機挙動(Caddy経由のSSE疎通、mcp-nixosの環境変数契約)がいくつかあるため、デプロイ後の疎通確認を推奨します。指摘はいずれも任意対応のNOTEレベルのため、APPROVEとします。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mcp-nixos(fastmcp)自体はfaviconを提供しないため、
以前はCloudflareのリダイレクトルールでGitHub上のfaviconに302で誘導していました。
しかしMCPクライアントが使うfaviconリゾルバ(Google s2など)は、
クロスホストへのリダイレクトを追跡しないため効果がなく、
サブドメインにfaviconが無いと判定されて、
親ドメイン
ncaq.netのfaviconにフォールバックしてしまっていました。そこでmicrovm内にCaddyを前段として追加し、
/favicon.icoとトップページを200で直接配信します。faviconはmcp-nixosリポジトリのものをコミットをpinした
fetchurlで取得します。/mcpはループバックの8081で待ち受けるmcp-nixos本体へリバースプロキシします。ホスト側のseminarでも既にCaddyを使っているため、
一貫性を考えてリバースプロキシにはCaddyを選びました。
なおCaddyの
reverse_proxyはtext/event-streamを検出すると、自動でストリーミングに切り替わるためSSE向けの追加設定は不要です。
対応するCloudflare側のリダイレクトルールの削除は、
infraリポジトリの方で行います。