Powered by Zoomin Software. For more details please contactZoomin

MarkLogic MCP Server

Troubleshoot MarkLogic MCP Server

  • Last Updated: December 3, 2026
  • 8 minute read
    • Documentation

Follow this troubleshooting guidance to quickly isolate whether a problem is in your MCP client, MarkLogic MCP Server, or MarkLogic Retrieval API deployment.

No tools visible in the MCP client

Symptoms:

  • MarkLogic MCP Server does not appear in the client.
  • MarkLogic MCP Server appears, but tools are missing.

Checks:

  1. Confirm that the MCP URL shape is correct: http://<host>:8088/api/v1/agent/mra-agent/session/<session-id>/mcp.
  2. Confirm that MarkLogic MCP Server is running by using docker compose ps in the directory containing your docker-compose.yaml file.
  3. If you have edited your MCP client configuration, then reload or restart the MCP client.
  4. List tools. For example, in VS Code Copilot, type # in the chat input.
  5. Verify MarkLogic MCP Server registration with your client’s MCP server listing UI/command.

Authentication failures

Symptoms:

  • 401 responses
  • OAuth redirects not completing
  • "invalid token" / "authorization required"

For the expected header format for each authentication mode, see Authorization header behavior.

Basic or digest mode

  1. Confirm auth_method is set to basic or digest under workflow context blocks in config.yaml.

  2. Confirm your MCP client sends:

    • Authorization: Bearer <base64(username:password)>
  3. Re-generate the token if credentials changed:

    echo -n "username:password" | base64
    

OAuth mode

  1. Confirm auth_method is set to oauth under workflow context blocks.
  2. Confirm mcp_auth.enabled is true in config.yaml.
  3. Remove the static Authorization header from the client configuration.
  4. Confirm that authorization_server in config.yaml is reachable from the MCP client environment.
  5. In VS Code dynamic registration, use the MCP client ID configured in your IdP provider. See your IdP administrator for more information.
  6. If VS Code appears stuck on old credentials, then clear old dynamic providers:
    • Open Command Palette and run Authentication: Remove Dynamic Authentication Providers.
    • Remove entries for your MCP host, then retry.
  7. Retry a tool call to trigger login flow.

OAuth symptom

When connecting the MCP client, the OAuth login popup fails with an error related to redirect_uri. The authorization URL typically includes a callback such as https://example.com/sn/oauthcallback or https://vscode.dev/redirect.

Cause:

Many IdPs permit only redirect URIs explicitly configured for the OAuth client. If the MCP client's callback URL is not configured as an allowed redirect URI for the OAuth client, then the IdP rejects the authorization request.

Resolution:

Add the MCP client callback URL to the list of valid redirectUris in your IdP.

Connection failures

Symptoms:

  • "connection refused".
  • Timeouts.
  • MCP client can reach MarkLogic MCP Server, but MarkLogic MCP Server cannot reach MarkLogic Server.

Checks:

  1. Confirm that the MarkLogic MCP Server endpoint is reachable:

    curl -i http://localhost:8088/
    
  2. Confirm that the MarkLogic REST app server endpoint is reachable directly:

    curl --anyauth -u admin:admin http://localhost:8003/v1/retrieve/definition
    
  3. If MarkLogic MCP Server runs in Docker and MarkLogic Server runs on host, then check marklogic_url in config.yaml:

    • marklogic_url: http://host.docker.internal:<port>
  4. Ensure host and port values match what your MarkLogic REST app server actually uses.

Is MRA deployed and responding?

Before debugging MCP behavior, verify MRA itself:

curl --anyauth -u <user>:<password> http://<host>:<port>/v1/retrieve/definition

If this fails, then fix deployment first:

SQL tool issues

This table lists problems that can occur when you use RetrieveSQLMetadata and RetrieveSQLResult, with their causes and actions:

Symptom Cause Action

400 response from RetrieveSQLResult.

The query is invalid or unsupported.

Verify column names with RetrieveSQLMetadata.

The query is not a single read-only statement.

Submit one SELECT or WITH statement of 10,000 characters or fewer, with no unquoted semicolon, comments, or write keywords.

400 response from RetrieveSQLResult that mentions duplicate or ambiguous columns.

Two selected columns have the same name.

Add AS aliases so that every selected column has a unique name.

401 response from either SQL tool.

The MCP client did not send an authorization header.

Verify the MCP client workflow auth_method, the authorization header, and the OAuth setup.

MarkLogic Server credentials are missing or invalid.

