· 8 min read

robodk-mcp-gemini: Building a 31-Tool RoboDK MCP Server & Gemini AI Copilot (MCP, ACP & A2A)

How an enthusiastic BSc Robotics student's dream of talking directly to RoboDK became robodk-mcp-gemini — an open-source 31-tool FastMCP server and native PySide6 Gemini AI Copilot over MCP, ACP, and A2A-ready workflows.

Open-source repository: github.com/Mr-Span/robodk-mcp-gemini (MIT License — 31-tool FastMCP server + native PySide6 Gemini Copilot Add-in over MCP, ACP, and A2A-ready workflows).

Back when I was a BSc Robotics student at the Technical University of Cluj-Napoca, RoboDK was one of the first pieces of engineering software that made industrial robotics feel real in my hands.

When you are an undergraduate student, you do not have a six-axis ABB or KUKA arm bolted to your dorm desk. Opening RoboDK changed that overnight. Suddenly, on a regular laptop, you could pull an industrial manipulator off the shelf, inspect its workspace envelope, attach a gripper, jog its joints past a wrist singularity, check collisions in real time, and export actual controller code through a post-processor. I loved it. I would spend hours after lab sessions testing kinematic chains, rotating reference frames, and watching a virtual TCP glide through a sequence of targets without tripping a joint limit.

And yet, right alongside that student enthusiasm, there was a recurring daydream every time I got buried in nested frames and twenty-click setup dialogs:

“What if I could just describe the workcell I want to test — pick a robot from the catalog, mount a gripper, compute a reachable trajectory, check collisions, and iterate on it like pair-programming with a senior robotics engineer?”

At the time, that sounded like pure science fiction. Today, after years of building production enterprise automation, Agentic AI workflows, and autonomous UAV perception systems, the Model Context Protocol (MCP) finally closed the gap between LLM reasoning and deterministic industrial geometry. That old student daydream just became real: I built a hardened 31-tool robodk-mcp server paired with a native PySide6 Copilot Add-in docked right beside the RoboDK 3D viewport.

Why LLMs Alone Cannot Program Robots

Connecting a language model directly to a 3D robotics simulator fails fast if you treat the model as a geometry calculator. LLMs are great at planning workcell layouts, selecting hardware specs, and diagnosing failures — they are terrible at floating-point homogeneous transforms and 6-DOF inverse kinematics.

The design rule behind RoboDK MCP is simple: let the LLM reason, and let RoboDK’s deterministic math engine compute. Every spatial query — forward kinematics, inverse kinematics across nested reference frames, bounding boxes, and collision checks — runs inside RoboDK’s C++ core and returns exact millimeter and degree measurements back to the agent.

Architecture: Three Processes, Zero Custom Daemons

Rather than inventing a fragile fourth background service with custom sockets, the copilot uses a clean three-process topology:

PySide6 RoboDK Add-in (Qt.Tool docked panel + adaptive SelectionPoller)
  └─ QProcess (supervised via Windows Job Object: KILL_ON_JOB_CLOSE)
       └─ Agent Control Protocol (ACP) harness
            └─ robodk-mcp (FastMCP server, 31 hardened tools + 7 official RoboDK Skills)
                 └─ Persistent single-thread Robolink() IPC -> RoboDK 6.2.3

A few pragmatic decisions made the native UI feel responsive instead of clunky:

  • Windowing without Win32 deadlocks: By default, the copilot docks as a Qt.Tool window parented to RoboDK (GWLP_HWNDPARENT) and snapped cleanly to the right edge of the viewport, avoiding the focus and HiDPI bugs that plague forced Win32 SetParent embedding (EmbedWindow remains an explicit opt-in).
  • Adaptive selection awareness: A dedicated background QThread polls the active station and selected items (100 ms when focused, 1,500 ms in the background, paused mid-turn). Clicking a robot, reference frame, or gripper immediately feeds compact spatial context (<= 2,800 characters) into the next prompt.
  • Zero orphan processes: The child ACP harness is bound to a Windows Job Object with KILL_ON_JOB_CLOSE, so closing RoboDK cleanly tears down the entire stack.

Making It Feel Instant: Real Micro-Benchmarks

An engineering copilot loses its magic the moment every tool call lags for seconds. Before finalizing the server architecture, I benchmarked the live RoboDK 6.2.3 IPC path on my local workstation and eliminated the two biggest bottlenecks: cold socket reconnects and unnecessary viewport redraws.

  • Warm Robolink() singleton: Moving all API calls onto a single-thread ThreadPoolExecutor(max_workers=1) with a persistent Robolink() connection dropped IPC overhead from 13.93 ms (cold) down to 0.17 ms (82x faster).
  • Sub-millisecond kinematics: SolveFK runs in 0.11 ms, SolveIK in 0.09 ms, and Collisions() in 0.40 ms after map initialization.
  • Batched target creation: Wrapping multi-target generation in Render(False) / Render(True) cut a 20-target sequence from 137.43 ms down to 23.67 ms (5.8x faster).
  • Giving the agent eyes: Command("Snapshot") captures the active 3D viewport in 66.89 ms (~149 KB PNG) and streams it back as native MCP ImageContent (backed by a 20-file LRU cache), so the model can visually verify gripper orientation, clearance, and cell layout instead of flying blind.

What robodk-mcp Can Do Today (31 Tools)

The server exposes 31 focused tools grouped around real offline-programming workflows, paired with RoboDK’s 7 official Agent Skills (robodk-api, robodk-shape-builder, robodk-station-audit, robodk-post-processor-builder, robodk-driver-builder, robodk-addin, and robodk-real-robot-control):

  1. Session & License-Free Persistence: station_status, start_robodk, new_station, open_station, save_station, export_scene_json, import_scene_json, and set_run_mode.
  2. Spatial Context, Vision & Online Robot Library: get_active_context, list_items, get_item_details (including world and local bounding boxes), render_snapshot, list_library_files, list_post_processors, plus search_online_library and load_online_library_model — giving the agent direct search and download access to 1,800+ official RoboDK robots, external axes, and tools filtered by brand, DOF, reach (mm), payload (kg), and application, with 24-hour local catalog caching.
  3. Workcell Editing: add_file, add_frame, add_tool, add_target, set_item_pose, reparent_item, configure_item, and delete_item.
  4. Kinematics, Collisions & Offline Programming: solve_kinematics (including batch reachability up to 50 poses), check_collisions, set_robot_joints, move_robot, create_program, run_program, and generate_program.

Fixing Nested Reference-Frame Inverse Kinematics

One subtle bug that bites almost every RoboDK automation script happens when a target lives inside a nested child reference frame rather than directly under the robot base. Passing a local pose straight to SolveIK silently solves in the wrong coordinate space. In robodk-mcp, target poses are normalized into the robot base frame before solving:

# Normalize nested-frame target pose into the robot base frame
base_from_frame = robot.PoseAbs().inv() * frame.PoseAbs()
pose_in_robot_base = base_from_frame * target_pose_local
joints_solution = robot.SolveIK(pose_in_robot_base, joints_approx, tool_pose)

Combining that transform with batch pose evaluation (up to 50 poses in a single tool call) lets the agent validate an entire pick-and-place or contour path in one round-trip.

Solving the Free-Tier Save & Undo Problem

Early in prototyping, the Add-in’s UndoManager checkpointed stations via rdk.Save() into a temp ring buffer. That worked great on single-robot cells — until you add a second robot or mechanism on the RoboDK Free tier, where rdk.Save() is license-restricted.

Instead of giving up on one-click Undo, I replaced binary .rdk checkpoints with pure JSON scene snapshots:

  • export_scene_json serializes the active workcell — robots, mechanisms, tracked local/online library sources, nested reference frames, TCP definitions, joint/Cartesian targets, and program instruction trees — into clean portable JSON without touching rdk.Save().
  • import_scene_json reconstructs the full multi-robot station on demand from cached local or online library assets.
  • Inside the PySide6 Add-in, UndoManager now diffs and reverts scenes in-place from JSON snapshots, keeping multi-robot experimentation fast and reversible even without a paid license.

Safety & Hardening: Simulation-Only by Default

When an AI agent controls a robotics tool, safety boundaries cannot live only in a system prompt. They have to be enforced deterministically in server code:

  • Hardware lock (RUNMODE 4, 5, and 6): ROBODK_ALLOW_REAL_ROBOT defaults to "false". Switching to real-robot upload, start, or live online control is blocked server-side across set_run_mode, set_robot_joints, move_robot, run_program, and generate_program.
  • Embedded Python gate: .rdk station files can contain embedded Python scripts. Before run_program executes anything, it inspects InstructionList() and refuses programs containing INS_TYPE_CODE / RunCode or ITEM_TYPE_PROGRAM_PYTHON calls unless explicitly allowed.
  • Filesystem & prompt-injection boundaries: All file tools reject UNC paths, null bytes, relative traversal (..), and writes into protected RoboDK system directories. Meanwhile, get_active_context strips control characters from item names, excludes raw station notes and script bodies, and wraps scene metadata in explicit untrusted-data delimiters.
  • Clean JSON-RPC stdio: At startup, the server duplicates file descriptor 1 exclusively for MCP JSON-RPC frames and routes any stray library stdout noise to stderr, preventing protocol corruption.

First Live Cell Milestone

Seeing the whole stack run live against RoboDK 6.2.3 felt like closing a six-year loop from my university labs.

In a live conversational session, the copilot inspected an ABB IRB 1200-5/0.9 Gen2 cell, searched the online RoboDK library for a compatible parallel gripper, downloaded and mounted a RobotiQ 2F-85 Gripper directly onto the robot flange, zeroed the base offset, configured TCP_RobotiQ_2F85 at Z = +145 mm, and generated a collision-free 10-target joint animation program (13 instructions, 4,374 mm path length, 14.1 s cycle time) — all verified by 22/22 live MCP tests, 21/21 Add-in unit tests, and 0 errors on RoboDK’s official Add-in validator.

Comparing RoboDK MCP vs. Alternatives

If you are evaluating ways to bring AI into industrial offline robot programming (whether you search for RoboDK MCP, RobotDK MCP, or a general RoboDK AI assistant), three main approaches exist today:

  • One-off LLM-generated Python scripts (robolink): Easy to start, but completely blind to live viewport geometry, nested reference frames, and active selections — every bug requires manual copy-paste debugging.
  • Skill-only instruction bundles (RoboDK-Agent-Skills): Essential domain knowledge for post-processors, drivers, and add-in packaging, yet still dependent on shelling out cold Python processes (13.93 ms+ reconnects per call) without a persistent scene handle or live visual feedback.
  • Hardened RoboDK MCP server + Official Skills + Native Copilot (this architecture): Keeps RoboDK’s deterministic math warm in a single thread (0.17 ms), feeds live selection context and viewport PNGs back into the agent loop, and enforces simulation-only safety locks and path allowlists at the tool boundary.

What Comes Next

The foundation is solid and fast, and two milestones are next on my roadmap:

  1. Sandboxed Text-to-CAD (build123d -> .step): Letting the copilot generate parametric fixtures, brackets, and end-effector adapters in millimeters inside a memory- and time-bounded worker, then drop them straight into the RoboDK cell for collision validation.
  2. Clean .rdkp distribution: Packaging the PySide6 Copilot and robodk-mcp server cleanly so other robotics engineers — and enthusiastic students discovering RoboDK for the first time — can drop it into their stations in minutes.

Frequently Asked Questions

What is robodk-mcp-gemini and how does it compare to other RoboDK MCP alternatives?

robodk-mcp-gemini is an open-source 31-tool RoboDK MCP (Model Context Protocol) server paired with a native PySide6 Gemini AI Copilot Add-in over ACP (Agent Client Protocol) and A2A-ready orchestration. Compared to alternatives like one-off generated Python scripts (blind to live viewport state) or minimal station wrappers, it provides 0.17 ms warm kinematics, nested-frame batch IK, 1,800+ online library models, live viewport PNG vision, license-free JSON scene undo, and server-side simulation-only safety locks.

Does robodk-mcp-gemini work with Google Gemini, Claude Desktop, Cursor, ACP, and A2A agents?

Yes. Whether searched as RoboDK MCP, RobotDK MCP, or robodk-mcp-gemini, the FastMCP server speaks standard JSON-RPC stdio so it plugs directly into Gemini / Antigravity over ACP, multi-agent A2A orchestrators, Claude Desktop, and Cursor, as well as the native PySide6 RoboDK Add-in.

Does robodk-mcp-gemini work on the RoboDK Free tier with multiple robots?

Yes. While RoboDK's built-in rdk.Save() restricts saving multi-robot stations on the free tier, robodk-mcp-gemini includes export_scene_json and import_scene_json tools—and an in-place JSON snapshot UndoManager in the PySide6 Add-in—to persist, reconstruct, and revert multi-robot workcells without requiring a paid license.

Can an AI agent accidentally move a real physical robot through RoboDK MCP?

No by default. ROBODK_ALLOW_REAL_ROBOT defaults to false, hard-blocking hardware execution modes (RUNMODE 4, 5, and 6) server-side across motion, program execution, and code generation tools. Additionally, run_program inspects InstructionList() to block untrusted embedded Python scripts inside .rdk files unless explicitly approved.

Get notified when new engineering notes publish

Powered externally by Buttondown with double opt-in and one-click unsubscribe (zero site cookies or tracking). Prefer RSS? Subscribe directly via /rss.xml .