nina-mcp
Enables AI agents to control N.I.N.A. astronomy software remotely, including mount, camera, sequencer, and other equipment via the ninaAPI plugin.
README
nina-mcp
An MCP server that gives an AI agent (your openclaw agent, Claude, or anything else that speaks MCP) control over N.I.N.A. (Nighttime Imaging 'N' Astronomy). Mount, camera, sequencer, filter wheel, focuser, rotator, dome, guider, switches, flat panels, and target scheduling are all fully implemented. Safety monitor and weather stations are exposed as status reads.
It talks to NINA over HTTP via the community ninaAPI plugin (also called "Advanced API" in the NINA plugin list) — this MCP server doesn't replace that plugin, it wraps it.
Prerequisites
- NINA installed and running, with the Advanced API plugin installed (NINA > Plugins > search "Advanced API") and enabled.
- Note the host/port it's listening on (NINA > Options > Plugins > Advanced
API — default port is
1888). If this MCP server runs on the same PC as NINA, the default127.0.0.1:1888just works. - Python 3.10+ wherever this MCP server runs.
Install
cd nina-mcp
python -m venv .venv
# Windows: .venv\Scripts\activate
source .venv/bin/activate
pip install -e .
Copy .env.example to .env and adjust NINA_HOST / NINA_PORT if needed
(defaults assume NINA is on the same machine, default port).
Run it
Directly, for any MCP client that spawns servers over stdio (Claude Desktop, Claude Code, and presumably your openclaw agent — MCP's stdio transport is just "run this command, talk JSON-RPC over its stdin/stdout"):
nina-mcp
# or: python -m nina_mcp.server
Point your MCP client's config at it. The generic shape (adjust keys to whatever openclaw's config format expects — this is the same shape Claude Desktop uses):
{
"mcpServers": {
"nina": {
"command": "/absolute/path/to/nina-mcp/.venv/bin/python",
"args": ["-m", "nina_mcp.server"],
"env": {
"NINA_HOST": "127.0.0.1",
"NINA_PORT": "1888"
}
}
}
}
If openclaw needs a network transport instead of stdio (SSE / streamable
HTTP), FastMCP supports that too — change the mcp.run() call in
server.py to mcp.run(transport="streamable-http") (see the mcp Python
SDK docs for the current options; this changed a couple of times across
versions).
Testing without an agent
test_client.py is a minimal MCP client included so you can sanity-check the
server without wiring up openclaw first. It spawns the server itself over
stdio, same as a real client would:
python test_client.py # list all tools
python test_client.py nina_mount_info # call with no args
python test_client.py nina_mount_sync ra=10.5 dec=41.2 # call with args
What's actually implemented
Core (full control)
- Equipment (generic,
tools/equipment.py) — combined status, list available devices, connect/disconnect/rescan any device by name, and poll recent event history. Connect equipment through these tools before using the device-specific ones below. - Mount (
tools/mount.py) — info, home, park/unpark, tracking mode, slew (raw, center, or center+rotate), stop slew, sync, meridian flip, set park position. - Camera (
tools/camera.py) — info, capture (all the knobs: duration, gain, save, target name, image type, plate-solve, binning, readout mode), abort exposure, capture statistics, cooling/warming, dew heater, USB limit. - Sequencer (
tools/sequencer.py) — get sequence JSON/state, start, stop, reset, skip, edit a field in place, list/load saved sequences by name, load a full sequence from JSON, update a target's coordinates.
Target Scheduler — read this before assuming "full control"
ninaAPI does not expose Target Scheduler's projects/targets/exposure plans
as REST endpoints. I checked ninaAPI's source directly
(WebService/V2/Application/TargetScheduler.cs): all it does is forward
three of TS's internal status messages (wait-start, new-target-start,
target-start) as read-only events. There's no endpoint to list projects,
change priorities, or ask what it'll image next — that logic is entirely
internal to the Target Scheduler plugin's own Planning Engine, which only
runs from inside a NINA sequence via its "Target Scheduler Container"
instruction (which you still have to build once, by hand, in the NINA UI —
no API creates it for you either).
So tools/target_scheduler.py gives you the two things that actually exist:
- Running it — just a normal sequence. Build a sequence containing a
Target Scheduler Container instruction in NINA's UI once, then use
nina_sequence_load_by_name+nina_sequence_startto run it. - Reading/editing its data — Target Scheduler stores everything in a
local SQLite database (
schedulerdb.sqlite, path documented in the plugin's own docs). Rather than hardcode column names I couldn't verify against a real database (the schema changed across major TS versions),ts_db.pyimplements generic, schema-validated tools:ts_list_tables,ts_describe_table,ts_read_table, and a narrowts_update_cell(single column, single row, by id) that's disabled by default — setTS_ALLOW_WRITES=trueonce you've backed up your database and want an agent editing it.ts_recent_eventspolls the live status events from (1).
To support Target Scheduler automation, we have implemented typed database write
tools (ts_set_project_priority, ts_set_project_enabled, and ts_toggle_target_enabled)
that dynamically discover the active tables and columns (supporting both TS4 and TS5).
ts_recent_events polls the live status events from (1).
Status-Only Modules (tools/placeholders.py)
Safety monitor and weather stations do not have REST control surfaces upstream, so they only expose *_info status reads.
Architecture
src/nina_mcp/
config.py settings from environment variables
nina_client.py async HTTP client, unwraps ninaAPI's response envelope
ts_db.py generic, schema-validated SQLite access for Target Scheduler
server.py FastMCP app, registers every tool module
tools/
equipment.py generic connect/disconnect/list/rescan/event-history
mount.py full mount control
camera.py full camera control
sequencer.py full sequencer control
target_scheduler.py DB + event-based TS tools (with schema discovery)
filterwheel.py filter wheel control
focuser.py focuser movement and configuration
rotator.py sky rotator control
dome.py observatory dome control
guider.py autoguiding control
switch.py switch/relay control
flatdevice.py flat panel illumination and cover control
placeholders.py status-only equipment (weather, safety monitor)
test_client.py minimal standalone MCP client for manual testing
Every endpoint path and query parameter here was confirmed against ninaAPI's
own C# source (WebService/V2/...), not guessed from third-party docs —
I pulled the repo and grepped the [Route(...)] attributes directly. The one
thing that genuinely doesn't exist upstream is Target Scheduler's REST API,
which is why that module takes a database-directed approach.
Safety notes
- This gives an agent real control of a telescope mount and camera. A
clumsy
nina_mount_slewor an unattendednina_sequence_startcan point expensive optics somewhere bad or burn a night's imaging. Consider keeping a human in the loop for anything that moves hardware until you trust the setup. TS_ALLOW_WRITESis off by default for a reason — back upschedulerdb.sqlitebefore turning it on.nina_camera_capture'somit_imagedefaults toTrueto avoid dumping large base64 blobs into an agent's context by default.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。