{"_id":"@appifex/mcp-server","_rev":"2-c8245b9cb6a7bfdff2dd950c6f292277","name":"@appifex/mcp-server","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@appifex/mcp-server","version":"1.0.0","keywords":["appifex","dtc","mcp","mcp-server","agents"],"author":{"name":"Appifex"},"license":"MIT","_id":"@appifex/mcp-server@1.0.0","maintainers":[{"name":"appfiex-rayliu","email":"sevenray@gmail.com"},{"name":"roger-appifex","email":"dev@appifex.ai"}],"homepage":"https://github.com/appifex-ai-org/appifex-dtc#readme","bugs":{"url":"https://github.com/appifex-ai-org/appifex-dtc/issues"},"bin":{"dtc-mcp-server":"dist/index.js"},"dist":{"shasum":"2e56f87379130e1113d6727463cff886c52f25e2","tarball":"https://registry.npmjs.org/@appifex/mcp-server/-/mcp-server-1.0.0.tgz","fileCount":99,"integrity":"sha512-hGawSUJ5qch/CVGs5RmqwfVAvP9bkFR5j0ykAGFtuClWW8KYc3EpZLkGbxfh54HMBUdXAM6tBlB8pGS+qKgodw==","signatures":[{"sig":"MEUCIAvTfHFKBf153eZCsgOUXmy7Ew3JtP3tgP+tS8GHAqoXAiEAjGaxGkMxSplONlEZNOuo0ZikTGZ+fr7Ig7OENCrmqyE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@appifex%2fmcp-server@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":188909},"main":"./dist/index.js","type":"module","_from":"file:appifex-mcp-server-1.0.0.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc","clean":"rm -rf dist"},"_npmUser":{"name":"roger-appifex","email":"dev@appifex.ai"},"_resolved":"/tmp/2d589a4e992984ed28580b8a1cbb9670/appifex-mcp-server-1.0.0.tgz","_integrity":"sha512-hGawSUJ5qch/CVGs5RmqwfVAvP9bkFR5j0ykAGFtuClWW8KYc3EpZLkGbxfh54HMBUdXAM6tBlB8pGS+qKgodw==","repository":{"url":"git+https://github.com/appifex-ai-org/appifex-dtc.git","type":"git","directory":"packages/mcp-server"},"_npmVersion":"10.9.7","description":"MCP server exposing the DTC toolkit to AI agents","directories":{},"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.24.0","@appifex/cli":"1.0.0","@appifex/fix":"1.0.0","@appifex/baas":"1.0.0","@appifex/core":"1.0.0","@appifex/spec":"1.0.0","@appifex/build":"1.0.0","@appifex/design":"1.0.0","@appifex/report":"1.0.0","@appifex/runner":"1.0.0","@appifex/codegen":"1.0.0","@appifex/deliver":"1.0.0","@appifex/analysis":"1.0.0","@appifex/test-gen":"1.0.0","@appifex/validate":"1.0.0","@appifex/provision":"1.0.0","@modelcontextprotocol/sdk":"^1.29.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/mcp-server_1.0.0_1776656141905_0.004077219032240675","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@appifex/mcp-server","version":"1.0.1","description":"MCP server exposing the DTC toolkit to AI agents","license":"MIT","type":"module","bin":{"dtc-mcp-server":"dist/index.js"},"main":"./dist/index.js","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"dependencies":{"@modelcontextprotocol/sdk":"^1.29.0","zod":"^3.24.0","@appifex/analysis":"1.0.0","@appifex/runner":"1.0.0","@appifex/design":"1.0.0","@appifex/spec":"1.0.0","@appifex/baas":"1.0.0","@appifex/test-gen":"1.0.0","@appifex/codegen":"1.0.0","@appifex/core":"1.0.0","@appifex/build":"1.0.0","@appifex/provision":"1.0.0","@appifex/validate":"1.0.0","@appifex/deliver":"1.0.0","@appifex/report":"1.0.0","@appifex/cli":"1.0.1","@appifex/fix":"1.0.0"},"author":{"name":"Appifex"},"homepage":"https://github.com/appifex-ai-org/appifex-dtc#readme","bugs":{"url":"https://github.com/appifex-ai-org/appifex-dtc/issues"},"repository":{"type":"git","url":"git+https://github.com/appifex-ai-org/appifex-dtc.git","directory":"packages/mcp-server"},"publishConfig":{"access":"public","provenance":true},"keywords":["appifex","dtc","mcp","mcp-server","agents"],"scripts":{"build":"tsc","clean":"rm -rf dist"},"_id":"@appifex/mcp-server@1.0.1","types":"./dist/index.d.ts","_integrity":"sha512-/danyz6tKOJLWUVyRIPcfddjLqOe+CxS1iKWEYp0wGPQcT/rUwgP2E5FMw+qRHelVKKlqxbC/aJnB9nL1E2W6w==","_resolved":"/tmp/f5eadc1ab54685dde2f7961b7592324c/appifex-mcp-server-1.0.1.tgz","_from":"file:appifex-mcp-server-1.0.1.tgz","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-/danyz6tKOJLWUVyRIPcfddjLqOe+CxS1iKWEYp0wGPQcT/rUwgP2E5FMw+qRHelVKKlqxbC/aJnB9nL1E2W6w==","shasum":"94c784bf44e985f761e357cb668a54900b2c4102","tarball":"https://registry.npmjs.org/@appifex/mcp-server/-/mcp-server-1.0.1.tgz","fileCount":99,"unpackedSize":188909,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@appifex%2fmcp-server@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBy4zbWLuKXWsIbxUB+9MLNPQkCHHwjGyb3SIjr45WSPAiEAnTguYnL38wFcXosR96FFgWlaRtIrNG4RlUOcGLe0I4g="}]},"_npmUser":{"name":"roger-appifex","email":"dev@appifex.ai"},"directories":{},"maintainers":[{"name":"appfiex-rayliu","email":"sevenray@gmail.com"},{"name":"roger-appifex","email":"dev@appifex.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mcp-server_1.0.1_1776667436738_0.1844477101854587"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-20T03:35:41.811Z","modified":"2026-04-20T06:43:57.182Z","1.0.0":"2026-04-20T03:35:42.032Z","1.0.1":"2026-04-20T06:43:56.887Z"},"bugs":{"url":"https://github.com/appifex-ai-org/appifex-dtc/issues"},"author":{"name":"Appifex"},"license":"MIT","homepage":"https://github.com/appifex-ai-org/appifex-dtc#readme","keywords":["appifex","dtc","mcp","mcp-server","agents"],"repository":{"type":"git","url":"git+https://github.com/appifex-ai-org/appifex-dtc.git","directory":"packages/mcp-server"},"description":"MCP server exposing the DTC toolkit to AI agents","maintainers":[{"name":"appfiex-rayliu","email":"sevenray@gmail.com"},{"name":"roger-appifex","email":"dev@appifex.ai"}],"readme":"# @appifex/mcp-server\n\nMCP server that exposes the full DTC design-to-code toolkit to AI agents over the [Model Context Protocol](https://modelcontextprotocol.io/).\n\n## Quick Start\n\n```bash\n# Build the server\npnpm build\n\n# Run it (stdio transport — meant to be spawned by an AI agent)\nnode dist/index.js\n```\n\n## Connecting from Pydantic AI (Python)\n\n```python\nfrom pydantic_ai import Agent\nfrom pydantic_ai.mcp import MCPServerStdio\n\ndtc_server = MCPServerStdio(\n    \"node\",\n    args=[\"packages/appifex-dtc/packages/mcp-server/dist/index.js\"],\n    env={\"HOME\": os.environ[\"HOME\"]},  # needed for ~/.dtc config\n    timeout=30,\n    read_timeout=600,  # fix loop and pipeline can take minutes\n)\n\nagent = Agent(\n    \"anthropic:claude-sonnet-4-6\",\n    toolsets=[dtc_server],\n    system_prompt=\"You are a mobile app developer. Use DTC tools to build apps.\",\n)\n\nasync with agent:\n    result = await agent.run(\"Build a pet adoption app with SwiftUI\")\n```\n\n## Connecting from Claude Desktop\n\nAdd to your `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"dtc\": {\n      \"command\": \"node\",\n      \"args\": [\"/absolute/path/to/packages/appifex-dtc/packages/mcp-server/dist/index.js\"],\n      \"env\": { \"HOME\": \"/Users/yourname\" }\n    }\n  }\n}\n```\n\n## Connecting from Claude Code\n\nAdd to your project's `.mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"dtc\": {\n      \"command\": \"node\",\n      \"args\": [\"packages/appifex-dtc/packages/mcp-server/dist/index.js\"]\n    }\n  }\n}\n```\n\n## Connecting from the Appifex AI Technologies, Inc. Backend\n\n### Option A: Pydantic AI Agent Toolset\n\n```python\nfrom pydantic_ai.mcp import MCPServerStdio\n\ndtc_mcp = MCPServerStdio(\n    \"node\",\n    args=[str(DTC_MCP_SERVER_PATH / \"dist\" / \"index.js\")],\n    env={\"HOME\": os.environ.get(\"HOME\", \"\")},\n    timeout=30,\n    read_timeout=600,\n)\n\nagent = Agent(\"model\", toolsets=[dtc_mcp, other_toolsets...])\n```\n\n### Option B: Claude Agent SDK MCP Server\n\n```python\n# In backend/app/claude_code/runner.py\noptions = ClaudeAgentOptions(\n    mcp_servers={\n        \"appifex\": appifex_mcp_server,\n        \"dtc\": dtc_mcp_server_config,\n    },\n    ...\n)\n# Tools appear as mcp__dtc__build, mcp__dtc__validate, etc.\n```\n\n## Available Tools (21)\n\n### Pipeline (Full Orchestration)\n\n| Tool | Description |\n|------|------------|\n| `dtc_run_pipeline` | Run the entire design-to-code pipeline (design, spec, test-gen, codegen, build, validate, fix, deliver, report) |\n\n### Prompt Refinement\n\n| Tool | Description |\n|------|------------|\n| `dtc_refine_prompt` | Refine a vague app prompt into a detailed one. Use \"ask\" mode to get clarifying questions, then \"enrich\" mode with user answers to produce a pipeline-ready prompt |\n| `dtc_refine_feature_prompt` | Refine a vague add-feature prompt into a detailed prompt with assumptions. First call returns assumptions for confirmation, second call with `confirmed=true` returns the enriched prompt |\n\n### Add Feature\n\n| Tool | Description |\n|------|------------|\n| `dtc_add_feature` | Add a feature to an existing project. Validates that a prior completed run exists at outputDir before proceeding |\n\n### Design\n\n| Tool | Description |\n|------|------------|\n| `dtc_design_create` | Generate a `.pen` design file from a text prompt |\n| `dtc_design_iterate` | Apply changes to an existing `.pen` design file |\n\n### Spec\n\n| Tool | Description |\n|------|------------|\n| `dtc_spec_extract` | Extract a DesignSpec from a `.pen` file (deterministic, no LLM) |\n| `dtc_spec_translate` | Translate a DesignSpec to a platform-specific PlatformSpec (SwiftUI or Kotlin Compose) |\n\n### Test Generation\n\n| Tool | Description |\n|------|------------|\n| `dtc_test_gen_ui` | Generate Maestro UI test flows from a PlatformSpec |\n| `dtc_test_gen_unit` | Generate unit tests (XCTest or JUnit) from a PlatformSpec |\n\n### Build\n\n| Tool | Description |\n|------|------------|\n| `dtc_build` | Build a project (xcodebuild for SwiftUI, Gradle for Kotlin Compose) |\n\n### Validation\n\n| Tool | Description |\n|------|------------|\n| `dtc_validate` | Run all tests: Maestro UI + unit tests + optional Semgrep security scan |\n| `dtc_security` | Run Semgrep OWASP security scan |\n\n### Fix\n\n| Tool | Description |\n|------|------------|\n| `dtc_fix` | Run the TDD fix loop (fix, build, validate, repeat until green or circuit breaker) |\n\n### Deliver\n\n| Tool | Description |\n|------|------------|\n| `dtc_deliver` | Git commit + push + PR creation. Auto-creates GitHub repo if needed. |\n\n### Report\n\n| Tool | Description |\n|------|------------|\n| `dtc_report` | Generate a pipeline report (markdown or JSON) |\n\n### Provision & Submit\n\n| Tool | Description |\n|------|------------|\n| `dtc_provision_submit` | Build and submit an app to TestFlight (iOS) or Play Console Internal Testing (Android). Auto-detects platform from the project directory |\n\n### Analysis\n\n| Tool | Description |\n|------|------------|\n| `dtc_analyze` | Scan an existing project to produce a structural inventory and navigation graph |\n\n### Config & Context\n\n| Tool | Description |\n|------|------------|\n| `dtc_load_config` | Load DTC configuration from `~/.dtc/config.json` |\n| `dtc_load_context` | Load the previous run context from a project directory |\n| `dtc_save_context` | Save a run context for future resume/add-feature/refactor |\n\n## Tool Details\n\n### `dtc_run_pipeline`\n\nThe highest-level tool. Runs the entire pipeline in non-interactive mode.\n\n**Input:**\n```json\n{\n  \"prompt\": \"Pet adoption app with browse, favorites, and adoption form\",\n  \"platform\": \"swiftui\",\n  \"outputDir\": \"/path/to/output\",\n  \"designFile\": \"/optional/path/to/design.pen\",\n  \"mode\": \"fresh\",\n  \"agentType\": \"auto\",\n  \"verbose\": false,\n  \"benchmark\": false,\n  \"resumeSessionId\": \"optional-session-id\",\n  \"configDir\": \"/optional/path/to/.dtc\",\n  \"baasProvider\": \"firebase\"\n}\n```\n\n**Output:**\n```json\n{\n  \"status\": \"completed\",\n  \"summary\": { \"allGreen\": true, \"totalTests\": 12, \"totalPassed\": 12 },\n  \"markdown\": \"# Pet App\\n**Status:** ALL GREEN...\",\n  \"deliver\": { \"commitHash\": \"abc1234\", \"branch\": \"dtc/1712100000\" },\n  \"events\": [\"[design] started: Creating design...\", \"...\"]\n}\n```\n\n### `dtc_build`\n\n**Input:**\n```json\n{\n  \"platform\": \"swiftui\",\n  \"projectDir\": \"/path/to/project\",\n  \"scheme\": \"MyApp\"\n}\n```\n\n**Output:**\n```json\n{\n  \"success\": true,\n  \"duration\": 12345,\n  \"errors\": []\n}\n```\n\n### `dtc_validate`\n\n**Input:**\n```json\n{\n  \"platform\": \"swiftui\",\n  \"projectDir\": \"/path/to/project\",\n  \"runSecurity\": true\n}\n```\n\n**Output:**\n```json\n{\n  \"allPassed\": false,\n  \"ui\": { \"total\": 4, \"passed\": 3, \"failed\": 1 },\n  \"unit\": { \"total\": 8, \"passed\": 8, \"failed\": 0 },\n  \"security\": { \"total\": 0, \"passed\": 0, \"failed\": 0, \"findings\": [] }\n}\n```\n\n### `dtc_fix`\n\n**Input:**\n```json\n{\n  \"platform\": \"swiftui\",\n  \"projectDir\": \"/path/to/project\",\n  \"maxAttempts\": 5,\n  \"tokenBudget\": 200000\n}\n```\n\n**Output:**\n```json\n{\n  \"status\": \"all_green\",\n  \"attempts\": [{ \"attempt\": 1, \"testsBefore\": {...}, \"testsAfter\": {...} }],\n  \"totalTokensUsed\": 15000,\n  \"totalDuration\": 45000\n}\n```\n\n### `dtc_refine_prompt`\n\nTwo-step flow: first call with `mode: \"ask\"` returns clarifying questions, then call with `mode: \"enrich\"` and user answers to get a pipeline-ready prompt.\n\n**Input (ask mode):**\n```json\n{\n  \"prompt\": \"todo app\",\n  \"mode\": \"ask\",\n  \"platform\": \"swiftui\"\n}\n```\n\n**Output (ask mode):**\n```json\n{\n  \"mode\": \"ask\",\n  \"prompt\": \"todo app\",\n  \"completenessScore\": 17,\n  \"questions\": [\n    { \"id\": \"screens\", \"question\": \"What screens should the app have?\", \"category\": \"Screens\", \"required\": true },\n    { \"id\": \"navigation\", \"question\": \"What navigation pattern?\", \"category\": \"Navigation\", \"options\": [\"Tab bar\", \"Stack\", \"Drawer\"], \"required\": true }\n  ],\n  \"hint\": \"Or just say \\\"just build it\\\" to skip all questions and build with sensible defaults.\"\n}\n```\n\n**Input (enrich mode):**\n```json\n{\n  \"prompt\": \"todo app\",\n  \"mode\": \"enrich\",\n  \"answers\": \"{\\\"screens\\\": \\\"home, detail, settings\\\", \\\"navigation\\\": \\\"Tab bar\\\"}\",\n  \"platform\": \"swiftui\"\n}\n```\n\n### `dtc_add_feature`\n\n**Input:**\n```json\n{\n  \"prompt\": \"Add a favorites screen with heart button on each item\",\n  \"outputDir\": \"/path/to/existing/project\",\n  \"platform\": \"swiftui\",\n  \"confirmed\": true\n}\n```\n\n### `dtc_provision_submit`\n\n**Input:**\n```json\n{\n  \"projectDir\": \"/path/to/project\",\n  \"platform\": \"ios\",\n  \"scheme\": \"App\",\n  \"exportMethod\": \"app-store\"\n}\n```\n\n### `dtc_analyze`\n\n**Input:**\n```json\n{\n  \"outputDir\": \"/path/to/existing/project\",\n  \"platform\": \"swiftui\"\n}\n```\n\n### `dtc_spec_extract` + `dtc_spec_translate`\n\nTypically used in sequence:\n\n```\n1. dtc_spec_extract({ filePath: \"design.pen\" })\n   → returns DesignSpec JSON\n\n2. dtc_spec_translate({ specJson: <result>, platform: \"swiftui\" })\n   → returns PlatformSpec JSON with SwiftUI types, testIds, SF Symbols\n```\n\n## Architecture\n\n```\nAI Agent (Pydantic AI / Claude Desktop / Claude Code)\n    |\n    | MCPServerStdio (spawns as subprocess)\n    v\n@appifex/mcp-server (TypeScript, stdio transport)\n    |\n    | imports @appifex/core, @appifex/runner, @appifex/design, @appifex/spec, etc.\n    v\nDTC Package APIs\n    |\n    | Runner.exec(), Runner.readFile(), etc.\n    v\nLocal Machine / E2B Sandbox / Remote Mac Runner\n```\n\nTool handlers are separated from MCP wiring in `src/tools/` — each is a plain async function that can be tested independently without the MCP SDK.\n\n## Configuration\n\nThe MCP server reads DTC config from `~/.dtc/config.json` (or a custom path via the `configDir` parameter on most tools). Run `dtc setup` to configure:\n\n- LLM provider (Anthropic, OpenAI, Google, Copilot, Claude CLI)\n- Design tool (Pencil, Google Stitch, or Figma Make; plus zero-config `.zip` import for Stitch / Figma Make / Claude Design exports via `designFile`)\n- Runner type (local, E2B, remote)\n- Apple credentials (optional)\n- Deliver config (optional)\n\n## Development\n\n```bash\n# Install deps\npnpm install\n\n# Run tests\nnpx vitest run packages/mcp-server/__tests__/\n\n# Build\npnpm --filter @appifex/mcp-server run build\n```\n\n## Important Notes\n\n- The server uses **stdio transport** — never use `console.log()` in tool handlers (it corrupts the JSON-RPC stream). Use `console.error()` for debugging.\n- Long-running tools (`dtc_fix`, `dtc_run_pipeline`) can take minutes. Set `read_timeout=600` or higher in `MCPServerStdio`.\n- The `dtc_run_pipeline` tool runs in **non-interactive mode** — all TTY prompts (design review, budget continuation) are skipped.\n- All tools return `{ content: [{ type: \"text\", text: \"...\" }], isError: boolean }` following the MCP protocol.\n","readmeFilename":"README.md"}