Verify the MarkLogic Server credentials.

403 response from either SQL tool.

The user does not have the mra-sql role.

Assign the mra-sql role to the user.

404 response from either SQL tool.

MRA is not deployed.

Confirm that the MRA modules are deployed.

The user does not have the mra-sql role.

Assign the mra-sql role to the user.

405 response when directly calling the RetrieveSQLMetadata endpoint.

The request uses an unsupported HTTP method.

Use GET for /v1/retrieve/sql/metadata.

405 response when directly calling the RetrieveSQLResult endpoint.

The request uses an unsupported HTTP method.

Use POST with a JSON body for /v1/retrieve/sql.

500 response from either SQL tool.

An unexpected MarkLogic Server server-side failure occurred.

  1. Check the MarkLogic Server logs and configuration for information about the failure.

  2. Correct the cause of the failure.

  3. Retry.

Either SQL tool shows only an HTTP status but no detailed message.

Requests through the SQL tools can return the HTTP status without the errorResponse.message text.

Send the same request directly to the SQL endpoint to see the detailed validation or authorization message.

Either SQL tool returns unexpected results:

  • Catalog entries are missing.

  • Query rows are missing.

  • Query fails although the column name appears in the metadata.

The user's roles limit the schemas, views, and documents that the user can see.

Confirm the user's roles and document permissions.

The required TDE views are not deployed.

Confirm that the TDE views exist on MarkLogic Server and are queryable.

The query column name does not exactly match the column name from the metadata.

Use the exact column names from the metadata.

The user role changed after the metadata was cached.

  • Retry after the cache expires.

  • Restart MarkLogic MCP Server, which clears the cache.

  • To reduce future cache time delays, lower the environment variable MRA_SQL_METADATA_CACHE_TTL_SECONDS. (Default: 300 seconds.)

The TDE view changed after the metadata was cached.

RetrieveSQLMetadata returns truncated and totalRows.

The result reached the row limit:

  • Default row limit: 500.

  • totalRows contains the exact row count available to be returned.

Raise the row limit by setting sqlMetadataMaxRows in retrieveConfig.json.

RetrieveSQLResult returns "truncated": true.

The result reached the row limit:

  • Default row limit: 500.

  • To get an exact row count available to be returned, run a COUNT(*) query.

  • Narrow the query with a WHERE clause or use aggregates.

  • Raise the row limit by setting sqlQueryMaxRows in retrieveConfig.json.

A permission change does not appear in RetrieveSQLMetadata.

The user role changed after the metadata was cached.

  • Retry after the cache expires.

  • Restart MarkLogic MCP Server, which clears the cache.

  • To reduce future cache time delays, lower the environment variable MRA_SQL_METADATA_CACHE_TTL_SECONDS. (Default: 300 seconds.)

A new or changed TDE view does not appear in RetrieveSQLMetadata.

The TDE view changed after the metadata was cached.

  • Retry after the cache expires.

  • Restart MarkLogic MCP Server, which clears the cache.

  • To reduce future cache time delays, lower the environment variable MRA_SQL_METADATA_CACHE_TTL_SECONDS. (Default: 300 seconds.)

The MCP client might show only the HTTP status, such as `400`, without the detailed message. To see the message, call the [Retrieve SQL Metadata endpoint](reference/marklogic-retrieval-api/retrieve-sql-metadata.md) or submit the same query to the [Retrieve SQL endpoint](reference/marklogic-retrieval-api/retrieve-sql.md).


For example, to check the SQL Metadata endpoint directly, bypassing MarkLogic MCP Server, run this command:

curl --anyauth -u <user>:<password> http://<host>:<port>/v1/retrieve/sql/metadata

SPARQL tool issues

This table lists problems that can occur when you use RetrieveSparqlMetadata and RetrieveSparqlResult, with their causes and actions:

Symptom Cause Action

400 response from RetrieveSparqlResult.

The request is invalid.

  • Send the query in the sparqlQuery argument.

  • Remove extra request fields.

The query is malformed or unsupported.

  • Use one complete SELECT or ASK query.

  • Remove any additional queries.

  • Remove any trailing statement terminator.

401 response from either SPARQL tool.

The MCP request is missing valid authentication.

  • Verify the MCP authorization header or token.

  • Verify the workflow authentication mode.

MarkLogic Server credentials are missing or invalid.

Verify the MarkLogic Server credentials.

403 response from either SPARQL tool.

The user does not have the mra-sparql role.

Assign the mra-sparql role to the user.

The user does not have the sem:sparql execute privilege.

