marklogic_mcp

marklogic_mcp

Enables interaction with MarkLogic databases, including document read/write, search, XQuery evaluation, and schema validation.

Category
访问服务器

README

marklogic_mcp

An MCP server for MarkLogic: read, write, search, query, and schema-validate documents across configured environments.

Tools

Tool Purpose
read_document Fetch a document by URI.
write_document Insert/replace a document, with collections and permissions.
search_documents Search by full-text query and/or collection; returns total + URIs.
eval_xquery Run XQuery. Updates permitted.
eval_xquery_readonly Run XQuery with updates rejected. Use for all read/inspect work.
eval_xquery_to_file Run XQuery and write the results to a local file.
validate_documents 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.

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.yaml

Both 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.py

Register 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.py

The 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:

  1. The prolog does not reach the query body when a database is named — and because database is a required parameter, that was every call, so eval_xquery_readonly silently permitted writes.
  2. 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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选