marklogic_mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@marklogic_mcpSearch for documents about 'cloud migration' in the 'projects' collection."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
marklogic_mcp
An MCP server for MarkLogic: read, write, search, query, and schema-validate documents across configured environments.
Tools
Tool | Purpose |
| Fetch a document by URI. |
| Insert/replace a document, with collections and permissions. |
| Search by full-text query and/or collection; returns total + URIs. |
| Run XQuery. Updates permitted. |
| Run XQuery with updates rejected. Use for all read/inspect work. |
| Run XQuery and write the results to a local file. |
| Validate stored documents against their in-scope XSD. |
database is required on every tool. server selects the environment and defaults to
default_server from the config.
Related MCP server: MarkLogic MCP Server by CData
Setup
uv sync # or: python -m venv .venv && pip install -e .
cp config.yaml.example config.yaml # then fill in, or export the ${...} vars
cp config-local.yaml.example config-local.yamlBoth real config files are gitignored because they hold credentials. config.py
interpolates ${VAR} from the environment and raises if a referenced variable is unset,
so prefer environment variables over writing passwords into the file.
Select a config with ML_CONFIG_PATH:
ML_CONFIG_PATH=config-local.yaml .venv/bin/python src/server.pyRegister with Claude Code as a stdio server, pointing ML_CONFIG_PATH at the config you
want that entry to use. Two entries against different configs (e.g. local vs
dev/prod) is a convenient way to keep environments apart.
Changes require a restart. The server is a long-lived stdio process; edits to
src/do not take effect until the MCP client restarts it.
Tests
.venv/bin/python tests/test_readonly_enforcement.pyThe suite performs real writes and therefore hard-asserts that the loaded config
declares exactly one server named local on localhost, refusing to run otherwise. It
cannot reach dev or prod. It cleans up after itself and verifies it has done so.
Each blocking test asserts the absence of a side effect, not merely that an exception was raised — an exception alone can come from a syntax error and would pass vacuously. That distinction is what caught the read-only bug described below.
Behaviour worth knowing
Errors are raised, never returned. A call that returns without error succeeded.
Failures surface as MarkLogicError carrying the parsed MarkLogic message code
(XDMP-NOSUCHDB, RESTAPI-NODOCUMENT, XDMP-UPDATEFUNCTIONFROMQUERY, …), the primary
diagnostic, and any stack frames — MarkLogic reports faults as HTML from /v1/eval and as
JSON from /v1/documents, and neither is readable raw. TIMEOUT and CONNECTION are
flagged retryable.
Read-only enforcement uses the <update>false</update> eval option, not a
declare option xdmp:transaction-mode "query" prolog. Do not "simplify" it back; two
separate bugs live down that road, and both are covered by tests:
The prolog does not reach the query body when a database is named — and because
databaseis a required parameter, that was every call, soeval_xquery_readonlysilently permitted writes.The prolog is session-scoped, and the session is bound to the keep-alive HTTP connection — so one read-only query left the connection in query mode and broke every subsequent write on the same client.
XQuery string escaping doubles quotes (" → ""); XQuery has no backslash escapes.
All interpolation goes through _xq_str().
validate_documents needs an XSD loaded in the schema database attached to the target
database (e.g. protein-schemas). If none is loaded, the result carries
schema_in_scope: false plus a warning, because otherwise lax mode would report
invalid: 0 — a clean-looking result that verified nothing. Check schema_in_scope
before trusting a clean run.
This server cannot be deployed
Maintenance
Related MCP Connectors
Governed data discovery, exact queries, decisions, simulations, and runtime utilities over MCP.
Search, read, and automate TextMine documents, records, workflows, integrations, and agent tasks.
Build multi-tenant apps over MCP. Schemas, CRUD, deploys — access control enforced server-side.
Query, join, profile, clean and convert CSV/JSON/Parquet with server-side DuckDB over MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server for MarkLogic that enables CRUD operations and document querying capabilities through a client interface.MIT
- AlicenseNot gradedqualityDmaintenanceThis read-only MCP Server allows you to connect to MarkLogic data from Claude Desktop through CData JDBC Drivers. Free (beta) read/write servers available at https://www.cdata.com/solutions/mcpMIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with MongoDB databases through MCP, supporting database queries, resource reading, and multi-collection operations including aggregation pipelines and lookups.10,775,590 npmApache 2.0
- AlicenseAqualityDmaintenanceProvides tools for interacting with CouchDB databases, enabling document management, Mango search queries, and database administration. It allows Claude Code and other MCP clients to perform CRUD operations and manage indexes on local or remote CouchDB instances.11MIT