mcpXL30

mcpXL30

Enables LLM agents to control a Philips XL30 ESEM microscope by exposing tools for imaging, beam adjustment, and vacuum chamber operations. It features a safety envelope to regulate sensitive parameters like high tension and stage motion.

Category
访问服务器

README

mcpXL30

WORK IN PROGRESS

mcpXL30 is an MCP (Model Context Protocol) server that exposes a curated subset of the pyxl30 control library to LLM agents (i.e. AI contorl of the XL30 ESEM).

Note that this project was partially generated with LLM support.

Features

  • Async MCP tools for common Philips XL30 operations (identify, read/set high tension, change scan modes, trigger pump/vent cycles, capture TIFF images).
  • Live MCP resources that describe the connected instrument and active config.
  • Safety envelope that limits accelerating voltage and sensitive operations.
  • Fine grained settings that control allowed operations for the LLM agent.
  • Optional remote HTTP/UDS transport with the authentication workflow explained in my blog post.

Installation

pip install mcpXL30
# or
pip install "mcpXL30[remote]"  # adds FastAPI/uvicorn/argon2 for remote mode

Configuration

The server loads JSON configuration from ~/.config/mcpxl30/config.json by default (override via --config). A minimal example:

{
  "instrument": {
    "port": "/dev/ttyUSB0",
    "log_level": "INFO",
    "retry_count": 3,
    "reconnect_count": 3
  },
  "image_capture": {
    "remote_directory": "C:\\\\TEMP",
    "filename_prefix": "MCPIMG_"
  },
  "safety": {
    "max_high_tension_kv": 15.0,
    "allow_venting": false,
    "allow_pumping": true,
    "allow_scan_mode_changes": true,
    "allow_stage_motion": false,
    "allow_detector_switching": true,
    "allow_beam_shift": true,
    "allow_scan_rotation_changes": true,
    "allow_image_filter_changes": true,
    "allow_specimen_current_mode_changes": false,
    "allow_beam_blank_control": true,
    "allow_oplock_control": false
  },
  "logging": {
    "level": "INFO",
    "logfile": null
  },
  "remote_server": {
    "uds": "/var/run/mcpxl30.sock",
    "api_key_kdf": {
      "algorithm": "argon2id",
      "salt": "<base64>",
      "time_cost": 3,
      "memory_cost": 65536,
      "parallelism": 1,
      "hash_len": 32,
      "hash": "<base64>"
    }
  }
}

Use mcpxl30-genkey --config /path/to/config.json (or mcpxl30 --genkey) to generate a new API key and populate the Argon2 hash inside the remote_server block. The plain token prints once to stdout.

The safety block gates riskier capabilities. Keep allow_stage_motion and allow_oplock_control disabled unless you trust the calling agent. Imaging and detector-related fields default to safe-but-capable settings, but you can toggle them per deployment.

Running the server

stdio transport (default)

mcpxl30 --config ~/.config/mcpxl30/config.json

The process utilizes the stdio transport.

Remote FastAPI/uvicorn transport

pip install "mcpXL30[remote]"
mcpxl30 --transport remotehttp --config ~/.config/mcpxl30/config.json
  • The FastAPI app exposes /mcp (MCP streaming API) and /status (unauthenticated health check).
  • Authentication expects the API key in Authorization: Bearer, X-API-Key, or the ?api_key= query parameter.
  • Binding uses a Unix domain socket (remote_server.uds) unless you specify a TCP port, in which case host (default 0.0.0.0) applies.

MCP functionality

Tools

Instrument Basics

Tool Purpose
instrument_identify Return the microscopes type/serial, scan mode, high tension.
read_high_tension / set_high_tension Inspect or change accelerating voltage (safety-capped).
get_scan_mode / set_scan_mode Read or change scan mode (allow_scan_mode_changes).
capture_image / trigger_photo_capture Store images (TIFF or console photo).
control_vent, pump_chamber Chamber vent/pump control (safety gated).

Beam & Detector Controls

Tool Purpose
get_spot_size / set_spot_size Read or set probe current (1–10).
get_magnification / set_magnification Read or set magnification (20–400 000).
get_stigmator / set_stigmator Inspect/update stigmator X/Y.
get_detector / set_detector Inspect or switch active detector (allow_detector_switching).
read_high_tension Included above but relevant for beam tuning.

Scan Timing & Geometry

Tool Purpose
get_line_time / set_line_time Read or set line time (ms or TV).
get_lines_per_frame / set_lines_per_frame Inspect or adjust lines per frame.
get_scan_rotation / set_scan_rotation Read or set scan rotation (allow_scan_rotation_changes).
get_area_dot_shift / set_area_dot_shift Manage area/dot shift percentages (allow_beam_shift).
get_selected_area_size / set_selected_area_size Control selected area dimensions.

Imaging Utilities

Tool Purpose
get_contrast / set_contrast Read or set contrast (0–100).
get_brightness / set_brightness Read or set brightness (0–100).
auto_contrast_brightness, auto_focus Run built-in adjustment routines.
get_databar_text / set_databar_text Inspect or update the image databar text.

Stage & Alignment

Tool Purpose
stage_home Home the stage (allow_stage_motion).
get_stage_position / set_stage_position Read or move X/Y/Z/tilt/rotation (allow_stage_motion).
get_beam_shift / set_beam_shift Inspect or adjust beam shift (allow_beam_shift).

Image Filtering & Specimen Current

Tool Purpose
get_image_filter_mode / set_image_filter_mode Manage FastMCP image filter + frame count (allow_image_filter_changes).
get_specimen_current_detector_mode / set_specimen_current_detector_mode Inspect or change detector mode (allow_specimen_current_mode_changes).
get_specimen_current Read specimen current (requires measure mode).

Beam Safety & Locks

Tool Purpose
is_beam_blanked, blank_beam, unblank_beam Inspect or control beam blank state (allow_beam_blank_control).
get_oplock_state, set_oplock_state Inspect or control the operator lock (allow_oplock_control).

Every setter uses blocking pyxl30 calls inside asyncio.to_thread, preserving the FastMCP event loop responsiveness. Review the safety settings to enable only the tools you trust agents with.

All setters perform blocking pyxl30 calls inside asyncio.to_thread so the MCP event loop stays responsive.

Resources

  • mcpxl30://instrument/capabilities – supported scan modes, image filter names, and the configured safety envelope.
  • mcpxl30://instrument/config – sanitized live configuration (excludes API secrets).

Examples

An examples/example_config.json file is included to bootstrap deployments. The repository mirrors mcpMQTT's project layout so existing FastMCP infrastructure (supervisors, packaging, docs) can be reused with minimal changes.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选