This file provides guidance to Claude Code (claude.ai/code) when working with the Umbraco Forms MCP server.
MCP server for Umbraco Forms. Provides tools for managing forms, records, data sources, prevalue sources, and more via the Umbraco Forms Management and Delivery APIs.
npm run build # Build with tsup
npm run compile # Type-check only
npm run generate # Generate API client from OpenAPI spec (Orval)
npm run inspect # Run MCP inspector
npm run test # Unit tests only
npm run test:evals # LLM eval tests (requires ANTHROPIC_API_KEY)
npm run test:all # Both unit and eval testsSingle test: npm test -- --testPathPattern=src/path/__tests__/file.test.ts
Always use npm scripts (npm run compile, npm test, npm run build) — never run node, npx tsc, or jest directly.
src/
├── umbraco-api/
│ ├── api/
│ │ ├── client.ts # API client configuration
│ │ └── generated/ # Orval-generated client and Zod schemas
│ ├── tools/
│ │ └── {collection-name}/
│ │ ├── index.ts # ToolCollectionExport
│ │ ├── get/ # GET tools
│ │ ├── post/ # POST tools
│ │ ├── put/ # PUT tools
│ │ ├── delete/ # DELETE tools
│ │ ├── __tests__/ # Integration tests
│ │ └── __evals__/ # LLM eval tests
│ └── mcp-client.ts # MCP chaining client instance
├── config/
│ ├── index.ts # Exports all config
│ ├── server-config.ts # Custom config field definitions
│ ├── slice-registry.ts # Valid slice names
│ ├── mode-registry.ts # Mode-to-collection mappings
│ └── mcp-servers.ts # Chained MCP server configs
├── mocks/
│ ├── server.ts # MSW server setup
│ ├── handlers.ts # API mock handlers
│ ├── store.ts # In-memory mock data
│ └── jest-setup.ts # Test setup file
├── testing/ # Test helpers specific to this project
└── index.ts # Server entry point
Environment Variables / CLI Flags:
| Variable | CLI Flag | Purpose |
|---|---|---|
UMBRACO_CLIENT_ID |
--umbraco-client-id |
OAuth client ID |
UMBRACO_CLIENT_SECRET |
--umbraco-client-secret |
OAuth client secret |
UMBRACO_BASE_URL |
--umbraco-base-url |
Umbraco instance URL |
UMBRACO_TOOL_MODES |
--umbraco-tool-modes |
Comma-separated modes |
UMBRACO_INCLUDE_SLICES |
--umbraco-include-slices |
Include only these slices |
UMBRACO_EXCLUDE_SLICES |
--umbraco-exclude-slices |
Exclude these slices |
UMBRACO_READONLY |
--umbraco-readonly |
Block write operations |
UMBRACO_FORMS_API_KEY |
--umbraco-forms-api-key |
Forms Delivery API key |
DISABLE_MCP_CHAINING |
--disable-mcp-chaining |
Disable MCP server chaining |
Custom fields defined in config/server-config.ts.
slice-registry.ts - Valid slice names for tool categorization:
- Base slices:
create,read,update,delete,list - Extended:
tree,search,publish,move,copy, etc. - Tools with empty slices array are categorized as
other
mode-registry.ts - Named groups mapping to collections:
- Example:
form-designmode includesform,field-type,folder,mediacollections - Users set
UMBRACO_TOOL_MODES=form-design,submissionsto enable groups
- One file per tool in operation-type subfolder (
get/,post/, etc.) - Export default with
withStandardDecorators(tool) - Use Zod schemas from Orval-generated
*.zod.tsfiles - Set
slicesarray for filtering categorization - Set
annotationsfor MCP hints (readOnlyHint,destructiveHint,idempotentHint)
Integration tests (__tests__/):
- Run against the real Umbraco instance — no mocking
- Require a running Umbraco instance with an API user configured (see below)
- Call
setupTestEnvironment()in describe block - Use builder pattern for test data (e.g.,
ExampleBuilder) - Test tool handlers directly
Eval tests (__evals__/):
- LLM-based acceptance tests using Claude Agent SDK
- Require
ANTHROPIC_API_KEYenvironment variable - Use
runScenarioTestwith prompt, tools, requiredTools, successPattern - Run with
--runInBandto avoid parallel API calls
Integration tests require an API user in Umbraco. You must create this manually via the Umbraco backoffice UI:
- Go to Settings > Users in the Umbraco backoffice
- Create an API user with:
- Client ID:
umbraco-back-office-mcp - Client Secret:
1234567890
- Client ID:
- Grant the user appropriate permissions for the APIs being tested
- Add these to your
.envfile:UMBRACO_CLIENT_ID=umbraco-back-office-mcp UMBRACO_CLIENT_SECRET=1234567890
Uses Orval to generate typed client from OpenAPI spec:
- Configure
orval.config.tswith the Swagger URL - Run
npm run generate - Client and Zod schemas generated to
src/umbraco-api/api/generated/
Always pass CAPTURE_RAW_HTTP_RESPONSE to API methods when using toolkit helpers.