MLCopilot - MarkLogic AI Assistant
Your intelligent companion for MarkLogic development
MLCopilot brings AI-powered assistance to MarkLogic developers working with XQuery and XSLT, combining syntax highlighting, static analysis, intelligent code generation, and task management for MLCP and CoRB workflows.
Features
XQuery & XSLT Language Support
- Full XQuery syntax highlighting for
.xq, .xqy, .xquery, .xql, .xqm files
- Full XSLT syntax highlighting for
.xsl, .xslt files
- Theme-aware token colors (light and dark) for variables, functions, types, keywords, and operators
- Language Server Protocol (LSP) integration for real-time XQuery static error detection
Code Snippets
- XQuery snippets — version declaration, module namespace, imports, function/variable declarations, FLWOR expressions, and more
- XSLT snippets — stylesheet skeletons (2.0 and 3.0), templates,
xsl:for-each, xsl:if, xsl:choose, and more
MarkLogic Function IntelliSense
- Autocomplete — 3000+ MarkLogic built-in function completions with signatures and documentation, triggered by
: and -
- Hover documentation — function signature, parameters, return type, and examples on hover
AI-Powered Features
Natural Language to XQuery
- Command:
MLCopilot: Natural Language to XQuery
- Key:
Ctrl+Shift+X / Cmd+Shift+X
- Describe your intent in plain English; AI generates optimized XQuery code
- Output includes a copy-to-clipboard button in the side panel
Explain Selected XQuery Code
- Command:
MLCopilot: Explain Selected XQuery Code
- Key:
Ctrl+Shift+E / Cmd+Shift+E (requires selection)
- Context menu: Right-click on selected XQuery → "Explain Selected XQuery Code"
- AI explains selected code with constructs, purpose, and gotchas in a side panel
Hover Error Explanation
- Hover over a syntax error in XQuery to get an AI-generated explanation and fix suggestion
MLCP Task Generator
- Command:
MLCopilot: Generate MLCP Task
- Key:
Ctrl+Shift+M / Cmd+Shift+M (in build.gradle)
- Context menu: Right-click in
build.gradle → "Generate MLCP Task"
- Interactively generates MarkLogic Content Pump (MLCP) Gradle task definitions
- Supported task types: CSV Import, TSV Import, JSON Import, XML Import, Export
- Prompts for task name, database, collection, and generates full configuration with batch size, thread count, and transaction size
CoRB Task Generator
- Command:
MLCopilot: Generate CoRB Task
- Key:
Ctrl+Shift+C / Cmd+Shift+C (in build.gradle)
- Context menu: Right-click in
build.gradle → "Generate CoRB Task"
- Interactively generates Content on Request (CoRB) Gradle task definitions
- Prompts for task name, URIs type (module-based or file-based), thread count, and optional export file
MLCP & CoRB IntelliSense in build.gradle
- MLCP autocomplete — property completions for IMPORT, EXPORT, and COPY commands, triggered by
= and space
- MLCP hover — property description, type, valid values, examples, and applicable commands
- CoRB autocomplete — property completions inside CoRB task blocks, with category, type, and examples
- CoRB hover — property documentation on hover
Query Editor
- Command:
MLCopilot: Open Query Editor
- Dedicated MLCopilot Query Activity Bar panel for writing and running XQuery directly against a MarkLogic server
- Full webview editor with syntax-aware input and result display
- Complements the Tasks Panel — write ad-hoc queries without leaving VS Code
Tasks Panel
- Sidebar: Activity bar icon opens "MLCopilot Tasks" panel
- Auto-scans workspace
build.gradle files to list all MLCP and CoRB tasks
- Shows tasks in organized tables with MLCP/CoRB type badges
- One-click DEV and PROD or LOCAL run buttons that spawn a terminal
- Real-time running status with animation; prevents duplicate executions
- Refresh command:
MLCopilot: Refresh Tasks (refresh icon in panel title)
Multi-Provider AI Support
- Command:
MLCopilot: Switch AI Provider
- Switch between AI providers at any time via quick pick:
- Auto — tries Claude Code → ChatGPT → Gemini automatically
- Claude Code — free, no API key needed (uses the Claude Code VS Code extension)
- ChatGPT — OpenAI API (requires
mlcopilot.openai.apiKey)
- Gemini — Google Gemini API (free tier available, requires
mlcopilot.gemini.apiKey)
Installation
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X)
- Search for "MLCopilot"
- Click Install
Getting Started
- Open any
.xqy or .xsl file — syntax highlighting and IntelliSense work automatically
- Errors appear in the Problems panel via the XQuery language server
- For AI features, configure your provider in settings (see below)
Extension Settings
| Setting |
Default |
Description |
mlcopilot.provider |
auto |
AI provider: auto, claude-code, chatgpt, gemini |
mlcopilot.openai.apiKey |
"" |
OpenAI API key for ChatGPT provider |
mlcopilot.openai.model |
gpt-4o |
ChatGPT model: gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo |
mlcopilot.gemini.apiKey |
"" |
Google Gemini API key |
mlcopilot.gemini.model |
gemini-2.0-flash |
Gemini model: gemini-2.0-flash, gemini-1.5-pro, gemini-1.5-flash |
mlcopilot.username |
set user name for gradle task |
|
mlcopilot.password |
set password for gradle task |
|
Commands & Keyboard Shortcuts
| Command |
Key (Win/Linux) |
Key (Mac) |
Context |
| Natural Language to XQuery |
Ctrl+Shift+X |
Cmd+Shift+X |
Any XQuery file |
| Explain Selected XQuery Code |
Ctrl+Shift+E |
Cmd+Shift+E |
XQuery file with selection |
| Generate MLCP Task |
Ctrl+Shift+M |
Cmd+Shift+M |
build.gradle |
| Generate CoRB Task |
Ctrl+Shift+C |
Cmd+Shift+C |
build.gradle |
| Open Query Editor |
— |
— |
Activity Bar / Command Palette |
| Switch AI Provider |
— |
— |
Command Palette |
| Refresh Tasks |
— |
— |
Tasks Panel title bar |
Requirements
- VS Code 1.115.0 or higher
- (Optional) API key for ChatGPT or Gemini if not using Claude Code
Known Issues
- Static analysis currently supports XQuery 1.0-ml
- XSLT error detection is limited to syntax validation
Roadmap
- [ ] Enhanced XSLT support
- [ ] Code completion for MarkLogic server-side modules
- [ ] Integration with MarkLogic server for live validation
- [ ] Snippet library for common patterns
Contributing
Found a bug or have a feature request? Open an issue on GitHub.
License
MIT License — see LICENSE file for details.
Author
Akbar Ali
Senior MarkLogic Developer | MarkLogic Certified (v10, v12)
| |