Configure an MCP client
- Last Updated: September 9, 2026
- 4 minute read
- Documentation
This section explains how to configure your MCP client (VS Code Copilot, Claude Desktop, or similar) to connect to MarkLogic MCP Server. Once connected, your MCP client can call the MarkLogic Retrieval API (MRA) tools to search and retrieve content from your MarkLogic Server databases.
Before using this section, complete either Quick start or both Deploy MarkLogic Retrieval API and Configure MarkLogic MCP Server.
Identify your MCP endpoint
Use the MCP endpoint exposed by MarkLogic MCP Server:
http://<mcp-server-host>:8088/api/v1/agent/mra-agent/session/<session-id>/mcp
Example:
http://localhost:8088/api/v1/agent/mra-agent/session/session-1/mcp
Session ID convention
- The
<session-id>can be any stable identifier that you choose. - Reuse the same session ID to keep requests in the same MCP session context.
- Use different session IDs to isolate independent workflows.
ephemeralis also a valid session ID value. It is just an opaque string, not a special mode.
Add MarkLogic MCP Server to your MCP client configuration
Most MCP clients need an MCP server entry with these values:
- An MCP server name. Example: MarkLogicMCP
- A type. Example: HTTP
- An MCP server endpoint URL. Example:
http://localhost:8088/api/v1/agent/mra-agent/session/<session-id>/mcp
Full example:
{
"servers": {
"MarkLogicMCP": {
"type": "http",
"url": "http://localhost:8088/api/v1/agent/mra-agent/session/<session-id>/mcp"
}
}
}
Configure authentication behavior
Authentication occurs according to how the target MarkLogic REST app server and MarkLogic MCP Server are configured with the auth_method property in config.yaml.
Basic or digest mode
For basic or digest mode, you must add an Authorization header containing the base64-encoded username:password as a bearer token.
-
Generate a token with this command:
echo -n "username:password" | base64 -
Provide the token as in this MCP client configuration example:
{ "servers": { "MarkLogicMCP": { "type": "http", "url": "http://localhost:8088/api/v1/agent/mra-agent/session/<session-id>/mcp", "headers": { "Authorization": "Bearer <base64-username:password>" } } } }
OAuth/IdP mode
For OAuth/IdP mode, remove the Authorization header from the MCP client configuration and use the plain MCP URL to let the OAuth redirect and login flow handle tokens as in this example:
{
"servers": {
"MarkLogicMCP": {
"type": "http",
"url": "http://localhost:8088/api/v1/agent/mra-agent/session/<session-id>/mcp"
}
}
}
Verify that the tools are visible
- Save the MCP client configuration.
- Reload or restart the MCP client.
- Verify that these tools have been discovered:
RetrieveDefinitionRetrieveAugment
In VS Code
- To list tools from active MCP servers: Type
#in the chat input area to trigger the tool list. The list displays all tools from all registered MCP servers. - To open the tools picker: Click the Tools icon in the chat input area to see an interactive tool picker where you can view tool descriptions and parameters.
If the tools do not appear, verify the following conditions:
- The client configuration file contains a valid MCP server entry with a correct URL.
- MarkLogic MCP Server is running and accessible at the configured URL.
- Authentication credentials are correct.
- The user has the
mra-readerrole in MarkLogic Server. For further help, see Troubleshoot MarkLogic MCP Server.
Smoke test with a simple request
-
Use your client to call
RetrieveDefinition. A JSON response returns with information about the target database including labels (MarkLogic Server collections), filters, schemas, and search metadata. -
Run a small
Retrievequery to confirm that the search returns document URIs.
In VS Code
You can try the following prompts in the AI chat of VS Code:
Use the MarkLogicMCP_RetrieveDefinition tool and show me the result.
Use the MarkLogicMCP_Retrieve tool to search for diabetes treatment documents.
Return the URIs and cite them.
Use the MarkLogicMCP_Augment tool for one result and show the document content.
A successful connection exhibits the following characteristics:
- The client recognizes the MarkLogic MCP Server configuration and loads it without errors.
- The three tools (
RetrieveDefinition,Retrieve,Augment) are visible in the tools list. - Tool invocations complete without authentication errors (no 401 Unauthorized responses).
- Tool responses contain valid JSON data: configuration data for
RetrieveDefinition, search results forRetrieve, or document content forAugment. IfRetrieveorAugmentreturn empty results, then verify that your MarkLogic Server database contains data and that the search query is valid.
Implementation notes:
- Tool name prefixing: The exact tool name displayed in the MCP client may be prefixed with your MCP server name. For example, if you named your MCP server
MarkLogicMCP, then the full tool name may appear asMarkLogicMCP_Retrieverather than justRetrieve. - Security considerations: Authorization tokens embedded in client configuration files are credential-bearing. For development and testing on localhost-only machines, this approach is acceptable. For production deployments and environments accessible over networks, use OAuth authentication instead of basic or digest authentication.
Troubleshooting
- If no tools appear, then verify the MCP server URL, and verify that MarkLogic MCP Server is running on port
8088. - If you get auth errors, then verify that the authentication mode and the header behavior match your MarkLogic MCP Server configuration.
- If OAuth does not start, then verify that
authorization_serverinconfig.yamlis reachable from the MCP client environment.