5.5. AI Agents (MCP Server)#
TII Spectrometry Touch can be operated by AI assistants such as Claude, VS Code or Cursor agents, or a local language model. An optional MCP server runs next to the application on the same device and lets an assistant read and change the acquisition settings, record spectra, run automated series and analyze the results - with the plots shown directly in the conversation. You describe what you want (“record ten spectra, one every 30 seconds, at 50 ms exposure, and plot the peak height over time”); the assistant does it.
Note
The MCP server is a separate, optional component that is installed once on the device by whoever sets it up. Using it requires an AI assistant that supports the Model Context Protocol (MCP). Cloud-based assistants need an internet connection on the computer they run on.
5.5.1. What an assistant can do#
Task |
What happens |
|---|---|
Check the instrument |
Reports whether TII Spectrometry Touch is reachable and shows the current configuration |
Change settings |
Sets the exposure time, the number of averaged spectra and other configuration values, and reads them back to confirm they were taken over |
Record a spectrum |
Acquires one spectrum, saves it as a |
Record a series |
Acquires a number of spectra at a fixed interval as a background job that keeps running even when the conversation is closed |
Automate |
Runs scripts for exposure sweeps, time lapses and other measurements that loop or wait |
Analyze |
Fits, integrates, compares and plots recorded data next to the device, and hands back results and figures |
The assistant never receives the full spectra in the conversation, only summaries and files. Data and figures can be downloaded through links the assistant provides.
5.5.2. Requirements#
The TCP/IP Server switch in the Data drawer must be on (TCP/IP Server). The MCP server talks to TII Spectrometry Touch through it. While the switch is off, or a spectrometer is not connected, the assistant reports the instrument as unreachable; switching it on is enough, nothing needs to be restarted.
The device and the computer running the assistant must be on the same network. Normally this is the laboratory network. If the computer joins the device’s own Access Point instead, a cloud-based assistant cannot be reached (the access point has no internet connection); a locally running language model works in that case.
5.5.3. Connecting an assistant#
Open the setup page of the device in a web browser on your computer:
http://tiispectrometry.local:8766/
(use the device’s host name or IP address as shown by your administrator). Enter the access token of the installation. The page then shows ready-made configurations for the common assistants - copy the one for yours into its settings. For applications that can only start local programs (Claude Desktop, LM Studio and others) the page also offers a small bridge program to download on Windows.
Important
The access token gives full control of the spectrometer. Keep it like a password and use the MCP server only on trusted networks.
No further instructions have to be given to the assistant: the server tells it how the instrument works, how to write automation scripts and which precautions to take.
5.5.4. Working with an assistant#
Some examples of requests:
“What is the spectrometer set to right now?”
“Record a spectrum at 20 ms exposure with 4 averages and tell me where the strongest peak is.”
“Take 20 spectra, one per minute, and show how the peak at 450 nm changes.”
“Sweep the exposure time from 10 ms to 1 s in 8 logarithmic steps and plot the peak intensity against it.”
Long measurements run as background jobs on the device. The assistant starts them, reports their progress and can stop them; they continue if the conversation ends or the computer goes to sleep, and the assistant can pick the results up again later.
5.5.4.1. Where the data is#
Everything the assistant records or produces is stored on the device in a folder named agent_workspace. When
the MCP server was installed with the default settings, this folder lies inside the
shared folder, so it can be opened from any computer as
\\tiispectrometry.local\Spectra\agent_workspace:
Folder |
Contents |
|---|---|
|
Single spectra recorded on request |
|
One folder per background job: the script that ran, its log, and the recorded spectra |
|
Figures produced during analysis |
|
Results meant to be kept, such as tables and final figures |
Spectra are .csv files with the header wavelength_nm,intensity.
5.5.6. Troubleshooting#
Symptom |
What to check |
|---|---|
The assistant says the instrument is unreachable |
Switch on the TCP/IP Server in the Data drawer and make sure a spectrometer is connected. |
The setup page does not open |
Check that the computer is on the same network as the device and that the host name resolves; try the IP address instead. On recent macOS versions the browser needs the Local Network permission. |
The assistant reports an invalid token or unauthorized |
Re-enter the token from the setup page. Applications cache their settings: restart the assistant’s application after changing the token. |
Requests are refused as busy |
A background job is running. Let it finish, or ask the assistant to cancel it. |
A request does not finish for a long time |
One acquisition takes about exposure time x number of averages; check both values. |