Skip to content
Contact Us

User Guide

This guide covers the day-to-day features of the MirthSync VS Code Extension. If you haven’t installed it yet, start with the installation guide.


The extension supports multiple Mirth server connections with secure credential storage. Switch between dev, staging, and production servers without re-entering credentials.

  1. Open the Command Palette (Ctrl+Shift+P)
  2. Run MirthSync: Add Connection
  3. Enter a name, server URL, username, and password
  4. The connection appears in the Mirth Connections tree view

Right-click any connection in the Mirth Connections tree view for these options:

ActionDescription
Test ConnectionVerify the server is reachable and credentials are valid
ConnectEstablish an active session
DisconnectClose the session
Set as ActiveDesignate as the default connection for sync operations
RemoveDelete the connection profile

Passwords are stored via the VS Code Secrets API, which uses your operating system’s native credential store:

  • macOS: Keychain
  • Windows: Credential Manager
  • Linux: libsecret / GNOME Keyring

Credentials never appear in settings files, .vscode/ directories, or version control.


The extension adds three tree views to the VS Code sidebar, giving you a live hierarchical view of your Mirth server.

Lists all configured server connections. Icons indicate connection status (connected, disconnected, active). Right-click for connection management options.

Displays channel groups and individual channels from the active connection. This mirrors the channel structure on your Mirth server.

Right-click operations:

  • Pull — Download a channel, channel group, or all channels to your workspace
  • Push — Upload local changes back to the Mirth server
  • Deploy Channel — Activate a channel on the server
  • Undeploy Channel — Deactivate a channel

Browse code template libraries on the active connection. Right-click to pull or push individual libraries.


Sync is the core workflow—pulling configurations from Mirth to your workspace, editing locally, and pushing changes back.

Download configurations from the Mirth server to your VS Code workspace.

MethodScope
Command Palette → MirthSync: Pull AllAll channels, templates, global scripts
Tree view → Right-click channel group → PullSingle channel group
Tree view → Right-click channel → PullSingle channel
Tree view → Right-click template library → PullSingle code template library
File Explorer → Right-click Channels/ folder → PullAll channels
File Explorer → Right-click CodeTemplates/ folder → PullAll code templates
File Explorer → Right-click GlobalScripts/ folder → PullGlobal scripts

Upload local changes back to the Mirth server.

MethodScope
Command Palette → MirthSync: Push AllAll local changes
Tree view → Right-click channel group → PushSingle channel group
Tree view → Right-click channel → PushSingle channel
File Explorer → Right-click folder → PushFolder contents

Three toggles control sync behavior. Set them via the status bar or Command Palette:

ConfigMap Inclusion (MirthSync: Toggle ConfigurationMap Inclusion) : Include the Mirth ConfigurationMap when syncing. Disabled by default to avoid overwriting environment-specific settings.

Force Sync (MirthSync: Toggle Force Sync) : Overwrite server contents without conflict checking. Use with caution—this bypasses any remote changes. When promptForForce is enabled (default), the extension will ask before forcing.

Deploy After Push (MirthSync: Toggle Deploy After Push) : Automatically deploy channels on the server after a push completes. Useful for dev environments; disable for production.

Force Sync

Force sync overwrites the server state with your local files. Always verify your changes with MirthSync: Git Diff before force-pushing, especially to shared or production servers.


The extension provides rich language support for Mirth Connect JavaScript APIs, including autocomplete, hover documentation, navigation, and diagnostics — so you get a full IDE experience when editing transformer, filter, and code template logic.

Autocomplete suggestions appear as you type in Mirth JavaScript files. Triggers fire on . and $ characters.

Mirth globals: msg, connectorMessage, router, alerts, logger, response, destinationSet

Map shortcuts: $c, $g, $gc, $s, $d, $r, $co

Utility classes: FileUtil, DateUtil, DatabaseConnectionFactory, SMTPConnectionFactory, ResponseFactory, SerializerFactory, ChannelUtil, XmlUtil, AttachmentUtil

Java interop: Access Java classes via the Packages namespace (e.g., Packages.java.io.File).

Suggestions appear in JavaScript blocks within Mirth channel XML files, adapting to the current context.

Hover over any Mirth identifier to see inline documentation, including method signatures, parameter types, and descriptions.

Press F12 or Ctrl+Click to jump to function and variable definitions across Mirth files.

Press Shift+F12 to find all usages of a symbol across the workspace.

Press F2 to rename a symbol across files. Includes validation to prevent renaming non-Mirth identifiers.

The Outline view (Ctrl+Shift+O) shows functions, variables, and code blocks in Mirth scripts for quick navigation.

For the most comprehensive IntelliSense, point the extension to your Mirth server’s Javadocs:

{
"mirthsync.javadocsUrl": "https://your-mirth-server:8443/javadocs"
}

This enables the extension to generate API completions from your specific Mirth version.


The extension provides real-time code analysis with 14 built-in rules. Diagnostics appear as you type — no configuration or external tools required.

