Skip to content

feat(usage): split /mcp initializes into probe / agent / unknown in /admin/activity - #89

Merged
michielinksee merged 2 commits into
mainfrom
feat/usage-probe-split
Oct 24, 2026
Merged

michielinksee merged 2 commits into
mainfrom
feat/usage-probe-split

Conversation

@michielinksee

Copy link
Copy Markdown
Member

使われ方の記録で「目録・巡回」と「エージェントの利用」を分けて数える(main から・積んでいない)

指示: founder-ops/research/Disclosure_2026-10/INSTRUCTION-agent-usage-probe-split.md。新しいデータは集めない(initialize 行に既にある client_name を読むだけ・SEC-2026-10-24-001 は変わらない)。経路不変(route-gate PASS・55 routes・58772bce…)。

A. 集計で分ける

  • src/data/mcp-client-kinds.json(手で足し引き)+ src/utils/client-kind.ts。判定の順: agent の名前(完全一致)→ probe の名前(完全一致)→ probe の語のパターン → unknown。大文字小文字は区別しない。other(64 字の検査に落ちた clientInfo)と空は unknown。パターンが壊れていたら、全部を probe にせず、パターンを無効にする。
  • agent に入れたのは手元の実機で確かめた 2 つだけ:
clientInfo.name 確かめ方(2026-10-24) User-Agent
claude-code Claude Code 2.1.301 を手元の記録用の口に繋いだ claude-code/2.1.301 (claude-desktop, agent-sdk/0.3.308)(括弧の中は起動元のアプリ)
codex-mcp-client codex-cli 0.153.4 を同じ口に繋いだ codex-mcp-client/0.153.4

Claude Desktop・claude.ai・Cursor・VS Code・Windsurf・Cline・Goose・ChatGPT は確かめられないので入れていない(今は unknown)。

  • probe: 名前 mcpbeat・glama・heldfast(どれも公開ページかソースで確認)+パターン probe|index|catalog|scanner|crawler|bot|rank|bench|verify|collector|marketplace|directory|monitor|uptime|health-?check。
  • /admin/activity の mcp_usage に追加(既存の欄はそのまま): by_client_kind(窓の中の全 client で数える。by_client の上位 20 だけではない)・initializes_excluding_probes・clients_excluding_probes(上位 20・kind 付き)。

今の本番を区分けで数え直した結果(10/24 00:25 JST に観測した by_client 上位 20 種=initialize 65 件のうち 50 件):

kind initialize client 数
probe 48 19
agent 0 0
unknown 2 1(moonglade-shadows)

残りの 15 件は上位 20 の外で、名前が見えていない。見張り画面の管理用の鍵が 10/24 の入れ替え後に 401 なので、今の全体はこの PR からは読めていない。マージと配備の後は by_client_kind がそのまま全件を数える。

B. tools_call の行を分けられるか(調べた結果・この PR では入れない)

  • 本番は stateless なので tools_call の行には client が付かない。今ある手がかりは ua_class(4 値)だけで、上の 3 つ(Claude Code・Codex・SDK)はどれも unknown になり見分けられない。
  • User-Agent は全部のリクエストに付くことを手元で確かめた。initialize だけでなく tools/list と tools/call にも付き、中身は initialize の時と同じ。
    • Claude Code → claude-code/<版> (…)
    • Codex → codex-mcp-client/<版>
    • MCP の TypeScript SDK(1.32.1)の素のクライアント → node(目録が自作する時によく使う形)
    • プローブのうち 5 つは公開ページで UA を明示している(mcpbeat/0.1 (+https://mcpbeat.com/bot/)・AgentToolIndex/1.0 (+…/method)・InvokeRankBot/0.1 (+https://invokerank.com/bot)・anlyon.dev-indexer/0.1・ElectraIndexBot)。verifymcp は第三者の記録で io.verifymcp/probe。
  • 案: tools_call 行に ua_family を 1 列足す。値は列挙値だけにする。claude-code/codex/probe(mcp-client-kinds の probe の名前・パターンを UA の先頭の語に当てる)/node/python/other。UA の生の文字列と版は残さない。これで「プローブの tools_call」と「実際のクライアントの tools_call」が分かれる。
    • 足すのは新しく集めるデータなので、SEC-2026-10-24-001 への追記と Michie の批准が要る。
    • 弱点は、UA は送り手が自由に書けること。ただ偽る動機は薄く、今の ua_class と同じ扱いになる。

C. 外の目録の一覧

founder-ops/research/Discovery/mcp-directories.md を新設した(20 行)。

区分 数
サービスが分かった 9(うち glama・verifymcp-probe は間接)
候補ページはあるが名前と結び付かない(数えない) 5
不明 6

推測では埋めていない。

確かめた

  • 新しい試験 scripts/test-client-kind.mjs 4/4: 観測した 20 の名前の振り分け・確認済みでない実クライアントは unknown・判定の順と壊れたパターン・上位 20 の外まで数える by_client_kind・probe を除いた数と一覧・/admin/activity に載ること。
  • 既存の試験はすべて緑: client-ip 4・mcp-usage 7・activity 7・ask 15・agent-id 10・public-seed 5・list-window 4・vendor-official 3・site-checks-admin 6。notes は 13/14 で、落ちる 1 件は main に既にある物(feat(ask): count service-not-found ids in /admin/activity (discovery v1) #76 の表を test-notes の一覧が知らない)。
  • route-gate ✅・site-gate ✅・pack-gate ✅(385 files。一覧の JSON を files に足した)。

やっていないこと: マージ・force-push・npm publish・本番 DB への書き込み・設定変更。

🤖 Generated with Claude Code

michielinksee and others added 2 commits October 24, 2026 00:43
…admin/activity

src/data/mcp-client-kinds.json (hand-edited list) + src/utils/client-kind.ts: clientInfo.name →
agent (exact names, confirmed only: claude-code and codex-mcp-client, both captured from local
runs on 2026-10-24) → probe (exact names mcpbeat, glama, then patterns probe|index|catalog|
scanner|crawler|bot|rank|bench|verify|collector|marketplace|directory|monitor|uptime|health-check)
→ unknown. mcp_usage gains by_client_kind (over every client in the window, not just the top 20),
initializes_excluding_probes and clients_excluding_probes; existing fields unchanged.

Reads client_name already kept on initialize rows; nothing new is collected (SEC-2026-10-24-001
unchanged). No new route. Tests: scripts/test-client-kind.mjs (4), fixture = the 20 client names
seen on production after the 1.3.0 Registry listing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michielinksee
michielinksee merged commit 3c65575 into main Oct 24, 2026
1 check passed
michielinksee added a commit that referenced this pull request Oct 24, 2026
…dendum A, awaiting ratification) (#91)

src/utils/ua-family.ts reduces the User-Agent to one of six words — claude-code, codex, probe,
node, python, other — from the product token only (text before the first "/" or space):
claude-code → claude-code, codex-mcp-client → codex, a probe by the #89 list
(src/data/mcp-client-kinds.json names and patterns) → probe, node → node, python-httpx /
python-requests / python-urllib / aiohttp / httpx / python → python, anything else → other.
The raw User-Agent and its version never leave the handler; only the word is stored.

mcp_usage_log gains ua_family (ALTER TABLE when missing; earlier rows stay NULL, not rewritten),
written on initialize and tools_call rows. /admin/activity mcp_usage gains by_ua_family (both
kinds of row) and tools_calls_excluding_probe. No new route. Tests: scripts/test-ua-family.mjs (6).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant