api-investigator
БесплатноБез исполняемых скриптовНе проверенnote.com APIの調査を支援します。mitmproxyとPlaywrightを使用してHTTPトラフィックをキャプチャ・分析し、API動作を解明します。
от diegosouzapw★ 68 звёзд на GitHubОб этом скилле
API Investigator スキル
このスキルは、note.com APIの動作を調査するためのinvestigatorモジュールの利用方法を提供します。
起動条件
以下の状況で起動します:
- API動作の調査時: note.com APIのリクエスト/レスポンス形式を確認する際
- 新機能の実装前調査: 未知のAPIエンドポイントの動作を理解する必要がある際
- バグ調査時: API通信に関連する問題を診断する際
- ProseMirrorエディタ調査時: note.comのエディタDOM構造やイベントを調査する際
- 認証フロー調査時: ログイン・セッション管理の動作を確認する際
前提条件
必要なソフトウェア
- mitmproxy(mitmdumpコマンド)
- Playwright
インストール
# 開発依存関係のインストール(mitmproxy含む)
uv sync --group dev
# Playwrightブラウザのインストール
uv run playwright install chromium
使用方法
1. トラフィックキャプチャ
# 基本的なキャプチャ(セッション自動復元)
uv run python -m note_mcp.investigator capture
# ドメインフィルタ付きキャプチャ
uv run python -m note_mcp.investigator capture --domain api.note.com
# 出力ファイル指定
uv run python -m note_mcp.investigator capture -o my_capture.flow
# セッション復元なし(新規ログイン必要)
uv run python -m note_mcp.investigator capture --no-session
# カスタムポート
uv run python -m note_mcp.investigator capture --port 8888
2. キャプチャ分析
# 基本的な分析
uv run python -m note_mcp.investigator analyze traffic.flow
# パターンで検索
uv run python -m note_mcp.investigator analyze traffic.flow --pattern citation
# ドメインとメソッドでフィルタ
uv run python -m note_mcp.investigator analyze traffic.flow --domain api.note.com --method POST
3. JSONエクスポート
# JSON形式でエクスポート
uv run python -m note_mcp.investigator export traffic.flow -o api_calls.json
# ドメインフィルタ付きエクスポート
uv run python -m note_mcp.investigator export traffic.flow --domain api.note.com
セッション管理
自動セッション復元
note_login MCPツールでログイン済みの場合、保存されたセッションCookieが自動的にブラウザに注入されます。
captureコマンド実行
↓
SessionManagerからCookie読み込み
↓
PlaywrightブラウザにCookie注入
↓
ログイン状態でキャプチャ開始
セッションがない場合
- ブラウザが開く
- note.comに手動でログイン
- 調査操作を実行
- ブラウザを閉じてキャプチャ終了
調査ワークフロー例
例1: 引用(blockquote)出典APIの調査(実績あり)
# Step 1: note.comへのトラフィックをキャプチャ
uv run python -m note_mcp.investigator capture -d note.com -o citation.flow
# ブラウザで:
# 1. 新規記事作成画面(/notes/new)を開く
# 2. 引用ブロックを追加
# 3. 出典を入力
# 4. 下書き保存
# 5. ブラウザを閉じる
# Step 2: draft_save APIを分析
uv run python -m note_mcp.investigator analyze citation.flow --pattern draft_save
# Step 3: 詳細をJSONでエクスポート
uv run python -m note_mcp.investigator export citation.flow -o citation_api.json
# Step 4: Pythonで詳細確認
uv run python -c "
import json
with open('citation_api.json') as f:
data = json.load(f)
for item in data:
req = item.get('request', {})
if 'draft_save' in req.get('url', ''):
body = json.loads(req.get('body', '{}'))
print(json.dumps(body, indent=2, ensure_ascii=False))
"
調査結果例(2024-12-30実施)
引用の出典はAPIで以下のHTML構造として送信されることが判明:
<figure name="UUID" id="UUID">
<blockquote>
<p name="UUID" id="UUID">引用テキスト<br>改行も可能</p>
</blockquote>
<figcaption>出典URL(例: example.com)</figcaption>
</figure>
<figure>で全体をラップ<blockquote><p>内に引用テキスト<figcaption>に出典情報- 改行は
<br>タグ
例2: 画像アップロードAPIの調査
# アップロード関連のトラフィックをキャプチャ
uv run python -m note_mcp.investigator capture -d note.com -o upload.flow
# ブラウザで画像をアップロード後、閉じる
# POSTリクエストのみ分析
uv run python -m note_mcp.investigator analyze upload.flow --method POST --pattern upload
例3: 新規ログインでの調査
# セッション復元なしでキャプチャ(認証フロー調査)
uv run python -m note_mcp.investigator capture --no-session -o auth.flow
# ブラウザでログイン操作を実行
# 認証関連のリクエストを分析
uv run python -m note_mcp.investigator analyze auth.flow --pattern "login\|session\|auth"
CLIオプション一覧
capture コマンド
| オプション | 短縮形 | デフォルト | 説明 |
|---|---|---|---|
--output |
-o |
traffic.flow |
出力ファイルパス |
--url |
-u |
https://note.com |
初期表示URL |
--port |
-p |
8080 |
プロキシポート |
--domain |
-d |
なし | ドメインフィルタ |
--no-session |
- | False |
セッション復元を無効化 |
analyze コマンド
| オプション | 短縮形 | 説明 |
|---|---|---|
--pattern |
-p |
正規表現パターンで検索 |
--domain |
-d |
ドメインでフィルタ |
--method |
-m |
HTTPメソッドでフィルタ |
--body |
-b |
リクエスト/レスポンスボディを表示 |
export コマンド
| オプション | 短縮形 | デフォルト | 説明 |
|---|---|---|---|
--output |
-o |
traffic.json |
出力JSONファイル |
--domain |
-d |
なし | ドメインでフィルタ |
MCPツール(AI自律調査用)
AI(Claude Code/Claude Desktop)がMCPツールを直接呼び出してAPI調査を自律実行できます。 Docker内でブラウザ操作とトラフィック分析が完結します。
前提条件
# Docker環境でinvestigatorサービスを起動
docker compose up -d investigator
# VNC経由でブラウザ動作を確認(オプション)
vncviewer localhost:5900
キャプチャ制御ツール
investigator_start_capture
キャプチャセッションを開始します。
investigator_start_capture(domain: str, port: int = 8080) -> str
| パラメータ | 型 | デフォルト | 説明 |
|---|---|---|---|
| domain | str | - | キャプチャ対象ドメイン(例: "api.note.com") |
| port | int | 8080 | プロキシポート |
戻り値: セッション開始の成功/失敗メッセージ
investigator_stop_capture
キャプチャセッションを停止します。
investigator_stop_capture() -> str
戻り値: セッション終了の成功/失敗メッセージ
investigator_get_status
現在のキャプチャセッション状態を取得します。
investigator_get_status() -> str
戻り値: セッション状態(アクティブ/非アクティブ、キャプチャ済みリクエスト数
Установить api-investigator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadEditWriteGlobGrepBashВложенные файлы
FAQ
Что делает скилл api-investigator?
note.com APIの調査を支援します。mitmproxyとPlaywrightを使用してHTTPトラフィックをキャプチャ・分析し、API動作を解明します。
Как установить скилл api-investigator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл api-investigator запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic