portmap
portmap
あなたのエージェントは localhost:3000 をハードコードしています。これは、実際に動いているものをマッピングします。
git clone https://github.com/paladini/portmap.git && cd portmap
npm ci && npm run build && node dist/cli.js scan /path/to/your-app決定的 · LLM不使用 · ネットワーク不要 · 読み取り専用
これは何?
portmap は、コマンドラインツール + MCP サーバーであり、次の1つの問いに答えます。
あなたのエージェントが
curl localhost:3000を実行する前に、実際にそこでリッスンしているものはありますか?
ローカル開発の現実の3つの層を、1つのマップに統合します。
宣言 (Declared) —
vite.configのポート、package.jsonのスクリプト、.envの URL、docker-compose実態 (Actual) — OS が現在リッスンしていると報告するもの (Windows、macOS、Linux)
接続 (Connected) — 環境変数 (
VITE_API_URL,API_URL, …) がサービス同士をどう結び付けているか
出力: .portmap.json + エージェントや CI が推測せずに扱える実用的な指摘 (PRT-01 … PRT-07)
どんな人向け?
**「kill port 3000」や「works on my machine」**のポートずれに疲れた開発者
間違った localhost をハードコードする AI コーディングエージェント (Cursor、Claude Code、Copilot) を使っているチーム
フロントエンドと API が兄弟フォルダに置かれ、環境変数参照がリポジトリをまたぐモノレポ
API 接続のデバッグ前に 5秒のサニティチェック が欲しい人
これはそういうものではない
期待 | 現実 |
開発サーバーの起動 / 停止 | いいえ — ライフサイクルは Switchboard または PortPilot を使用 |
自分で管理するポート台帳 | いいえ — portmap は設定ファイルと OS から発見します |
本番モニタリング / アップタイム | いいえ — ローカル開発のトポロジーのみ |
LLM でポートを推測する | いいえ — 100% 決定的なファイルシステム + ソケットテーブル |
プロセスを終了する必要があるなら、OS のツールを使ってください。portmap は、20分を無駄にする前に、どのポートを叩けばいいかを教えてくれます。
Related MCP server: devenv-doctor-mcp
問題
AI支援の開発セッションでは、遅かれ遅かれ必ずこれにぶつかります。
Agent: fetch('http://localhost:3000/api/users')
Reality: Vite on :5173, API on :8080, nothing on :3000なぜ起きるのか:
Next.js はデフォルトで
:3000— エージェントはそれを覚えてしまうVite はデフォルトで
:5173— スタックが違えばポートも違うDocker は
8080:3000をリマップ — アプリがコンテナ内部でリッスンしていて、あなたが思う場所では待ち event not matching.env.localが、今日誰も起動していないポートを指している実際のバグが PRT-04 なのに、CORS、認証、「network error」を20分間デバッグしてしまう
portmap は、宣言されたものと実際のポートを数秒で照らし合わせます。症状ではなく、URL を修正できるのです。
仕組み
2つのスキャナー、1つの統合ステップ、LLM ゼロ:
┌─────────────────────────────────────────────────────────────┐
│ Your repo on disk │
├─────────────────────────────────────────────────────────────┤
│ 1. Static discovery │
│ package.json scripts · vite.config · .env localhost URLs│
│ docker-compose port mappings │
├─────────────────────────────────────────────────────────────┤
│ 2. Runtime scan (optional) │
│ OS listeners → port, PID, process, command line │
├─────────────────────────────────────────────────────────────┤
│ 3. Reconcile │
│ declared ↔ actual ↔ env references → service graph │
│ → .portmap.json + findings (PRT-01 … PRT-07) │
└─────────────────────────────────────────────────────────────┘
↓ ↓ ↓
CLI pretty MCP tools CI --min-findings完全なルール一覧: docs/FINDINGS.md · 修正前後の例: docs/EXAMPLES.md · JSON 仕様: docs/SCHEMA.md
30 秒で触ってみる
git clone https://github.com/paladini/portmap.git
cd portmap
npm ci && npm run build
npm run demo:mismatch # classic agent mistake → 3 errors
npm run demo:workspace # frontend + API in sibling folders → resolveddemo:mismatch の出力例
portmap — mismatch-app
root: …/fixtures/mismatch
Services:
[down] vite — Vite dev server
declared :5173 (vite.config.ts:server.port)
not listening
Env references:
NEXT_PUBLIC_API_URL=http://localhost:3000 → :3000 [unresolved]
VITE_API_URL=http://localhost:8080 → :8080 [unresolved]
Findings: 3 error(s), 0 warning(s)
✖ PRT-01 Declared port 5173 is not listening …
✖ PRT-04 NEXT_PUBLIC_API_URL points to localhost:3000 but nothing is listening …
✖ PRT-04 VITE_API_URL points to localhost:8080 but nothing is listening …エージェントが最初に .portmap.json を読めば、これだけでデバッグセッションすべてをスキップできます。
インストールと実行
方法 A — クローン (今すぐ動作)
git clone https://github.com/paladini/portmap.git
cd portmap
npm ci && npm run build
node dist/cli.js scan /path/to/your-app方法 B — npm (公開時)
npx portmap scan .標準的なワークフロー
実行 —
portmap scan .を実行 (まだ何も起動していない場合はportmap declare .)確認 —
references[]から正しい localhost URL を見つける。:3000と仮定しない修正 — API 接続のデバッグ前に PRT-04 (壊れた環境変数 URL) を直す
保存 — 将来のエージェントセッションのために
.portmap.jsonを書き出す:portmap scan . --write任意 (Optional) —
--min-findings 1 --min-severity errorで CI をゲートする
コマンド
コマンド | できること |
| 静的設定 + OS リスナーを含むフルスキャン |
| 静的設定のみ — 実行中プロセスは不要 |
| OS のリスナーを一覧表示 (デバッグ用) |
| マルチリポスト: フォルダをまたぐ環境変数参照を解決 |
| 読み取り専用の MCP stdio サーバーを起動 |
フラグ: --json · --markdown · --write (.portmap.json を保存) · --out <file> · --min-findings N · --quiet
検出結果 (Findings) 一覧
ID | ルール | 重大度 |
PRT-01 | 宣言されたポートがリッスンしていない | error |
PRT-02 | 宣言されていないリスナーが存在する | warning |
PRT-03 | 2つのサービスが同じポートを宣言 | error |
PRT-04 | 環境変数URLが, 待ち受けるポートを指す | error |
PRT-05 | 宣言と異なるポートでリッスンしている | warning |
PRT-06 | Docker ホスト・コンテナ間のポート不一致 | warning |
PRT-07 | ワークスペースをまたぐ環境変数参照が未解決 | error |
修正方法を含む完全な一覧: docs/FINDINGS.md
エージェント向け MCP (読み取り専用)
.cursor/mcp.json または Claude Code の設定に追加:
{
"mcpServers": {
"portmap": {
"command": "node",
"args": ["/path/to/portmap/dist/cli.js", "mcp"]
}
}
}ツール | 用途 |
| 完全な |
| 軽量な |
| 「 |
| PRT-* を重大度でフィルタリングして一覧化 |
Cursor / Claude 用スキル: .cursor/skills/portmap/SKILL.md
.portmap.json — エージェントが読む成果物
portmap scan . --write
git add .portmap.json # optional: commit for stable agent context仕様: docs/SCHEMA.md
エージェント対応度のパイプライン
paladini agent toolkit の一部 — 3つの決定的なチェック、LLM ゼロ:
harness-score → Is the repo harness ready for agents?
portmap → Do ports and env URLs align locally?
unhappypath → Is the UI ready for real users?なツール | 評価する質問 |
AGENTS.md、ルール、hooks、CI の成熟度 | |
portmap | 宣言されたポート、リスナー、環境変数グラフ |
ローディング / 空 / エラー / リトライ UI 状態 |
制限事項 (正直に言う)
PID → リポジトリの帰属はヒューリスティックです。低信頼の一致は非表示にし続けるのではなくフラグします。
WSL2 / Docker ネットワーキング — コンテナ内のリスナーがホスト上に期待どおり現れない場合があります。
実行時のみのポート (設定ファイルのない JS にハードコード) は宣言されない — PRT-02 が警告する可能性があります。
YAML compose — 一般的な
ports:パターンは解析されますが、特殊な compose 機能はスキップされます。騒がしい false positive より false negative を優先します。不確かなら、portmap は沈黙します。
コントリビューション
Issue の起票、誤検出の報告、パーサーのコントリビューションを歓迎します。
参照: CONTRIBUTING.md · ROADMAP.md · CODE_OF_CONDUCT.md
セキュリティの問題は SECURITY.md で受け付けています — 公開の issue には起票しないでください。
開発
npm ci
npm run build
npm test
npm run demo:mismatch
npm run demo:workspaceエージェント / コントリビューター向けガイド: AGENTS.md
ライセンス
MIT © 2026 Fernando Paladini
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to discover, configure, and manage local development servers. Provides tools for app registration, port allocation, lifecycle control, and log access without manual config editing.338MIT
- AlicenseNot gradedqualityCmaintenanceEnables LLM clients to inspect local dev environments—Docker container health, pnpm workspace integrity, and stuck process detection—without manual terminal copy-pasting.MIT
- AlicenseNot gradedqualityBmaintenanceSee and control the local dev servers your coding agents leave running. Lists listeners with provenance — which agent, terminal and git worktree started each — kills strays, and allocates collision-free ports so parallel agents stop fighting over :3000.MIT
- AlicenseNot gradedqualityAmaintenanceMCP server for managing local dev ports on macOS. It enables AI agents to inspect listening ports, identify owning processes and parent chains, kill processes safely, wait for ports, and report LAN exposure.291MIT
Related MCP Connectors
Give your AI agent a persistent map of your project's structure, dependencies, and bugs.
Lints + auto-fixes how AI coding agents discover any new product. 24 rules, 6 tools, score 0-100.
Scan any URL for AI agent readability — Vercel Spec, llmstxt.org, and agent-protocol manifests.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/paladini/portmap'
If you have feedback or need assistance with the MCP directory API, please join our Discord server