-
Notifications
You must be signed in to change notification settings - Fork 718
MCPサーバ実装 #6832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
MCPサーバ実装 #6832
Changes from all commits
Commits
Show all changes
91 commits
Select commit
Hold shift + click to select a range
4e797dd
chore: apply Rector to codeception fixture BundleCompilerPass
dotani1111 d0787f8
feat: MCP サーバ土台と商品/在庫 3 ツールを追加
dotani1111 0527b4c
test(mcp): 商品/在庫 3 Tool の DB 結合テスト
dotani1111 bf61603
fix(mcp): EntityArraySerializer の Doctrine Proxy 対応 + 深さデフォルトを 1 に
dotani1111 e708261
feat(mcp): 注文領域 3 ツールを追加 (search_orders / get_order / get_shipping)
dotani1111 2801d7a
feat(mcp): 顧客会員領域 3 ツールを追加 (search_customers / get_customer / get_cus…
dotani1111 28e78a0
feat(mcp): プラグイン管理 2 ツールを追加 (list_plugins / get_plugin)
dotani1111 4722657
fix(mcp): scope 不足を ToolCallException で返す
dotani1111 273096f
fix(mcp): Get 系 Tool の不在応答を {"found": false} に統一
dotani1111 80396f7
feat(mcp): IP / client_id 2 段の Rate Limiter を追加
dotani1111 7ed1f07
test(mcp): tools/list と allow_list の契約テストを追加
dotani1111 83cea02
feat(mcp): mcp チャネル直書きを禁止する PHPStan custom rule を追加
dotani1111 3cf35d6
test(mcp): MCP firewall が oauth2 経路を通ることを統合テスト化
dotani1111 03fc2c2
test(mcp): 失効 / Member 無効化で即 401 をテスト化 (AC #6 #9)
dotani1111 16e1b0f
test(mcp): Api44 install/enable で MCP 依存登録を担保 (AC #7)
dotani1111 2e1f316
refactor(mcp): scope 検査を中央 ReferenceHandler 層に集約 (設計案 A)
dotani1111 8dc4c9a
refactor(mcp): 監査ログの単一入口を alias 削除で保証 (PHPStan rule 撤去)
dotani1111 2ba2692
fix(mcp): Rate Limiter を cache 障害時 fail-closed にする
dotani1111 962cd6e
test(mcp): 正常 JWT 受理を 200 + JSON-RPC result で検証
dotani1111 9d73280
test(mcp): 全 Tool が McpToolScopeMap に scope を持つ契約テストを追加
dotani1111 80c89d4
fix(mcp): 監査ログ alias 削除の空振りを build 失敗で検出する
dotani1111 e319562
test(mcp): scope 強制の配線を回帰テストで担保
dotani1111 ac42582
fix(mcp): Rate Limiter の監査ログ失敗で拒否レスポンスを崩さない
dotani1111 3a4ca7e
fix(mcp): 監査ログ失敗時に default チャンネルへフォールバック記録する
dotani1111 92c7d03
test(mcp): 401 の WWW-Authenticate と経路を検証する
dotani1111 05f2d28
fix(mcp): 監査ログを専用ファイル mcp.log に分離する
dotani1111 eca5f3d
test(mcp): 監査ログが mcp.log に分離され site.log に漏れないことを担保
dotani1111 ddd1fd0
feat(mcp): 認証失敗(401)を mcp.log に記録する
dotani1111 c264a87
test(mcp): 認証失敗ログの reason 分岐 (ヘッダ有無) を検証
dotani1111 aca6597
Merge branch '4.4' into feature/poc-mcp
dotani1111 6b3b383
fix(mcp): 関連 Entity 要約の id 露出を allow_list で塞ぐ
dotani1111 05c29cf
fix(mcp): Tool の検索キーを正規化し日付書式を検証する
dotani1111 73228c8
fix(mcp): Tool 結果の data 契約違反を内部エラーとして扱う
dotani1111 2c610fe
test(mcp): 検索系テストを作成データの出現まで検証する
dotani1111 fa5fad4
style(mcp): 型注釈と重複する @param mixed $level を除去する
dotani1111 3ccae9a
fix(mcp): 本体を Api44/league クラスへのハード依存から切り離す
dotani1111 525091b
test(mcp): Api44 前提テストを mcp グループに分離し専用 CI ジョブで実走
dotani1111 1db2254
fix(ci): mcp ジョブの Api44 アーカイブを dist 展開可能な形式にする
dotani1111 ec85cd4
ci(mcp): Api44 を MCP firewall を含む feat/mcp-server-scorp で導入する
dotani1111 f0d801d
Merge branch '4.4' into feature/poc-mcp
dotani1111 324cbab
fix(mcp): 既定 lock を flock に固定し sysvsem 依存を外す
dotani1111 2cbe649
test(mcp): 401 の WWW-Authenticate に resource_metadata が載ることを縛る
dotani1111 feb8806
test(mcp): 401 の WWW-Authenticate を先頭一致で検証し resource_metadata 付与を許容する
dotani1111 8fd3932
fix(mcp): builder 不在時は scope 強制パスを早期 return する
dotani1111 dec195e
refactor(mcp): 早期 return 後の冗長な builder 存在チェックを除去
dotani1111 5155b41
feat(mcp): search_* をサマリ射影にしレスポンスを軽量化
dotani1111 15c4f26
feat(mcp): get_* の重い関連を id 要約へ縮退
dotani1111 eb6b44a
Merge branch '4.4' into feature/poc-mcp
dotani1111 f610f94
fix(mcp): McpSummaryFieldsTest の DataProvider 属性を rector ルールに合わせる
dotani1111 f2922d3
Merge branch '4.4' into feature/poc-mcp
dotani1111 1005a50
test(mcp): MCP サーバの Playwright E2E を追加
dotani1111 5ca7d54
fix(ci): MCP e2e ジョブを既存 playwright と同じ混成環境にする
dotani1111 13e0896
Merge branch '4.4' into feature/poc-mcp
dotani1111 6d8fe2e
fix(mcp): codeception 環境でも監査ログを site.log から分離する
dotani1111 ae5bfac
fix(mcp): get_customer_orders をサマリ射影にし customer scope からの明細露出を止める
dotani1111 58aa661
feat(mcp-cli): eccube:mcp:tools / eccube:mcp:call を追加
dotani1111 c9821a4
feat(mcp-cli): MCP ツールを per-tool の eccube:cli:* コマンドとして提供する
dotani1111 7cedb54
refactor(mcp-cli): 入力スキーマ解釈を ToolInputSchema VO に集約する
dotani1111 2714261
Merge remote-tracking branch 'upstream/4.4' into feature/mcp-cli-round2
dotani1111 4a39714
fix(mcp-cli): ToolInputSchema の properties を array|\stdClass 実型で受ける
dotani1111 81a1681
fix(mcp-cli): ToolInputSchema を final readonly class にする
dotani1111 ab03e47
fix(mcp): 監査ログ隔離契約テストを e2e env リネームに追従させる
dotani1111 4e11cbc
fix(ci): mcp e2e ジョブの APP_ENV を e2e env リネームに追従させる
dotani1111 183f4e4
fix(mcp-cli): boolean cast の不正値を失敗にし ToolInputSchema の読取を防御する
dotani1111 24949a1
test(mcp): ToolInputSchema / McpMarkdownFormatter の単体テストを追加する
dotani1111 48a3ae2
fix(mcp): search_products の解決不能な statusIds でフィルタ落ちを防ぐ
dotani1111 ca034b5
fix(mcp): Markdown 整形と型正規化の端ケースを堅牢化する
dotani1111 1d611c3
Merge remote-tracking branch 'upstream/4.4' into feature/mcp-cli-round2
dotani1111 d17d2d6
chore(mcp): framework.yaml と重複する lock.yaml を削除する
dotani1111 146b2ae
fix(mcp-cli): ツールの description をタグに渡し list/help での全コマンド実体化を防ぐ
dotani1111 c15af8d
test(mcp-cli): cast() の型変換分岐の単体テストを追加する
dotani1111 9b0b4bc
fix(mcp): 在庫絞り込みを EXISTS 部分クエリにし価格/在庫レンジの縮みを防ぐ
dotani1111 b8b97e9
fix(mcp): 会員・注文検索の解決不能 statusIds を 0 件にし注文番号を trim する
dotani1111 20c9339
test(mcp): 検索ツール修正の回帰テストを追加する
dotani1111 57a5678
fix(mcp): 許可リスト未設定時に prod では検証不能な Origin を拒否する
dotani1111 ba01755
test(mcp): クロス scope 拒否テストを customer/plugin に拡充する
dotani1111 887fce8
docs(mcp): /admin/mcp の認可境界と scope 検査の規約を追加する
dotani1111 175162b
test(mcp): mcp scope 無し token が /admin/mcp で 403 になることを縛る
dotani1111 43f00ec
test(mcp): 失効テストの有効 JWT に mcp read scope を付与する
dotani1111 43a3e3b
Merge upstream/4.4 into feature/mcp-cli-round2
dotani1111 de7f6d3
fix(test): 購入フローの service は文字列 ID で取得し rector skip を統合する
dotani1111 fad62d9
feat(mcp): tools/list を現トークンの scope で絞る
dotani1111 9dff975
chore(mcp): symfony/mcp-bundle 0.12 / mcp/sdk 0.7 へ更新
dotani1111 ac3dc83
Merge upstream/4.4 into feature/mcp-cli-round2
dotani1111 2782714
fix(mcp): search_products の在庫絞り込みを単一 EXISTS + 表示規格限定にする
dotani1111 0b8eff6
fix(test): 在庫テストの setStock を string 化し在庫比較を数値化する
dotani1111 053c2df
Merge upstream/4.4 into poc-mcp
dotani1111 4e71fb8
feat(mcp): MCP 機能の ON/OFF トグルを追加する(既定 OFF)
dotani1111 8f05cfc
test(e2e): MCP e2e 用に setup-fixtures で mcp_enabled を有効化する
dotani1111 6c59f1a
Merge upstream/4.4 into poc-mcp
dotani1111 7d7a895
fix(test): CustomerStatus::ACTIVE 撤去に追随し REGULAR で絞り込む
dotani1111 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| services: | ||
| Psr\Http\Message\RequestFactoryInterface: '@http_discovery.psr17_factory' | ||
| Psr\Http\Message\ResponseFactoryInterface: '@http_discovery.psr17_factory' | ||
| Psr\Http\Message\ServerRequestFactoryInterface: '@http_discovery.psr17_factory' | ||
| Psr\Http\Message\StreamFactoryInterface: '@http_discovery.psr17_factory' | ||
| Psr\Http\Message\UploadedFileFactoryInterface: '@http_discovery.psr17_factory' | ||
| Psr\Http\Message\UriFactoryInterface: '@http_discovery.psr17_factory' | ||
|
|
||
| http_discovery.psr17_factory: | ||
| class: Http\Discovery\Psr17Factory |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| mcp: | ||
| app: 'EC-CUBE MCP Server' | ||
| version: '4.4.0' | ||
| description: 'EC-CUBE 4.4 の管理データ (商品/在庫・注文・顧客会員・プラグイン管理) を AI クライアントから自然言語で参照する読み取り専用 MCP サーバ。 認証認可は API プラグイン (api44) の OAuth2 / scope に委譲する。' | ||
| client_transports: | ||
| http: true | ||
| stdio: true | ||
| http: | ||
| path: '/%eccube_admin_route%/mcp' | ||
| session: | ||
| store: file |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # MCP サーバの Rate Limiter 設定 (設計 §5「Rate Limiter 連携」)。 | ||
| # | ||
| # 2 段構成: | ||
| # - mcp_ip: リモート IP 単位の制限 (firewall 前で消費、 認証エラー連発攻撃にも効く) | ||
| # - mcp_client: OAuth2 client_id 単位の制限 (firewall 通過後の OAuth2Token から client_id を取得して消費) | ||
| # | ||
| # 既定値は PoC レベルの控えめな値。 GA 運用開始時に再評価する。 | ||
| framework: | ||
| rate_limiter: | ||
| mcp_ip: | ||
| policy: fixed_window | ||
| limit: 60 | ||
| interval: '1 minute' | ||
| cache_pool: rate_limiter.cache | ||
| mcp_client: | ||
| policy: fixed_window | ||
| limit: 300 | ||
| interval: '1 minute' | ||
| cache_pool: rate_limiter.cache |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,14 @@ | ||
| monolog: | ||
| channels: ['front', 'admin', 'cookie_consent'] | ||
| channels: ['front', 'admin', 'mcp', 'cookie_consent'] | ||
| handlers: | ||
| # MCP 監査ログ: PII を含み得るため site.log と分離した専用ファイルに、 1 レコード 1 JSON で出力する。 | ||
| # fingers_crossed を挟まず info から常時書き出す (監査記録は error 連動で握り潰してはならない)。 | ||
| # 保管日数は ECCUBE_MCP_LOG_RETENTION_DAYS (既定 90)。 ファイルは所有者/グループのみ読める権限にする。 | ||
| mcp: | ||
| type: rotating_file | ||
| path: '%kernel.logs_dir%/%kernel.environment%/mcp.log' | ||
| channels: ['mcp'] | ||
| level: info | ||
| formatter: eccube.mcp.log.formatter.json | ||
| max_files: '%env(int:ECCUBE_MCP_LOG_RETENTION_DAYS)%' | ||
| file_permission: 0640 |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.