Skip to content

feat(cli): add devmap mcp read-only MCP server (Phase 1) - #131

Merged
itsflaid merged 1 commit into
mainfrom
feat/mcp-server-mvp
Oct 29, 2026
Merged

itsflaid merged 1 commit into
mainfrom
feat/mcp-server-mvp

Conversation

@itsflaid

Copy link
Copy Markdown
Owner

Ringkasan

Fase 1 dari rencana MCP: command baru devmap mcp (server MCP via stdio, read-only). Agent bisa bertanya ke peta proyek lewat tool call alih-alih membaca file context yang di-dump.

Tool (semua read-only, tanpa AI, tanpa tulis disk)

Tool Fungsi
devmap_overview framework, stats, entry point, critical files, fitur, flow — pintu masuk agent
devmap_map peta dependensi project / fitur / file
devmap_flow trace fitur atau request end to end
devmap_routes route page/API, filter kind, prefix, method
devmap_impact dependents, impacts, dan imports sebuah file
devmap_find cari fitur/file/route lewat keyword

Resource: devmap://snapshot, devmap://devmap-md, devmap://feature/{id}.

Keputusan desain

  • Setiap hasil membawa snapshot { generatedAt, stale } + catatan saat stale.
  • Snapshot hilang/rusak → error terstruktur dengan petunjuk devmap analyze.
  • Respons dibatasi ukuran dengan flag truncated eksplisit.
  • stdout dicadangkan untuk JSON-RPC; console.log/info/debug dialihkan ke stderr.
  • devmap_analyze, auto-refresh, dan explain sengaja belum ada (Fase 2/3).
  • Id resource fitur divalidasi (^[a-z0-9][a-z0-9-]*$) → tidak bisa path traversal.

Dependency baru

@modelcontextprotocol/sdk ^1.32.2 dan zod ^4.6.7 (runtime dependency package @flaid/devmap).

Verifikasi

  • pnpm test (typecheck + unit): 452/452 (13 tes baru di mcp-server.test.ts, termasuk tes stdio dengan proses sungguhan yang memastikan stdout bersih)
  • pnpm run build ✅
  • pnpm run test:package-e2e ✅ (ditambah smoke test MCP dari tarball hasil pack: initialize, tools/list, devmap_overview)
  • Smoke test manual JSON-RPC mentah ke dist/index.js mcp ✅

Batasan yang diketahui

  • devmap_map dan devmap_flow memakai runMap/runFlow dari Fase 0, yang memindai file untuk cek stale di setiap panggilan (tidak di-cache seperti tool lain). Cukup untuk MVP; bisa dioptimalkan di Fase 2.
  • Belum ada dokumentasi/README untuk devmap mcp (fase akhir: update semua docs + landing page).

Generated by Claude Code

Run DevMap as an MCP server over stdio so AI agents can query the project
map with tool calls instead of reading dumped context files.

Tools (all read-only, no AI, no disk writes):
- devmap_overview  framework, stats, entry points, critical files, features, flows
- devmap_map       project / feature / file dependency map
- devmap_flow      trace a feature or request end to end
- devmap_routes    page/API routes, filter by kind, prefix, method
- devmap_impact    dependents, impacts and imports of a file
- devmap_find      keyword search over features, files, routes

Resources: devmap://snapshot, devmap://devmap-md, devmap://feature/{id}.

Design:
- every result carries snapshot { generatedAt, stale } plus a hint when stale
- missing/corrupt snapshot -> structured error with the `devmap analyze` hint
- responses are size-capped with an explicit `truncated` flag
- stdout is reserved for JSON-RPC; console.log/info/debug go to stderr
- snapshot provider caches by snapshot.json mtime and memoizes the staleness scan
- feature resource ids are validated (no path traversal)

Tests: 13 in-memory + stdio tests (mcp-server.test.ts) and an MCP smoke test
in the packed-package e2e.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AgTNRXcqugxRyJfMKL4AJ2
@vercel

vercel Bot commented Oct 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
devmap-web Skipped Skipped Oct 29, 2026 1:17pm UTC

@github-actions

Copy link
Copy Markdown

✅ Welcome ke DevMap!

Terima kasih sudah buat PR. Pastikan checklist ini terpenuhi sebelum review:

  • devmap doctor lolos (tanpa error)
  • Test pnpm test:cli lolos (semua pass)
  • New commands diupdate di docs/commands.md
  • Tidak ada console.log di command files
  • Registry terms sesuai standar (baca docs/guide/05-signal-registry.md)
  • Code style match dengan CONTRIBUTING.md

CI akan jalan otomatis pada setiap update. Kalau gagal, akan muncul link run di komentar ini.

Kalau DevMap membantu, tolong star ya: https://github.com/itsflaid/devmap

Terima kasih kontribusinya! 🙏

@itsflaid
itsflaid merged commit 5ea42fa into main Oct 29, 2026
3 checks passed
@itsflaid
itsflaid deleted the feat/mcp-server-mvp branch October 29, 2026 13:18

This branch was previously deployed

1 inactive deployment
Preview — aa8d9a47 Deployed Oct 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants