9.6. AI Clients (MCP Server)
IQcad Pro can let an AI assistant such as Claude Code or Claude Desktop work on the drawing you have open. You describe the job in plain language — “import these points into group EG, build a surface from them, and give it red contours every 2.5 m” — and the assistant carries it out in IQcad while you watch. You see every step on the command line, and one Ctrl+Z undoes each thing it did.
This chapter explains what the connection is, how to set it up step by step, how to check that it works, and what you can ask for, with worked examples.
Note
The MCP server is part of the Pro module. It is off until you turn it on.
9.6.1. How It Works
MCP — the Model Context Protocol — is an open standard that AI assistants use to talk to applications. An application that supports it offers a list of tools: named actions with exact inputs, such as import_points or create_surface. The assistant reads the list, decides which tools your request needs, calls them, reads the answers, and carries on until the job is done.
Three programs take part:
Program |
Role |
|---|---|
You |
Type the request in the AI client, in your own words, in English or Greek. |
The AI client |
Claude Code (in a terminal), Claude Desktop (a window), or another MCP client. It runs the conversation with the AI model and calls IQcad’s tools. |
IQcad |
Runs a small MCP server inside the program. It receives each tool call, does the work in the open drawing, and answers with the result. |
IQcad’s server listens only on your own computer (127.0.0.1): other
computers on the network cannot reach it. Only a client that holds the
secret token shown in the settings can connect.
9.6.1.1. What You Need
IQcad with the Pro module active.
An MCP client. This chapter covers Claude Code and Claude Desktop from Anthropic; other MCP clients work the same way (see Other MCP Clients).
An account with the AI service your client uses, and an internet connection for it.
IQcad running, with the drawing you want to work on open in the active tab.
Important
What leaves your computer. IQcad itself sends nothing anywhere. But whatever the assistant reads from IQcad — layer names, entity lists, coordinates, point descriptions, an image of the drawing — goes into the conversation with the AI service, the same as text you type yourself. Do not ask the assistant to read drawings you are not allowed to share with that service.
9.6.2. Step 1 — Turn the Server On in IQcad
Open File › Settings and the AI / MCP tab.
Tick Let AI clients (Claude Code) control the open drawing.
Leave the Port at 47800 unless another program already uses it.
Leave Allow AI to run commands and Pascal/Python scripts ticked if you want the assistant to run commands and scripts too (see Commands and Scripts); untick it to limit it to the dedicated tools.
Press Copy command, then OK.
Setting |
Meaning |
|---|---|
Let AI clients (Claude Code) control the open drawing |
Starts the server. Off by default. |
Port |
The port the server listens on, on |
Token |
The secret a client must send. It is made for you the first time; New token replaces it and disconnects every client that used the old one. |
Allow AI to run commands and Pascal/Python scripts |
Lets the assistant run any IQcad command and Pascal or Python code. On by default. |
Connect Claude Code (box) |
The ready-made |
The status bar now shows AI: listening. It shows AI: connected while a client is working, and AI: error if the server cannot start — the command line then says why, for example that the port is in use.
9.6.3. Step 2 — Connect Your AI Client
9.6.3.1. Claude Code
Claude Code is Anthropic’s assistant for the terminal (Command Prompt or PowerShell on Windows, Terminal on macOS and Linux). Install it as described on Anthropic’s site and sign in once.
Then register IQcad with it — once, not every time:
Open a terminal.
Paste the command you copied in Step 1 and press Enter. It looks like this (on one line; your token is different):
claude mcp add --transport http iqcad http://127.0.0.1:47800/mcp --header "Authorization: Bearer 3f9c…"
Check the result with:
claude mcp list
iqcad should be listed and connected (IQcad must be running with the server on).
Tip
Which folders see IQcad. As written, claude mcp add registers
IQcad only for the folder the terminal is in when you run it. To have
IQcad available in Claude Code whichever folder you start it from, add
--scope user after add:
claude mcp add --scope user --transport http iqcad http://127.0.0.1:47800/mcp --header "Authorization: Bearer 3f9c…"
If you registered it before without the scope, remove the old entry
first with claude mcp remove iqcad.
To work, start Claude Code in a terminal with claude, type /mcp to
confirm that iqcad is connected, and ask it to work in IQcad.
After New token or a change of port, run claude mcp remove iqcad
and then the newly copied command.
9.6.3.2. Claude Desktop
Claude Desktop, and most other MCP clients with a window, start their tools
as programs of their own. IQcad ships one for this purpose: the bridge
iqcad-mcp (iqcad-mcp.exe on Windows) in the IQcad program folder.
The bridge passes everything on to the running IQcad. It reads the port and
token from IQcad’s own settings file, so it needs no arguments, and it keeps
working after New token once the client is restarted.
In Claude Desktop, open Settings › Developer › Edit Config. This opens the file
claude_desktop_config.json:Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Add IQcad under
mcpServers, with the folder IQcad is installed in. Backslashes in a Windows path are written twice:{ "mcpServers": { "iqcad": { "command": "C:\\Program Files\\IQcad\\iqcad-mcp.exe" } } }
If the file already lists other servers, add the
"iqcad"entry next to them inside the samemcpServersblock.Save the file and restart Claude Desktop completely (quit it from the tray icon, not just the window).
In a new chat, the tools button shows iqcad and its tools.
Start IQcad, with the server on, before Claude Desktop: the client asks for the tool list once, at its own start. If IQcad was not running then, the client still offers the IQcad tools from the last time, and they answer “IQcad is not reachable” until IQcad runs.
9.6.3.3. Other MCP Clients
Any client that supports MCP can connect in one of two ways:
Over HTTP (clients that take a URL): the address is
http://127.0.0.1:47800/mcp(with your port), and every request must carry the headerAuthorization: Bearer <token>, with the token from the settings.As a program (clients that start a command): the command is the bridge,
iqcad-mcp/iqcad-mcp.exein the IQcad folder, with no arguments.
9.6.4. Step 3 — Check the Connection
With IQcad running and a drawing open, ask the assistant something simple:
What drawing is open in IQcad, and what layers does it have?
The assistant calls get_drawing_info and list_layers. In IQcad you see grey lines on the command line such as:
[MCP] get_drawing_info
[MCP] list_layers: 59 layers
and the status bar shows AI: connected. If nothing appears, see Troubleshooting.
9.6.5. Working with the Assistant
Every action is echoed in grey on the command line, starting with
[MCP], for example[MCP] import_points: 323 points from points.csv -> group EG.One Ctrl+Z per request. Everything one assistant action changed — a surface, a style assignment, the entities a script drew — is a single undo step named
MCP: <tool>.It can see the drawing. The assistant can take an image of the current view (get_view_image) and zoom, so it can check its own work and describe what is on screen.
It works in the active tab. Switch tabs to point it at another drawing.
You keep control. While you are in the middle of a command or a dialog is open, the assistant cannot change the drawing; it is told to wait. Press Esc to cancel a command it started.
Licensed modules apply. Tools for Civil or other modules work only if that module is licensed.
9.6.6. Examples
The examples below are typical requests, what the assistant does with them,
and what you see. You do not need to name tools — describe the result you
want. The tool names are given so you can follow the [MCP] lines.
9.6.6.1. Example 1 — Get to Know a Drawing
Give me an overview of this drawing: units, extents, layers, and how
many entities of each type are on each layer. Show me what it looks like.
The assistant reads the summary (get_drawing_info), the layers (list_layers) and the entities (list_entities), takes an image (get_view_image), and answers with a short report. Nothing in the drawing changes.
9.6.6.2. Example 2 — Points to a Surface with Contours
Import C:\Survey\site_points.csv (PNEZD, comma separated) into a point
group called EG. Build a TIN surface "Existing Ground" from that group,
use the closed polyline on layer BOUNDARY as its outer boundary, and give
it red contours every 0.5 m with major contours every 2.5 m.
Typical steps:
import_points — reads the file into group EG (
[MCP] import_points: 323 points … -> group EG).list_entities — finds the polyline on layer BOUNDARY.
create_surface and add_surface_data — builds the surface and adds the boundary.
create_surface_style / set_surface_style — makes the contour style and assigns it.
get_view_image — checks the result.
Note
Importing points cannot be undone with Ctrl+Z (as with the import dialogs), and it clears the undo history. The assistant knows this and should say so before it imports. The surface and style steps can each be undone.
9.6.6.3. Example 3 — Elevation Bands for a Presentation
On surface "Existing Ground", show 8 elevation bands from green to red,
hide the triangles, and keep the contours.
The assistant reads the surface and its style (get_surface, get_surface_style), generates the bands (generate_elevation_bands) and changes the style (update_surface_style).
9.6.6.4. Example 4 — Coordinate System and Coordinates
Set the drawing to the Greek Grid (GGRS87) at 1:500. Then tell me the
latitude and longitude of the point 476520, 4205310.
The assistant finds the system (search_coordinate_systems, EPSG 2100), updates the civil settings (update_civil_settings), and converts the point (convert_coordinates).
9.6.6.5. Example 5 — Drawing from Exact Coordinates
On a new layer "PLOT", draw a closed polyline through
476500,4205300 476540,4205300 476540,4205335 476500,4205335,
and put the text "PLOT 12" at its centre, 2.5 m high.
The assistant uses draw_polyline and draw_text. The layer is created if it does not exist. One Ctrl+Z removes each drawn item.
9.6.6.6. Example 6 — Running a Command Step by Step
Offset the plot boundary 1 m inwards.
The assistant starts OFFSET (command_start) and answers each prompt
(command_input) — the distance, the object, the side — just as you would.
You see the prompts on the command line while it works. If a prompt needs a
click, it gives coordinates instead. Esc cancels the command, and the
assistant is told.
9.6.6.7. Example 7 — A Python Script in Blade Runner
Write a Python script that labels every survey point in group EG with
its elevation rounded to 2 decimals, on layer ELEV-LABELS. Show it to me
in Blade Runner before running it.
The assistant reads the scripting API (get_script_api), opens a new script in Blade Runner (blade_open, blade_write) so you can read and edit it, and runs it when you agree (blade_run); the output appears in Blade Runner’s output panel. It can save the script (blade_save) to a new file — never over another file.
9.6.6.8. Example 8 — Transforming Survey Data
These four points are known in both systems:
local 100,100 -> 476512.20,4205301.45
local 200,100 -> 476611.98,4205306.10
local 200,200 -> 476607.35,4205405.92
local 100,200 -> 476507.55,4205401.30
Solve a Helmert transformation, show me the residuals, and if the RMSE
is under 2 cm apply it to all entities and survey points.
The assistant solves the transformation (solve_transformation) and
reports residuals and RMSE, the same report as CSTRANSFORM. Only if the
check passes does it apply it (apply_transformation). Points and
entities move together.
9.6.6.9. Example 9 — Earthworks
Compare surface "Design" with "Existing Ground": give me cut and fill
volumes, and make a deviation surface coloured by bands.
The assistant uses compare_surfaces, which creates the deviation surface and returns the statistics and volumes. For corridor work it can read volumes along an alignment (earthwork_volumes); for building pads it can create, build and balance gradings.
9.6.6.10. Example 10 — Georeference a Scanned Plan
Insert C:\data\sheet12.tif. The grid crosses at its lower-left and
upper-right corners are 482100,4201210 and 482700,4201610. Put it there,
show me the error, then save it as a GeoTIFF in EPSG:2100.
The assistant inserts the scan (image_insert, at its paper size from the DPI), asks you to click or read the two crosses’ positions on the image, runs image_match as a dry run and shows the RMS, applies it, and saves the file with image_export (world file and GeoTIFF tags). With more crosses and a distorted sheet it uses image_rubbersheet instead.
9.6.6.11. Tips for Good Requests
Name things as they appear in IQcad: layer names, surface names, point group names, file paths.
Give numbers with units (0.5 m contours, 2.5 m text).
Ask for a check: “show me a picture when you are done” makes the assistant look at the result.
Ask it to explain first for large changes: “tell me what you will do before you do it”.
Select first, then ask: “use the polylines I have selected” — the assistant can read your current selection.
Undo is per step: if one step went wrong, press Ctrl+Z once and tell the assistant what to change.
9.6.7. Tool Reference
These are the tools IQcad offers. You never call them yourself — the
assistant chooses them — but the names appear in the [MCP] lines.
Area |
Tools |
|---|---|
Drawing |
get_drawing_info (summary), list_layers, list_entities (with handles; filtered by type, layer, area or your selection), get_view_image (an image of the view), zoom, list_commands, get_command_help. |
Survey points |
import_points (PNEZD, PENZD, Name,X,Y,Z … files), add_points, query_points (by group, number range, area or description), list_point_groups, create_point_group, add_to_point_group, remove_from_point_group, transform_points (translate, rotate, scale, Helmert, raise). |
Surfaces |
create_surface, add_surface_data (point groups, breaklines, outer and hole boundaries, from polylines or your selection), rebuild_surface, list_surfaces, get_surface, surface_elevation_at. |
Surface editing and earthworks (Civil) |
decimate_surface, regrid_surface, raise_lower_surface, merge_surfaces (paste or union), compare_surfaces (with a surface or a point cloud: deviation surface, statistics, volumes), balance_surface, create_grading, build_grading, balance_grading, extract_grading, list_gradings, earthwork_volumes (along an alignment). |
Surface styles |
list_surface_styles, get_surface_style, create_surface_style, update_surface_style (contours, triangles, border, labels, points, elevation bands, draw order), delete_surface_style, set_surface_style, generate_elevation_bands. |
Civil settings |
get_civil_settings, update_civil_settings (coordinate system, drawing scale, units, precision and formats, abbreviations, object layers, draw order), search_coordinate_systems (by name or EPSG code), convert_coordinates (drawing ↔ WGS84 latitude/longitude). |
Map and GIS |
get_map, set_map (background on/off, opacity, source), add_map_source, remove_map_source (XYZ or WMS), clear_map_cache, import_gis, export_gis (GeoJSON, KML, Shapefile, GPX). |
Transformations |
solve_transformation (Helmert, affine, polynomial 1st–3rd degree, rubber sheet, thin-plate spline; residuals, RMSE, report), apply_transformation (to selected entities, all entities or given handles). |
Raster images |
image_info (what a file’s GeoTIFF / world file / DPI give), list_images, image_insert (with the conversion to the drawing’s coordinate system), image_match (two or more point pairs; errors and RMS; dry run), image_rubbersheet (triangular or polynomial; a new georeferenced file), image_export (world file, GeoTIFF tags, EPSG). Prompt: georeference_image. |
Drawing entities |
draw_line, draw_polyline (2D or 3D), draw_circle, draw_arc, draw_ellipse, draw_rectangle, draw_text, draw_spline, draw_hatch. |
Commands and scripts |
command_start, command_input, command_cancel (step by step), run_command_script, run_pascal_script, run_python, get_script_api. |
Blade Runner |
blade_list, blade_open, blade_read, blade_write, blade_run, blade_save. |
9.6.7.1. Commands and Scripts
With Allow AI to run commands and Pascal/Python scripts ticked (the
default), the assistant can also run any IQcad command, a Pascal script or
Python code through the same engines as the SCRIPT, PASCAL and
PYTHON commands (see Scripting). It reads the full command
list from IQcad itself. Untick the option to limit the assistant to the
dedicated tools above.
A command script that leaves a command waiting for input is cancelled and reported to the assistant, so the command line is never left in the middle of a command.
Step by step. The assistant can start a command and answer its prompts
one at a time, the way you do: it sees each prompt, the options in
[...] and the default in <...>. This works for every command,
including drawing tools such as LINE and ARC. While such a command
waits, you see it on the command line as usual; pressing Esc cancels it,
and the assistant is told.
Blade Runner. The assistant can open a new Python or Pascal script in
Blade Runner (see The Blade Runner Script Editor), so you see it and can edit it; change
its text (one Ctrl+Z in the editor brings yours back); run it, with the
output in Blade Runner’s output panel; and save it. It saves only to a new
file or to the file the tab already has, never over another file. It can
also open the bundled sample scripts and read the scripting API (the
iqcad Python module and every Pascal class and routine) before writing
a script.
9.6.8. Undo and Safety
One Ctrl+Z per request. Everything one assistant action changed in the drawing is a single undo step, named
MCP: <tool>.Not undoable: importing or adding survey points and GIS files (this also clears the undo history, exactly as the import dialogs do), point group changes, surface style library changes, civil settings and map settings. The assistant is told this and should warn you before it does them. Save the drawing first if you want a way back.
IQcad busy: while you are in the middle of a command or a drawing tool, or a dialog is open, the assistant cannot change the drawing; it is asked to wait. It can still read. The exception is a command the assistant started itself step by step: it goes on answering that one.
Only your computer: the server listens on
127.0.0.1, and every request must carry the token. New token locks out every client that has the old one.Scripts: untick Allow AI to run commands and Pascal/Python scripts if you do not want the assistant to run code.
Pro: if the Pro licence is not active, every request is refused.
9.6.9. Troubleshooting
Symptom |
What to do |
|---|---|
Status bar shows AI: off |
The option is not ticked, or Pro is not active. |
Status bar shows AI: error |
Read the |
|
It was registered in another folder. Run the command again with
|
Claude Code says 401 or cannot connect |
The token or port changed. Run |
Claude Desktop shows no IQcad tools |
Check the path in |
The tools answer “IQcad is not reachable” |
Start IQcad and turn the server on; restart a desktop client that was started before IQcad. |
“IQcad is busy” |
Finish or cancel (Esc) the active command, or close the dialog. |
A tool says the module is not licensed |
That tool belongs to a module (for example Civil) that is not active in Help › License. |