Thanks for your interest in contributing. This guide covers the setup, workflow, and conventions used in this project.
- Node.js 18+ (we use native
fetchand top-levelawait) - npm 9+ (workspaces support)
- Git
git clone https://github.com/amgb20/MPP-Inspector.git
cd mpp-inspector
npm install
npm run buildThis is an npm workspaces monorepo:
mpp-inspector/
+-- packages/
| +-- cli/ # Main CLI tool (published as `mpp-inspector`)
| | +-- bin/ # CLI entry point
| | +-- src/
| | | +-- commands/ # One file per CLI command (inspect, flow, validate, scan, compare, benchmark, session)
| | | +-- display/ # Terminal formatting (chalk, boxen, tables)
| | | +-- utils/ # Shared utilities (parser, http, crypto, chains, format)
| | | +-- types.ts # TypeScript interfaces (MppChallenge, MppReceipt, MppCredential, etc.)
| | | +-- __tests__/ # Vitest test files
| | +-- vitest.config.ts
| +-- mock-server/ # Mock MPP server for demos and testing
| | +-- bin/ # Server entry point
| | +-- src/ # Server logic and spec-compliant fixtures
| +-- plugin/ # Claude Code plugin + MCP server
| +-- src/ # MCP server, tools, hooks
| +-- skills/ # MPP protocol knowledge skill
| +-- hooks/ # Session start detection
+-- package.json # Workspace root
| Command | Description |
|---|---|
npm run build |
Build CLI package |
npm run dev |
Watch mode — rebuilds CLI on change |
npm run test |
Run test suite (121 tests) |
npm run lint |
Type-check (tsc --noEmit) |
npm run check |
Full gate: lint + test + build |
npm run mock |
Start the mock MPP server on :3402 |
npm run build:plugin |
Build the Claude Code plugin |
The mock server has its own tsup build (not covered by npm run build):
cd packages/mock-server && npx tsup && cd ../..Start the mock server in one terminal, then use the CLI against it:
# Terminal 1: start the mock server (must be built first)
node packages/mock-server/dist/bin/mpp-mock-server.js
# Terminal 2: test CLI commands
mpp-inspector inspect http://localhost:3402/v1/query # Tempo challenge
mpp-inspector inspect http://localhost:3402/v1/premium # Stripe challenge
mpp-inspector scan localhost:3402 # discover endpoints
mpp-inspector compare http://localhost:3402/v1/query http://localhost:3402/v1/search http://localhost:3402/v1/premium
mpp-inspector flow http://localhost:3402/v1/query --dry-runmpp-inspector inspect https://mpp.dev/api/ping/paid
mpp-inspector scan mpp.devcd packages/cli && npm link && cd ../..
mpp-inspector inspect https://mpp.dev/api/ping/paidMPP Inspector parses the spec-compliant challenge format:
WWW-Authenticate: Payment id="...", realm="...", method="tempo", intent="charge",
expires="2025-01-15T12:05:00Z", request="<base64url-encoded JSON>"
The request param is a base64url-encoded JSON containing method-specific payment details (amount, currency, recipient, chainId, methodDetails, etc.).
The parser also supports the legacy format (challengeId, amount, currency as top-level params) for backward compatibility.
- Create
packages/cli/src/commands/your-command.ts - Export a Commander
Commandinstance - Register it in
packages/cli/src/index.ts - Add display formatting in
packages/cli/src/display/if needed - Add tests in
packages/cli/src/__tests__/ - Update the command table in
README.md
Follow the pattern of existing commands like inspect.ts or scan.ts.
- Add the method name to
KNOWN_PAYMENT_METHODSintypes.ts - Add method info to
PAYMENT_METHOD_INFOinchains.ts - Set
blockchain: trueorfalse(affects address validation incrypto.ts) - Add a demo endpoint in
mock-server/src/fixtures.ts - Add tests
Use descriptive branch names:
feat/lightning-method-supportfix/parser-base64url-paddingdocs/update-chain-ids
Write clear, imperative commit messages:
add Lightning payment method parsingfix base64url decoding for request paramupdate Tempo chain ID to 42431
- Run
npm run check— all three gates (lint, test, build) must pass - Add tests for new functionality
- Update the README if you're adding commands or changing behavior
- Keep PRs focused — one feature or fix per PR
Look for issues labeled good first issue. Some areas that welcome contributions:
- Signature verification — implement method-specific signature validation
/llms.txtparsing — parse the text format into structured endpoints inscan.ts- New chain registry entries — add chains to
chains.ts - MCP transport support — parse JSON-RPC error codes and
_metafields for AI agent tool calls - Test coverage — add tests for command handlers in
packages/cli/src/__tests__/commands/
- TypeScript strict mode with
readonlyinterfaces - ESM throughout (
import/export,.jsextensions in imports) - No unnecessary comments — code should be self-documenting
- Use
chalkfor terminal colors,orafor spinners,boxenfor boxes,cli-table3for tables - Immutable data patterns — never mutate, always return new objects
By contributing, you agree that your contributions will be licensed under the MIT License.