What BorgVR MCP provides
All three native renderers contain the same optional MCP server. It is independent of the dataset and WebGPU servers and uses the same central command layer as the macOS scripting language. An agent can therefore act reproducibly instead of operating buttons through mouse or gaze control.
- Read the dataset catalog with complete metadata and known origins, then open or close datasets
- Read and change rendering mode, isovalue, transform, clipping, and lighting
- Manage objects, sphere and stroke markers, mesh instances, and length, area, and volume measurements
- Hide objects or the complete measurement visualization without deleting data
- Wait for a completed rendered frame, retrieve the current view as a PNG image, and export isosurfaces as OBJ on macOS
Enabling MCP
- Open BorgVR Settings and select the MCP section.
- Enable Enable MCP server and choose another port if required. The default is
8765. - Add one of the displayed endpoints to the configuration of your MCP client.
http://127.0.0.1:8765/mcp. Local connections require neither TLS nor an access token.Access from the network
When Allow connections from the network is enabled, BorgVR binds the MCP server to all available network interfaces and displays an HTTPS endpoint for every reachable address. Depending on router, firewall, and port forwarding, the service may also be reachable from outside the local network.
- Generate an access token or enter your own. The client sends it as
Authorization: Bearer …. - The generation button copies the new token directly to the clipboard.
- Network connections use HTTPS. Without an imported PKCS#12 identity, BorgVR creates a temporary self-signed certificate whenever the server starts.
Typical agent workflow
- The agent uses
list_datasetsto inspect metadata and origins, then opens the selected dataset withopen_dataset. - It inspects
get_application_state, changes the view and rendering parameters, and hides objects or measurements when required. - After each change it uses
wait_until_renderedto wait for a new completed frame, then callscapture_screenshot. - On macOS it can use
export_isosurfaceto save the current dataset as an OBJ file at the current or an explicitly supplied normalized isovalue. - By comparing multiple views, rendering modes, isovalues, or clipping ranges, the agent can inspect visible structures systematically.
The JSON schemas returned by tools/list are the authoritative reference for argument names and value ranges.
Brick diagnostics and optimizations
set_brick_visualization accepts optional boolean fields enabled, resident, empty, and missing. Type filters are local and also apply to subblocks: red = resident, green = skipped as empty, blue = missing or coarser substitute. Hiding a type changes neither traversal nor brick requests.
set_render_optimizations accepts boolean subbrick_skipping and opacity_adaptive_sampling, plus alpha_epsilon from 0 through 1. These settings persist locally. Alpha epsilon affects only TF empty-space classification, not the transfer function itself or iso rendering.
For both tools, omitted fields remain unchanged; at least one field is required. get_application_state reports all current values in renderingOptions. While GSC recording is active, UI and MCP changes are recorded, including the initial values of these options.
{"name":"set_brick_visualization","arguments":{"enabled":true,"resident":false,"empty":true,"missing":true}}
{"name":"set_render_optimizations","arguments":{"subbrick_skipping":true,"opacity_adaptive_sampling":true,"alpha_epsilon":0}}
Volume editing and export
configure_volume_brush also accepts channels: "all" or an array of one-based channel numbers, e.g. [1,3]. At least one valid channel is required. get_volume_edit_state reports componentCount and channels as a list of selected, one-based channel numbers. Opening selects all channels. Selection is local; SharePlay carries it with each operation. discard_volume_edits always resets every channel.
Dataset and isosurface exports are disabled during SharePlay. Edits and edit-state changes are rejected while an export is running. Starting SharePlay cancels a running export.
The following tools are available on macOS, iOS, and visionOS. Edits affect the active edit state and are shared during SharePlay. The original file is never modified.
get_volume_edit_statereturns availability, dataset ID, brush settings, edit status, pending brick count, and the latest export job with UUID, status, progress, and any error. The same state is included inget_application_state.volumeEditing.get_volume_edit_stateincludessavedStates,activeStateID, and SharePlay status.select_edit_stateselects a UUID or original;create_edit_statecreates an empty state or a copy with duplicate=true.rename_edit_statechanges its name.delete_edit_stateremoves an inactive state with confirm=true. State management is locked during SharePlay.configure_volume_brushaccepts optionalmode(erase/restore),radius_fraction(0.002–0.15 of the largest extent),project_onto_volume, andactivate. The latter activates hand/mouse/touch editing and defaults to false; Muse/PSVR modes stay independent.edit_volumerequiresmodeandsamples, an array of objects withcenter_meters: [x,y,z]and positiveradius_meters. Coordinates are physical meters from the volume minimum corner, not screen, hand, or world coordinates. Interactive radius and projection do not affect these explicit samples; the channel selection from configure_volume_brush applies here too. At most 65536 samples per call within the HTTP request limit; no interpolation. Erase sets selected channels to 0; restore recovers only their original values.edit_volumereturns after journaling. Usewait_volume_editswith optionaltimeout_seconds(default 30, maximum 86400) to wait for background jobs. Unreachable remote bricks may cause a timeout.prepare_volume_editsrebuilds pending edited bricks with foreground priority and waits for persistence. Uses Metal when available; cancellation preserves recorded edits.discard_volume_editsrequires explicitconfirm: trueand clears only the active edit state. During SharePlay, it clears the shared state; other states are preserved.export_edited_datasetstarts an export job with absoluteoutput_path(.data), plus optionalnameanddescription. Paths refer to the app device and must be accessible to its sandbox. Existing destinations are refused. The consistent export includes all previously recorded edits and preserves source compression; waiting for brick jobs first is unnecessary.- Poll
get_volume_edit_stateuntilexport.statusis completed, cancelled, or failed; progress ranges from 0 to 1.cancel_volume_exportwith the job UUID inidcancels only that job. Incomplete export files are removed; recorded edits remain.
{"name":"edit_volume","arguments":{"mode":"erase","samples":[{"center_meters":[0.5,0.5,0.5],"radius_meters":0.05}]}}
{"name":"export_edited_dataset","arguments":{"output_path":"/path/on/app-device/edited.data","name":"Edited volume"}}
Troubleshooting
- Empty response or no connection
- Verify that scheme and endpoint match: local access uses
http, network access useshttps. - Unauthorized
- For network access, the Authorization header must contain exactly the currently displayed bearer token. Local access on the same device does not check a token.
- Certificate error
- Explicitly trust the self-signed certificate or import your own PKCS#12 identity. Some externally hosted agents cannot reach private or local IP addresses at all.
