Server logs full JSON-RPC payloads, tool arguments included, at info level
維護者通常 1 天內回覆
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 74/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- php
研究方向
Start in src/Server/Protocol.php and inspect the four info-level logging paths for received messages, requests, responses, and notifications. Compare them with CallToolHandler's debug logging and the Logger example in docs/run/server-builder.md. Done means info logs retain method/ID-level details without payloads, full payloads are available at debug, and the relevant logging tests pass.
由索引模型根據 Issue 內容生成。
描述
Protocol passes every incoming message to the PSR-3 logger as context at info level:
// src/Server/Protocol.php (main @ 3175614b)
$this->logger->info('Received message to process.', ['message' => $input]); // raw JSON input
$this->logger->info('Handling request.', ['request' => $request]); // whole request object
$this->logger->info('Handling response from client.', ['response' => $response]); // sampling/elicitation replies
$this->logger->info('Handling notification.', ['notification' => $notification]);
For a tools/call, that's the tool arguments twice, at the level most production setups keep. A sampling or elicitation reply puts what the user typed in the log the same way.
The builder docs (docs/run/server-builder.md, "Logger") show:
$logger = new Logger('mcp-server');
$logger->pushHandler(new StreamHandler('mcp.log', Logger::INFO));
Monolog's default LineFormatter writes the full context with each record. So a server set up as documented stores every tool argument in mcp.log. Tool calls can carry content an application wouldn't otherwise log, such as personal data, document text, or credentials a user pastes into a prompt.
CallToolHandler already keeps payloads at debug (Executing tool with arguments, Tool executed successfully with structured_content). That seems like the right split, and Protocol doesn't follow it.
Proposal: at info, log the method and ID only, and move the full payload to debug. For example:
$this->logger->info('Handling request.', ['method' => $request::getMethod(), 'id' => $request->getId()]);
$this->logger->debug('Request payload.', ['request' => $request]);
"Received message to process." could drop the raw input at info entirely, since the per-message lines that follow already name the method.
Downstream, the Drupal integration filters payloads out of the context in its logger decorator, because its database log is readable by site administrators: https://git.drupalcode.org/project/mcp_server/-/work_items/3585937. Fixing the levels in the SDK would let every integration control this with a normal log level.
- 主要語言
- PHP
- 星號
- 1.6k
- 分支
- 180
- 平均合併
- 2 天 3 小時
- 30 天內合併 PR
- 70
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
modelcontextprotocol/php-sdk 的其他 Issue
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStan未關閉Server
難度 1/5 1 小時以內 新手友好度 78/100
modelcontextprotocol/php-sdk#468 · 2 則留言 ·
維護者通常 1 天內回覆
-
Builder::build() silently skips configured file-based discovery when symfony/finder is missing — should fail loudly可能已有人在做 @ousamabenyounes 於 61 天前認領。 未關閉needs confirmation needs maintainer action Server
難度 2/5 1-3 小時 新手友好度 68/100
modelcontextprotocol/php-sdk#398 · 1 個 reaction ·
維護者通常 1 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 68/100
modelcontextprotocol/php-sdk#370 ·
維護者通常 1 天內回覆
-
[Server] `listChanged` is not announced for a registry wired to the bus by the caller可能已有人在做 @chr-hertel 今天認領。 未關閉
難度 5/5 一週以上 新手友好度 25/100
modelcontextprotocol/php-sdk#607 ·
維護者通常 1 天內回覆
-
enhancement
難度 4/5 3-5 天 新手友好度 52/100
modelcontextprotocol/php-sdk#587 ·
維護者通常 1 天內回覆
查看 modelcontextprotocol/php-sdk 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 65/100
維護者通常 1 天內回覆
-
needs triage
難度 2/5 1-3 小時 新手友好度 66/100
-
bug
難度 2/5 1-3 小時 新手友好度 88/100
-
難度 2/5 1-3 小時 新手友好度 88/100
grokability/snipe-it#19857 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 92/100
維護者通常 1 天內回覆