# @debugmcp/adapter-mock

Mock debug adapter for testing the MCP Debugger. This package provides a fully functional mock implementation of a Debug Adapter Protocol (DAP) server and adapter used heavily by tests and examples in the monorepo.

- MockDebugAdapter: In-memory adapter that simulates debugging life-cycle, state transitions, capabilities, and events.
- MockAdapterFactory: Factory that creates MockDebugAdapter instances.
- mock-adapter-process.ts: A small DAP server that can run over stdio or TCP for integration/e2e tests.

## Install (workspace)

This package is designed to be used via pnpm workspaces within this monorepo.

- Root package.json includes "@debugmcp/adapter-mock": "workspace:*"
- Build order ensures @debugmcp/shared builds before this package

## Build

npm run build -w @debugmcp/adapter-mock

## Test

- Run just this package’s tests:
  npm test -w @debugmcp/adapter-mock

- Or run from repo root (Vitest is already configured to include packages/**):
  npm test

## Exports

import { MockAdapterFactory, MockDebugAdapter, MockErrorScenario, createMockAdapterFactory } from '@debugmcp/adapter-mock';
import type { MockAdapterConfig } from '@debugmcp/adapter-mock';

## Notes

- Primary path resolution for the mock-adapter-process uses import.meta.url when running from the compiled package.
- A fallback path is provided for monorepo-root execution: packages/adapter-mock/dist/mock-adapter-process.js
- A third fallback is available for CJS bundle execution (resolving from the bundle's directory)
- The mock-adapter-process supports a `--host` flag to specify the listening address (e.g., `--host=127.0.0.1`; defaults to `localhost`)
