dotCMS / dotCMS/core

MCP Server broken with binary fields in Host Content type

Open
#33,064 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale Type : Defect
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Problem Statement

Following the directions laid out to connect to dotCMS with an MCP server, I'm encountering an issue. I've tracked it down to our instance, and specifically our host content type. We modified it to allow some basic site configuration with a logo image, favicon, etc. The issue seems to be that in our case, the API the MCP server is using returns this object for "titleImage":

2025-08-22 16:15:12.755 [warning] [server stderr]       "title": "Code",
2025-08-22 16:15:12.755 [warning] [server stderr]       "titleImage": {
2025-08-22 16:15:12.755 [warning] [server stderr]         "clazz": "com.dotcms.contenttype.model.field.ImmutableBinaryField",
2025-08-22 16:15:12.755 [warning] [server stderr]         "contentTypeId": "855a2d72-f2f3-4169-8b04-ac5157c4380c",
2025-08-22 16:15:12.755 [warning] [server stderr]         "dataType": "SYSTEM",
2025-08-22 16:15:12.755 [warning] [server stderr]         "dbColumn": "system_field",
2025-08-22 16:15:12.755 [warning] [server stderr]         "defaultValue": null,
2025-08-22 16:15:12.755 [warning] [server stderr]         "fixed": false,
2025-08-22 16:15:12.755 [warning] [server stderr]         "forceIncludeInApi": false,
2025-08-22 16:15:12.755 [warning] [server stderr]         "hint": null,
2025-08-22 16:15:12.756 [warning] [server stderr]         "iDate": 1751382293000,
2025-08-22 16:15:12.756 [warning] [server stderr]         "id": "40c06e9e09f188404bdf0e13b3fea6bb",
2025-08-22 16:15:12.756 [warning] [server stderr]         "indexed": false,
2025-08-22 16:15:12.756 [warning] [server stderr]         "listed": false,
2025-08-22 16:15:12.756 [warning] [server stderr]         "modDate": 1751382293000,
2025-08-22 16:15:12.756 [warning] [server stderr]         "name": "Logo",
2025-08-22 16:15:12.756 [warning] [server stderr]         "owner": null,
2025-08-22 16:15:12.756 [warning] [server stderr]         "readOnly": false,
2025-08-22 16:15:12.756 [warning] [server stderr]         "regexCheck": null,
2025-08-22 16:15:12.756 [warning] [server stderr]         "relationType": null,
2025-08-22 16:15:12.756 [warning] [server stderr]         "required": false,
2025-08-22 16:15:12.756 [warning] [server stderr]         "searchable": false,
2025-08-22 16:15:12.756 [warning] [server stderr]         "sortOrder": 14,
2025-08-22 16:15:12.756 [warning] [server stderr]         "unique": false,
2025-08-22 16:15:12.756 [warning] [server stderr]         "values": null,
2025-08-22 16:15:12.756 [warning] [server stderr]         "variable": "logo"
2025-08-22 16:15:12.756 [warning] [server stderr]       },

The error log shows ZOD expects a string, not an object:

2025-08-22 16:15:12.757 [warning] [server stderr] [2025-08-22T21:15:12.753Z] [SITE_SERVICE] ERROR: Invalid site response format
2025-08-22 16:15:12.757 [warning] [server stderr] {
2025-08-22 16:15:12.757 [warning] [server stderr]   "message": "[\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"string\",\n    \"received\": \"object\",\n    \"path\": [\n      \"entity\",\n      \"titleImage\"\n    ],\n    \"message\": \"Expected string, received object\"\n  }\n]",
2025-08-22 16:15:12.757 [warning] [server stderr]   "stack": "ZodError: [\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"string\",\n    \"received\": \"object\",\n    \"path\": [\n      \"entity\",\n      \"titleImage\"\n    ],\n    \"message\": \"Expected string, received object\"\n  }\n]\n    at get error (file:///Users/traviscaruth/.npm/_npx/378c3d2325966dda/node_modules/zod/v3/types.js:39:31)\n    at SiteService.getCurrentSite (file:///Users/traviscaruth/.npm/_npx/378c3d2325966dda/node_modules/@dotcms/mcp-server/main.js:956:73)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async Promise.all (index 1)\n    at async file:///Users/traviscaruth/.npm/_npx/378c3d2325966dda/node_modules/@dotcms/mcp-server/main.js:1285:60\n    at async executeWithErrorHandling (file:///Users/traviscaruth/.npm/_npx/378c3d2325966dda/node_modules/@dotcms/mcp-server/main.js:710:12)\n    at async file:///Users/traviscaruth/.npm/_npx/378c3d2325966dda/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:85:30"
2025-08-22 16:15:12.757 [warning] [server stderr] }
2025-08-22 16:15:12.757 [warning] [server stderr] [2025-08-22T21:15:12.753Z] [SITE_SERVICE] ERROR: Error fetching current site
2025-08-22 16:15:12.757 [warning] [server stderr] {
2025-08-22 16:15:12.757 [warning] [server stderr]   "message": "Invalid site response: {\"_errors\":[],\"entity\":{\"_errors\":[],\"titleImage\":{\"_errors\":[\"Expected string, received object\"]}}}",
2025-08-22 16:15:12.757 [warning] [server stderr]   "stack": "Error: Invalid site response: {\"_errors\":[],\"entity\":{\"_errors\":[],\"titleImage\":{\"_errors\":[\"Expected string, received object\"]}}}\n    at SiteService.getCurrentSite (file:///Users/traviscaruth/.npm/_npx/378c3d2325966dda/node_modules/@dotcms/mcp-server/main.js:957:15)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async Promise.all (index 1)\n    at async file:///Users/traviscaruth/.npm/_npx/378c3d2325966dda/node_modules/@dotcms/mcp-server/main.js:1285:60\n    at async executeWithErrorHandling (file:///Users/traviscaruth/.npm/_npx/378c3d2325966dda/node_modules/@dotcms/mcp-server/main.js:710:12)\n    at async file:///Users/traviscaruth/.npm/_npx/378c3d2325966dda/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js:85:30"
2025-08-22 16:15:12.757 [warning] [server stderr] }
Steps to Reproduce

Unsure. We have multiple binary fields in the host content type, but I'm not sure why the API returns an object.

I'll do some more testing to see if I can identify what specifically causes this, but wanted to get the issue created for tracking.

Acceptance Criteria

MCP server should work regardless of modified content types

dotCMS Version

dotcms-core 25.08.15-1
MCP server

Proposed Objective

Technical User Experience

Proposed Priority

Priority 3 - Average

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at SiteService.getCurrentSite in main.js around the reported validation failure and inspect the Zod schema for entity.titleImage. Compare it with the dotCMS API response containing an ImmutableBinaryField, then reproduce using a host content type with binary fields. Done means current-site loading succeeds for modified content types as required by the acceptance criteria.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, javascript
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.