目的
npm client proxy の OAuth 認証で、起動ごとに変わる localhost callback port と過去の Dynamic Client Registration が不一致になり、GitHub の redirect_uri is not associated with this application 警告で認証不能になる問題を解消する。
前提
startOAuthFlow() は callbackServer.listen(0, 127.0.0.1) により毎回ランダムな port を選ぶ。
- authorization request の
redirect_uri は今回の port から生成される。
ensureClientRegistration() は oauth-client.json が存在すると、その登録済み redirect_uris を検証せず無条件に再利用する。
- 実際の cached registration は
redirect_uris を保持しているため、今回要求する URI 集合との互換性を事前判定できる。
- cached client が前回 port だけを登録している場合、今回の callback URI は GitHub 側で拒否される。
- 実画面で
redirect_uri is not associated with this application を確認済み。
制約
- cached registration の
redirect_uris が今回要求する callback URI 群を全て含む場合だけ再利用する。
- 不一致または旧形式の cache は Dynamic Client Registration をやり直し、cache を安全に置換する。
- access token / refresh token / client registration の値をログへ出さない。
- callback port のランダム割当と PKCE S256 は維持する。
- compatible / stale / malformed cache の回帰テストを追加し、通常CIで実行する。
対象ファイル
mcp-server/server/index.js: cached client registration の互換性判定を接続する。
mcp-server/server/oauth-client-registration.js: redirect URI 集合の純粋な互換性判定。
mcp-server/test/oauth-client-registration.test.js: 回帰テスト。
mcp-server/package.json: test script の更新。
.github/workflows/ci.yml: npm client proxy tests の常時実行。
mcp-server/README.md: cache 再登録動作と troubleshooting の更新。
docs/0-requirements.md / docs/0-requirements.ja.md: OAuth client registration reuse 条件を仕様化。
目的
npm client proxy の OAuth 認証で、起動ごとに変わる localhost callback port と過去の Dynamic Client Registration が不一致になり、GitHub の
redirect_uri is not associated with this application警告で認証不能になる問題を解消する。前提
startOAuthFlow()はcallbackServer.listen(0, 127.0.0.1)により毎回ランダムな port を選ぶ。redirect_uriは今回の port から生成される。ensureClientRegistration()はoauth-client.jsonが存在すると、その登録済みredirect_urisを検証せず無条件に再利用する。redirect_urisを保持しているため、今回要求する URI 集合との互換性を事前判定できる。redirect_uri is not associated with this applicationを確認済み。制約
redirect_urisが今回要求する callback URI 群を全て含む場合だけ再利用する。対象ファイル
mcp-server/server/index.js: cached client registration の互換性判定を接続する。mcp-server/server/oauth-client-registration.js: redirect URI 集合の純粋な互換性判定。mcp-server/test/oauth-client-registration.test.js: 回帰テスト。mcp-server/package.json: test script の更新。.github/workflows/ci.yml: npm client proxy tests の常時実行。mcp-server/README.md: cache 再登録動作と troubleshooting の更新。docs/0-requirements.md/docs/0-requirements.ja.md: OAuth client registration reuse 条件を仕様化。