RuleSeverityWhat It Catches
mirth-sql-injectionWarningString concatenation in executeQuery/executeUpdate calls using map values
mirth-evalWarningUsage of JavaScript eval function, which can lead to code injection
mirth-hardcoded-passwordWarningHardcoded credentials assigned to password, secret, apikey, or similar variables
mirth-file-path-traversalWarningUser-provided map values passed directly to new File() operations
RuleSeverityWhat It Catches
mirth-msg-immutableErrorAttempting to modify the immutable msg object — use connectorMessage.setRawData() instead
mirth-deprecated-coWarningDeprecated $co shortcut — use connectorMap.get() or $c() instead
mirth-deprecated-serializerWarningDeprecated SerializerFactory — use the serializer property on the message instead
mirth-filter-returnHintFilter scripts that don’t explicitly return true or false
RuleSeverityWhat It Catches
mirth-map-null-checkHintMap .get() values used without null checking
mirth-potential-infinite-loopWarningwhile(true) loops without a visible break condition
mirth-logger-inefficientHintString concatenation in logger calls — check logger.isDebugEnabled() first
mirth-fileutil-no-tryHintFileUtil operations without try-catch error handling
mirth-xmlutil-performanceHintXMLUtil.prettyPrint on msg.getRawData() — can be slow for large messages
mirth-undefined-globalHintMap objects (channelMap, globalMap, etc.) referenced without calling .get() or .put()

The extension includes 28 code snippets for common Mirth patterns. Type a prefix and press Tab to expand.

PrefixNameExpands To
cmputChannel Map PutchannelMap.put('key', value)
cmgetChannel Map Get$c('key')
gmputGlobal Map PutglobalMap.put('key', value)
gmgetGlobal Map Get$g('key')
gcmputGlobal Channel Map PutglobalChannelMap.put('key', value)
gcmgetGlobal Channel Map Get$gc('key')
PrefixNameExpands To
logiLogger Infologger.info('message')
logdLogger Debuglogger.debug('message')
logeLogger Errorlogger.error('message')
logwLogger Warnlogger.warn('message')
PrefixNameExpands To
xmlparseXML ParseE4X XML parsing with element access
jsonparseJSON ParseJSON.parse() with property access
jsonstringifyJSON StringifyJSON.stringify()
hl7segHL7 Segment Accessmsg['PID']['PID.5']['PID.5.1'].toString()
getrawGet Raw Datamsg.getRawData()
settransSet Transformed DataconnectorMessage.setTransformedData()
PrefixNameExpands To
dbqueryDatabase QueryFull DatabaseConnectionFactory pattern with executeCachedQuery and finally close
httpreqHTTP RequestJava URL/URLConnection HTTP request with response reading
sendemailSMTP Send EmailSMTPConnectionFactory pattern
PrefixNameExpands To
filereadFile ReadFileUtil.read(path)
filewriteFile WriteFileUtil.write(path, content, append)
dateformatDate FormatDateUtil.getCurrentDate(format)
dateconvertDate ConvertDateUtil.convertDate(fromFormat, toFormat, dateString)
PrefixNameExpands To
trycatchTry CatchTry-catch block with logger.error
foreachFor Each LoopE4X-style for each (var item in collection)
routeRoute Messagerouter.routeMessage(channelName, data)
alertSend Alertalerts.sendAlert(message)
responseCreate ResponseResponseFactory.getSuccess/Error/Sent/Queued/Filtered()
msgidMessage IDmsg.getMessageId()

The extension provides debug launch configurations for attaching to Mirth Connect’s Java debug port (JDWP). This lets you set breakpoints, inspect variables, and step through channel logic.

  • Java Extension Pack for VS Code (provides the Java debug adapter)
  • Mirth Connect started with JDWP remote debugging enabled on port 5005

The extension provides three debug configurations via the Command Palette (Run and DebugAdd Configuration):

ConfigurationTargetDetails
Attach to Mirth (Local)localhost:5005For local Mirth installations
Attach to Mirth (Dev Container)mirth:5005For Docker-based development environments
Attach to Mirth (Remote)Prompted at launchEnter hostname and port via input variables

Before attaching, the extension validates that the JDWP debug port is reachable. If the port is closed or unreachable, you’ll get a specific error message indicating whether the issue is a connection refusal, timeout, or hostname resolution failure.


The VS Code status bar (bottom of the window) shows MirthSync state at a glance. Each item is clickable to toggle or change its value.

IndicatorShowsClick Action
ConnectionActive server name and statusOpen connection list
ConfigMapWhether ConfigMap is included in syncToggle on/off
ForceWhether force sync is enabledToggle on/off
DeployWhether deploy-after-push is activeToggle on/off

Beyond tree views and the Command Palette, you can sync directly from the VS Code File Explorer.

Right-click on these folders in your workspace for sync options:

  • Channels/ — Pull or push all channels
  • CodeTemplates/ — Pull or push all code templates
  • GlobalScripts/ — Pull or push global scripts
  • Alerts/ — Pull or push alert configurations
  • ConfigurationMap.xml — Pull or push the configuration map (individual file)
  • Resources.xml — Pull or push resource definitions (individual file)

This is convenient when you’ve made edits in the file explorer and want to push specific folders without syncing everything.


The extension includes built-in Git commands for reviewing changes before pushing to the server.

CommandDescription
MirthSync: Git StatusShow modified, added, and deleted files in the workspace
MirthSync: Git DiffDisplay a diff of all changes since the last commit

These complement VS Code’s built-in Source Control panel. Use them to verify your changes before pushing to Mirth.

  1. Pull configurations from the server
  2. Edit channels, templates, or scripts in VS Code
  3. Git Status / Diff to review what changed
  4. Commit changes using VS Code’s Source Control
  5. Push changes back to the Mirth server
  6. Deploy channels if needed

Manage channel deployment state directly from VS Code:

CommandDescription
MirthSync: Deploy ChannelActivate a channel on the connected server
MirthSync: Undeploy ChannelDeactivate a channel
MirthSync: Import ChannelImport a channel from a local file to the server
MirthSync: Export ChannelExport a channel from the server to a local file
MirthSync: Server StatusDisplay the connected server’s health and version info