Verify that the user's roles grant the sem:sparql execute privilege.

404 response from either SPARQL tool.

MRA is not deployed.

Confirm that the MRA modules are deployed.

The user cannot access an endpoint module.

Assign the mra-sparql role to the user.

405 response when directly calling the RetrieveSparqlMetadata endpoint.

The request uses an unsupported HTTP method.

Use GET for /v1/retrieve/sparql/metadata.

405 response when directly calling the RetrieveSparqlResult endpoint.

The request uses an unsupported HTTP method.

Use POST with a JSON body for /v1/retrieve/sparql.

500 response from either SPARQL tool.

An unexpected MarkLogic Server server-side failure occurred.

  1. Check the MarkLogic Server logs and configuration for information about the failure.

  2. Correct the cause of the failure.

  3. Retry.

504 response from RetrieveSparqlResult.

MarkLogic Server recognized a MarkLogic REST app server execution timeout or cancellation.

  • Narrow the query using graph scope, FILTER, or LIMIT.

  • Have the MarkLogic Server administrator review the MarkLogic REST app server time-limit settings.

Expected entries are missing from RetrieveSparqlMetadata:

  • Prefixes are missing.

  • Named graphs are missing.

The user cannot access those entries.

Verify the user's access.

Permissions changed after the metadata was cached.

  • Retry after the cache expires.

  • Restart MarkLogic MCP Server, which clears the cache.

  • To reduce future cache time delays, lower the environment variable MRA_SPARQL_METADATA_CACHE_TTL_SECONDS. (Default: 300 seconds.)

Metadata changed after the metadata was cached.

RetrieveSparqlMetadata returns truncated and totalRows.

A metadata list reached its sparqlMetadataMaxRows limit:

  • totalRows gives the exact count for that list.

Raise the row limit by setting sparqlMetadataMaxRows in retrieveConfig.json.

RetrieveSparqlResult returns "truncated": true.

The SELECT result exceeded sparqlQueryMaxRows:

  • The endpoint does not return the total result count.

An ASK response has no maxRows or truncated fields.

This is the expected response shape for an ASK query.

Read the boolean value in the boolean field.

A permission change does not appear in RetrieveSparqlMetadata.

The user role changed after the metadata was cached.

  • Retry after the cache expires.

  • Restart MarkLogic MCP Server, which clears the cache.

  • To reduce future cache time delays, lower the environment variable MRA_SPARQL_METADATA_CACHE_TTL_SECONDS. (Default: 300 seconds.)

To inspect an endpoint's detailed error response directly, call the SPARQL metadata endpoint or submit the same query to the SPARQL endpoint.


For example, to check the SPARQL endpoint directly, bypassing MarkLogic MCP Server, run this command:

curl --anyauth -u <user>:<password> -H "Content-Type: application/json" -X POST http://<host>:<port>/v1/retrieve/sparql -d '{"query":"SELECT (1 AS ?one) WHERE {}"}'

Check MarkLogic Server logs

If endpoint checks fail or return unexpected MarkLogic Server errors, then inspect MarkLogic Server logs directly.

If MarkLogic Server is running in Docker

Run this command from the directory containing the docker-compose.yaml that defines your MarkLogic Server container, substituting the service name used in that file for marklogic:

docker compose logs marklogic

Use -f to follow logs while reproducing a failing request:

docker compose logs -f marklogic

Note: The docker-compose.yaml supplied in examples/marklogic-mcp defines only the MarkLogic MCP Server container, not MarkLogic Server. If you started MarkLogic Server separately, then use docker logs <container-name> instead.

If MarkLogic Server is running outside Docker

Check the MarkLogic Server Logs directory (default: /var/opt/MarkLogic/Logs/) and inspect:

  • ErrorLog.txt (MarkLogic Server/runtime errors)
  • Error/access logs for your MarkLogic REST app server (for request-level failures)

What to look for

  • Authentication or authorization failures.
  • Rewriter or endpoint module load errors.
  • JavaScript or XQuery runtime exceptions from endpoint code.
  • Host, port, or TLS connection failures when calling dependent services.

Fast isolation decision tree

  1. If the MCP client cannot discover MarkLogic MCP Server tools, then troubleshoot client registration, MCP URL, and MarkLogic MCP Server startup first.
  2. If tools are visible but calls fail with authentication errors, then troubleshoot authentication mode and headers or tokens.
  3. If authentication is configured correctly but tool calls still fail, then verify MRA endpoint health with direct curl.
Alert