able-mcp-notable-96 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- able_mcp_notable_96-0.1.0/.gitignore +10 -0
- able_mcp_notable_96-0.1.0/CHANGELOG.md +22 -0
- able_mcp_notable_96-0.1.0/LICENSE +201 -0
- able_mcp_notable_96-0.1.0/PKG-INFO +80 -0
- able_mcp_notable_96-0.1.0/README.md +55 -0
- able_mcp_notable_96-0.1.0/pyproject.toml +42 -0
- able_mcp_notable_96-0.1.0/src/notable_96_mcp/__init__.py +0 -0
- able_mcp_notable_96-0.1.0/src/notable_96_mcp/server.py +246 -0
- able_mcp_notable_96-0.1.0/src/notable_96_mcp/simulator.py +95 -0
- able_mcp_notable_96-0.1.0/src/notable_96_mcp/tools/__init__.py +0 -0
- able_mcp_notable_96-0.1.0/src/notable_96_mcp/tools/control.py +53 -0
- able_mcp_notable_96-0.1.0/src/notable_96_mcp/tools/device.py +22 -0
- able_mcp_notable_96-0.1.0/src/notable_96_mcp/tools/protocol.py +75 -0
- able_mcp_notable_96-0.1.0/src/notable_96_mcp/tools/status.py +17 -0
- able_mcp_notable_96-0.1.0/src/notable_96_mcp/tools/teaching.py +30 -0
- able_mcp_notable_96-0.1.0/tests/test_protocol_tools.py +105 -0
- able_mcp_notable_96-0.1.0/tests/test_server_routing.py +120 -0
- able_mcp_notable_96-0.1.0/tests/test_tools_status.py +31 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `able-mcp-notable-96` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-05-13
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Initial release. MCP server for the ABLE Labs Notable-96 high-throughput
|
|
14
|
+
liquid-handling robot.
|
|
15
|
+
- 96-channel device control tools (SPEC-PROTO-001).
|
|
16
|
+
- Protocol authoring tools: create / add_step / save / load / list / validate / simulate (SPEC-PROTO-001).
|
|
17
|
+
- Real-device mode infrastructure (App Server bundling and lifecycle, SPEC-DIST-001).
|
|
18
|
+
- Console entry point `able-mcp-notable-96`.
|
|
19
|
+
|
|
20
|
+
### Known limitations
|
|
21
|
+
- Real-device mode (`simulate: false`) requires App Server binaries that are not yet published. Setting `simulate: false` will raise `BinaryDownloadError` until v0.2.0. Default simulation mode works without external dependencies.
|
|
22
|
+
- Simulator stubs for `aspirate`/`dispense`/`gripper` return mock dicts intended for protocol authoring practice, not for verifying real liquid-handling behavior.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may accept and charge a
|
|
167
|
+
fee for accepting support, warranty, indemnity, or other liability
|
|
168
|
+
obligations and/or rights consistent with this License. However, in
|
|
169
|
+
accepting such obligations, You may act only on Your own behalf
|
|
170
|
+
and on Your sole responsibility, not on behalf of any other
|
|
171
|
+
Contributor, and only if You agree to indemnify, defend, and hold
|
|
172
|
+
each Contributor harmless for any liability incurred by, or claims
|
|
173
|
+
asserted against, such Contributor by reason of your accepting any
|
|
174
|
+
such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 ABLE Labs
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: able-mcp-notable-96
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for ABLE Labs Notable-96 high-throughput liquid-handling robot — exposes device control tools to Claude via the Model Context Protocol.
|
|
5
|
+
Project-URL: Homepage, https://github.com/ABLE-Labs/mcp
|
|
6
|
+
Project-URL: Issues, https://github.com/ABLE-Labs/mcp/issues
|
|
7
|
+
Project-URL: Documentation, https://github.com/ABLE-Labs/mcp#readme
|
|
8
|
+
Author-email: ABLE Labs <support@ablelabs.com>
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ablelabs,claude,mcp,robotics
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Requires-Dist: able-mcp-core>=0.1.0
|
|
23
|
+
Requires-Dist: mcp>=1.0.0
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# able-mcp-notable-96
|
|
27
|
+
|
|
28
|
+
MCP server for the ABLE Labs Notable-96 high-throughput liquid-handling
|
|
29
|
+
robot. Exposes 96-channel device control tools and protocol authoring
|
|
30
|
+
tools (create / save / load / simulate) to Claude and any other
|
|
31
|
+
MCP-compatible client.
|
|
32
|
+
|
|
33
|
+
## v0.1.0 — simulation only
|
|
34
|
+
|
|
35
|
+
This release runs in **simulation mode only**. Real-device mode (which
|
|
36
|
+
spawns a bundled App Server binary) is implemented in code (SPEC-DIST-001)
|
|
37
|
+
but the App Server binaries are scheduled for **v0.2.0**. Enabling
|
|
38
|
+
`simulate: false` in this release will fail with `BinaryDownloadError`.
|
|
39
|
+
|
|
40
|
+
> Note: simulator stubs for `aspirate`/`dispense`/`gripper` return mock
|
|
41
|
+
> dicts — useful for protocol authoring practice, not for verifying real
|
|
42
|
+
> liquid-handling logic.
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# One-shot run (recommended for Claude Desktop)
|
|
48
|
+
uvx able-mcp-notable-96
|
|
49
|
+
|
|
50
|
+
# Or install into a Python environment
|
|
51
|
+
pip install able-mcp-notable-96
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`able-mcp-core` is pulled in automatically as a dependency.
|
|
55
|
+
|
|
56
|
+
## Claude Desktop configuration
|
|
57
|
+
|
|
58
|
+
Add to `claude_desktop_config.json`:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"mcpServers": {
|
|
63
|
+
"notable-96": {
|
|
64
|
+
"command": "uvx",
|
|
65
|
+
"args": ["able-mcp-notable-96"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
No additional configuration is required for v0.1.0.
|
|
72
|
+
|
|
73
|
+
## Links
|
|
74
|
+
|
|
75
|
+
- Repository: <https://github.com/ABLE-Labs/mcp>
|
|
76
|
+
- Issues: <https://github.com/ABLE-Labs/mcp/issues>
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
Apache-2.0. See the `LICENSE` file shipped with the distribution.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# able-mcp-notable-96
|
|
2
|
+
|
|
3
|
+
MCP server for the ABLE Labs Notable-96 high-throughput liquid-handling
|
|
4
|
+
robot. Exposes 96-channel device control tools and protocol authoring
|
|
5
|
+
tools (create / save / load / simulate) to Claude and any other
|
|
6
|
+
MCP-compatible client.
|
|
7
|
+
|
|
8
|
+
## v0.1.0 — simulation only
|
|
9
|
+
|
|
10
|
+
This release runs in **simulation mode only**. Real-device mode (which
|
|
11
|
+
spawns a bundled App Server binary) is implemented in code (SPEC-DIST-001)
|
|
12
|
+
but the App Server binaries are scheduled for **v0.2.0**. Enabling
|
|
13
|
+
`simulate: false` in this release will fail with `BinaryDownloadError`.
|
|
14
|
+
|
|
15
|
+
> Note: simulator stubs for `aspirate`/`dispense`/`gripper` return mock
|
|
16
|
+
> dicts — useful for protocol authoring practice, not for verifying real
|
|
17
|
+
> liquid-handling logic.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# One-shot run (recommended for Claude Desktop)
|
|
23
|
+
uvx able-mcp-notable-96
|
|
24
|
+
|
|
25
|
+
# Or install into a Python environment
|
|
26
|
+
pip install able-mcp-notable-96
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`able-mcp-core` is pulled in automatically as a dependency.
|
|
30
|
+
|
|
31
|
+
## Claude Desktop configuration
|
|
32
|
+
|
|
33
|
+
Add to `claude_desktop_config.json`:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"mcpServers": {
|
|
38
|
+
"notable-96": {
|
|
39
|
+
"command": "uvx",
|
|
40
|
+
"args": ["able-mcp-notable-96"]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
No additional configuration is required for v0.1.0.
|
|
47
|
+
|
|
48
|
+
## Links
|
|
49
|
+
|
|
50
|
+
- Repository: <https://github.com/ABLE-Labs/mcp>
|
|
51
|
+
- Issues: <https://github.com/ABLE-Labs/mcp/issues>
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
Apache-2.0. See the `LICENSE` file shipped with the distribution.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "able-mcp-notable-96"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "MCP server for ABLE Labs Notable-96 high-throughput liquid-handling robot — exposes device control tools to Claude via the Model Context Protocol."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "Apache-2.0"
|
|
7
|
+
requires-python = ">=3.11"
|
|
8
|
+
keywords = ["mcp", "claude", "ablelabs", "robotics"]
|
|
9
|
+
authors = [{ name = "ABLE Labs", email = "support@ablelabs.com" }]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"Intended Audience :: Science/Research",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.11",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Topic :: Scientific/Engineering",
|
|
19
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"able-mcp-core>=0.1.0",
|
|
23
|
+
"mcp>=1.0.0",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/ABLE-Labs/mcp"
|
|
28
|
+
Issues = "https://github.com/ABLE-Labs/mcp/issues"
|
|
29
|
+
Documentation = "https://github.com/ABLE-Labs/mcp#readme"
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
able-mcp-notable-96 = "notable_96_mcp.server:main"
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["hatchling"]
|
|
36
|
+
build-backend = "hatchling.build"
|
|
37
|
+
|
|
38
|
+
[tool.hatch.build.targets.wheel]
|
|
39
|
+
packages = ["src/notable_96_mcp"]
|
|
40
|
+
|
|
41
|
+
[tool.uv.sources]
|
|
42
|
+
able-mcp-core = { workspace = true }
|
|
File without changes
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
from mcp.server import Server
|
|
3
|
+
from mcp.server.stdio import stdio_server
|
|
4
|
+
from mcp import types
|
|
5
|
+
from mcp_core.adapters.notable_96_ts import Notable96Adapter
|
|
6
|
+
from mcp_core.config import load_config
|
|
7
|
+
from mcp_core.protocol import ProtocolRegistry
|
|
8
|
+
from mcp_core.protocol.dispatch import dispatch_protocol_tool
|
|
9
|
+
from mcp_core.protocol.tool_defs import protocol_tools
|
|
10
|
+
from .simulator import Notable96Simulator
|
|
11
|
+
from .tools import protocol as protocol_tool_handlers
|
|
12
|
+
from .tools.control import (
|
|
13
|
+
handle_compile_protocol, handle_reset_robot,
|
|
14
|
+
handle_start_run, handle_stop_run, handle_pause_run,
|
|
15
|
+
handle_resume_run, handle_emergency_stop,
|
|
16
|
+
)
|
|
17
|
+
from .tools.status import handle_get_robot_status, handle_get_run_status
|
|
18
|
+
from .tools.device import handle_move_z_up, handle_control_interlock, handle_get_deck_status
|
|
19
|
+
from .tools.teaching import (
|
|
20
|
+
handle_get_teaching_slots, handle_get_teaching_slot, handle_save_teaching_slot,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
SERVER_INSTRUCTIONS = """
|
|
25
|
+
NOTABLE 96ch liquid handler MCP server.
|
|
26
|
+
Always check get_robot_status before controlling the device.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
TOOLS = [
|
|
30
|
+
types.Tool(
|
|
31
|
+
name="compile_protocol",
|
|
32
|
+
description="Compiles a protocol and returns the execution plan.",
|
|
33
|
+
inputSchema={
|
|
34
|
+
"type": "object",
|
|
35
|
+
"properties": {"protocol_id": {"type": "string", "description": "Protocol ID to compile"}},
|
|
36
|
+
"required": ["protocol_id"],
|
|
37
|
+
},
|
|
38
|
+
),
|
|
39
|
+
types.Tool(
|
|
40
|
+
name="get_robot_status",
|
|
41
|
+
description="Returns the current robot status.",
|
|
42
|
+
inputSchema={"type": "object", "properties": {}, "required": []},
|
|
43
|
+
),
|
|
44
|
+
types.Tool(
|
|
45
|
+
name="get_run_status",
|
|
46
|
+
description="Returns the current execution status of a run.",
|
|
47
|
+
inputSchema={
|
|
48
|
+
"type": "object",
|
|
49
|
+
"properties": {"run_id": {"type": "string", "description": "Run ID to query"}},
|
|
50
|
+
"required": ["run_id"],
|
|
51
|
+
},
|
|
52
|
+
),
|
|
53
|
+
types.Tool(
|
|
54
|
+
name="start_run",
|
|
55
|
+
description="Starts a run.",
|
|
56
|
+
inputSchema={
|
|
57
|
+
"type": "object",
|
|
58
|
+
"properties": {"run_id": {"type": "string"}},
|
|
59
|
+
"required": ["run_id"],
|
|
60
|
+
},
|
|
61
|
+
),
|
|
62
|
+
types.Tool(
|
|
63
|
+
name="stop_run",
|
|
64
|
+
description="Stops a run.",
|
|
65
|
+
inputSchema={
|
|
66
|
+
"type": "object",
|
|
67
|
+
"properties": {"run_id": {"type": "string"}},
|
|
68
|
+
"required": ["run_id"],
|
|
69
|
+
},
|
|
70
|
+
),
|
|
71
|
+
types.Tool(
|
|
72
|
+
name="pause_run",
|
|
73
|
+
description="Pauses a run.",
|
|
74
|
+
inputSchema={
|
|
75
|
+
"type": "object",
|
|
76
|
+
"properties": {"run_id": {"type": "string"}},
|
|
77
|
+
"required": ["run_id"],
|
|
78
|
+
},
|
|
79
|
+
),
|
|
80
|
+
types.Tool(
|
|
81
|
+
name="resume_run",
|
|
82
|
+
description="Resumes a paused run.",
|
|
83
|
+
inputSchema={
|
|
84
|
+
"type": "object",
|
|
85
|
+
"properties": {"run_id": {"type": "string"}},
|
|
86
|
+
"required": ["run_id"],
|
|
87
|
+
},
|
|
88
|
+
),
|
|
89
|
+
types.Tool(
|
|
90
|
+
name="reset_robot",
|
|
91
|
+
description="Resets the robot to initial state.",
|
|
92
|
+
inputSchema={"type": "object", "properties": {}, "required": []},
|
|
93
|
+
),
|
|
94
|
+
types.Tool(
|
|
95
|
+
name="emergency_stop",
|
|
96
|
+
description="Emergency stop.",
|
|
97
|
+
inputSchema={"type": "object", "properties": {}, "required": []},
|
|
98
|
+
),
|
|
99
|
+
types.Tool(
|
|
100
|
+
name="move_z_up",
|
|
101
|
+
description="Raises Z axis to safe position for recovery.",
|
|
102
|
+
inputSchema={"type": "object", "properties": {}, "required": []},
|
|
103
|
+
),
|
|
104
|
+
types.Tool(
|
|
105
|
+
name="control_interlock",
|
|
106
|
+
description="Enables or disables the door interlock.",
|
|
107
|
+
inputSchema={
|
|
108
|
+
"type": "object",
|
|
109
|
+
"properties": {"action": {"type": "string", "enum": ["enable", "disable"]}},
|
|
110
|
+
"required": ["action"],
|
|
111
|
+
},
|
|
112
|
+
),
|
|
113
|
+
types.Tool(
|
|
114
|
+
name="get_deck_status",
|
|
115
|
+
description="Returns the current deck and gripper status.",
|
|
116
|
+
inputSchema={"type": "object", "properties": {}, "required": []},
|
|
117
|
+
),
|
|
118
|
+
types.Tool(
|
|
119
|
+
name="get_teaching_slots",
|
|
120
|
+
description="Returns all calibrated teaching slot origins.",
|
|
121
|
+
inputSchema={"type": "object", "properties": {}, "required": []},
|
|
122
|
+
),
|
|
123
|
+
types.Tool(
|
|
124
|
+
name="get_teaching_slot",
|
|
125
|
+
description="Returns the origin coordinates for a specific slot.",
|
|
126
|
+
inputSchema={
|
|
127
|
+
"type": "object",
|
|
128
|
+
"properties": {"slot_id": {"type": "integer", "description": "Slot ID"}},
|
|
129
|
+
"required": ["slot_id"],
|
|
130
|
+
},
|
|
131
|
+
),
|
|
132
|
+
types.Tool(
|
|
133
|
+
name="save_teaching_slot",
|
|
134
|
+
description="Saves calibrated origin coordinates for a slot.",
|
|
135
|
+
inputSchema={
|
|
136
|
+
"type": "object",
|
|
137
|
+
"properties": {
|
|
138
|
+
"slot_id": {"type": "integer"},
|
|
139
|
+
"origin_x": {"type": "number"},
|
|
140
|
+
"origin_y": {"type": "number"},
|
|
141
|
+
"origin_z": {"type": "number"},
|
|
142
|
+
"labware_type": {"type": "string"},
|
|
143
|
+
},
|
|
144
|
+
"required": ["slot_id", "origin_x", "origin_y", "origin_z"],
|
|
145
|
+
},
|
|
146
|
+
),
|
|
147
|
+
*protocol_tools(),
|
|
148
|
+
]
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
_REGISTRY = ProtocolRegistry()
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def create_app(adapter) -> Server:
|
|
155
|
+
app = Server("notable-96-mcp", instructions=SERVER_INSTRUCTIONS)
|
|
156
|
+
|
|
157
|
+
@app.list_tools()
|
|
158
|
+
async def list_tools():
|
|
159
|
+
return TOOLS
|
|
160
|
+
|
|
161
|
+
@app.call_tool()
|
|
162
|
+
async def call_tool(name: str, arguments: dict):
|
|
163
|
+
proto_text = await dispatch_protocol_tool(
|
|
164
|
+
name,
|
|
165
|
+
arguments,
|
|
166
|
+
tools_module=protocol_tool_handlers,
|
|
167
|
+
registry=_REGISTRY,
|
|
168
|
+
simulator=adapter,
|
|
169
|
+
)
|
|
170
|
+
if proto_text is not None:
|
|
171
|
+
return [types.TextContent(type="text", text=proto_text)]
|
|
172
|
+
match name:
|
|
173
|
+
case "compile_protocol":
|
|
174
|
+
text = await handle_compile_protocol(adapter, arguments["protocol_id"])
|
|
175
|
+
case "get_robot_status":
|
|
176
|
+
text = await handle_get_robot_status(adapter)
|
|
177
|
+
case "get_run_status":
|
|
178
|
+
text = await handle_get_run_status(adapter, arguments["run_id"])
|
|
179
|
+
case "reset_robot":
|
|
180
|
+
text = await handle_reset_robot(adapter)
|
|
181
|
+
case "start_run":
|
|
182
|
+
text = await handle_start_run(adapter, arguments["run_id"])
|
|
183
|
+
case "stop_run":
|
|
184
|
+
text = await handle_stop_run(adapter, arguments["run_id"])
|
|
185
|
+
case "pause_run":
|
|
186
|
+
text = await handle_pause_run(adapter, arguments["run_id"])
|
|
187
|
+
case "resume_run":
|
|
188
|
+
text = await handle_resume_run(adapter, arguments["run_id"])
|
|
189
|
+
case "emergency_stop":
|
|
190
|
+
text = await handle_emergency_stop(adapter)
|
|
191
|
+
case "move_z_up":
|
|
192
|
+
text = await handle_move_z_up(adapter)
|
|
193
|
+
case "control_interlock":
|
|
194
|
+
text = await handle_control_interlock(adapter, arguments["action"])
|
|
195
|
+
case "get_deck_status":
|
|
196
|
+
text = await handle_get_deck_status(adapter)
|
|
197
|
+
case "get_teaching_slots":
|
|
198
|
+
text = await handle_get_teaching_slots(adapter)
|
|
199
|
+
case "get_teaching_slot":
|
|
200
|
+
text = await handle_get_teaching_slot(adapter, arguments["slot_id"])
|
|
201
|
+
case "save_teaching_slot":
|
|
202
|
+
text = await handle_save_teaching_slot(
|
|
203
|
+
adapter,
|
|
204
|
+
arguments["slot_id"],
|
|
205
|
+
arguments["origin_x"],
|
|
206
|
+
arguments["origin_y"],
|
|
207
|
+
arguments["origin_z"],
|
|
208
|
+
arguments.get("labware_type"),
|
|
209
|
+
)
|
|
210
|
+
case _:
|
|
211
|
+
text = f"Unknown tool: {name}"
|
|
212
|
+
return [types.TextContent(type="text", text=text)]
|
|
213
|
+
|
|
214
|
+
return app
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def main():
|
|
218
|
+
cfg = load_config("notable-96", default_port=9211)
|
|
219
|
+
|
|
220
|
+
if cfg.simulate:
|
|
221
|
+
async def run_simulate():
|
|
222
|
+
adapter = Notable96Simulator()
|
|
223
|
+
app = create_app(adapter)
|
|
224
|
+
async with stdio_server() as (read_stream, write_stream):
|
|
225
|
+
await app.run(read_stream, write_stream, app.create_initialization_options())
|
|
226
|
+
|
|
227
|
+
asyncio.run(run_simulate())
|
|
228
|
+
return
|
|
229
|
+
|
|
230
|
+
if not cfg.api_key:
|
|
231
|
+
raise SystemExit("notable-96 api_key is required (set in mcp-config.json or NOTABLE_96_API_KEY env var).")
|
|
232
|
+
|
|
233
|
+
# Real-device path: import lifecycle lazily so simulate mode never loads it.
|
|
234
|
+
from mcp_core.app_server import AppServerLifecycle
|
|
235
|
+
|
|
236
|
+
async def run_real():
|
|
237
|
+
async with AppServerLifecycle("notable-96-mcp", cfg) as running:
|
|
238
|
+
adapter = Notable96Adapter(
|
|
239
|
+
base_url=f"http://{running.host}:{running.port}",
|
|
240
|
+
api_key=cfg.api_key,
|
|
241
|
+
)
|
|
242
|
+
app = create_app(adapter)
|
|
243
|
+
async with stdio_server() as (read_stream, write_stream):
|
|
244
|
+
await app.run(read_stream, write_stream, app.create_initialization_options())
|
|
245
|
+
|
|
246
|
+
asyncio.run(run_real())
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
|
|
3
|
+
from mcp_core.simulator.base import BaseSimulator
|
|
4
|
+
from mcp_core.protocol.schema import ProtocolStep
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Notable96Simulator(BaseSimulator):
|
|
8
|
+
"""NOTABLE 96ch device-specific simulator."""
|
|
9
|
+
|
|
10
|
+
def __init__(self):
|
|
11
|
+
super().__init__()
|
|
12
|
+
self._teaching: dict[int, dict] = {}
|
|
13
|
+
|
|
14
|
+
async def move_z_up(self) -> dict:
|
|
15
|
+
await asyncio.sleep(0.05)
|
|
16
|
+
return {"status": "ok", "message": "[SIM] Z axis raised to safe position"}
|
|
17
|
+
|
|
18
|
+
async def control_interlock(self, action: str) -> dict:
|
|
19
|
+
return {"status": "ok", "message": f"[SIM] Interlock {action}d"}
|
|
20
|
+
|
|
21
|
+
async def get_deck_status(self) -> dict:
|
|
22
|
+
return {"status": "ok", "gripper": "open", "deck": "ready"}
|
|
23
|
+
|
|
24
|
+
async def get_teaching_slots(self) -> dict:
|
|
25
|
+
items = list(self._teaching.values())
|
|
26
|
+
return {"items": items, "totalItems": len(items)}
|
|
27
|
+
|
|
28
|
+
async def get_teaching_slot(self, slot_id: int) -> dict:
|
|
29
|
+
if slot_id not in self._teaching:
|
|
30
|
+
raise ValueError(f"Slot {slot_id} not found")
|
|
31
|
+
return self._teaching[slot_id]
|
|
32
|
+
|
|
33
|
+
async def save_teaching_slot(
|
|
34
|
+
self,
|
|
35
|
+
slot_id: int,
|
|
36
|
+
origin_x: float,
|
|
37
|
+
origin_y: float,
|
|
38
|
+
origin_z: float,
|
|
39
|
+
labware_type: str | None = None,
|
|
40
|
+
) -> dict:
|
|
41
|
+
record = {
|
|
42
|
+
"slotId": slot_id,
|
|
43
|
+
"originX": origin_x,
|
|
44
|
+
"originY": origin_y,
|
|
45
|
+
"originZ": origin_z,
|
|
46
|
+
"labwareType": labware_type,
|
|
47
|
+
}
|
|
48
|
+
self._teaching[slot_id] = record
|
|
49
|
+
return record
|
|
50
|
+
|
|
51
|
+
async def gripper(self, action: str) -> dict:
|
|
52
|
+
"""Simulate gripper open/close."""
|
|
53
|
+
return {"status": "ok", "message": f"[SIM] Gripper {action}"}
|
|
54
|
+
|
|
55
|
+
async def aspirate(self, volume_ul: float) -> dict:
|
|
56
|
+
await asyncio.sleep(0.05)
|
|
57
|
+
return {"status": "ok", "message": f"[SIM] 96ch aspirated {volume_ul}uL"}
|
|
58
|
+
|
|
59
|
+
async def dispense(self, volume_ul: float) -> dict:
|
|
60
|
+
await asyncio.sleep(0.05)
|
|
61
|
+
return {"status": "ok", "message": f"[SIM] 96ch dispensed {volume_ul}uL"}
|
|
62
|
+
|
|
63
|
+
async def simulate_step(self, step: ProtocolStep) -> str:
|
|
64
|
+
"""Dispatch one protocol step for NOTABLE 96ch."""
|
|
65
|
+
kind = step.step_type
|
|
66
|
+
params = step.params or {}
|
|
67
|
+
try:
|
|
68
|
+
if kind == "aspirate":
|
|
69
|
+
volume = params.get("volume", params.get("volume_ul", 0))
|
|
70
|
+
well = params.get("well", params.get("location", ""))
|
|
71
|
+
await self.aspirate(float(volume))
|
|
72
|
+
return f"aspirate {volume}uL at {well}".strip()
|
|
73
|
+
if kind == "dispense":
|
|
74
|
+
volume = params.get("volume", params.get("volume_ul", 0))
|
|
75
|
+
well = params.get("well", params.get("location", ""))
|
|
76
|
+
await self.dispense(float(volume))
|
|
77
|
+
return f"dispense {volume}uL at {well}".strip()
|
|
78
|
+
if kind == "pick_up_tip":
|
|
79
|
+
return "pick_up_tip (96ch)"
|
|
80
|
+
if kind == "drop_tip":
|
|
81
|
+
return "drop_tip (96ch)"
|
|
82
|
+
if kind == "move_z_up":
|
|
83
|
+
await self.move_z_up()
|
|
84
|
+
return "move_z_up"
|
|
85
|
+
if kind == "control_interlock":
|
|
86
|
+
action = str(params.get("action", "lock"))
|
|
87
|
+
await self.control_interlock(action)
|
|
88
|
+
return f"control_interlock {action}"
|
|
89
|
+
if kind == "gripper":
|
|
90
|
+
action = str(params.get("action", "open"))
|
|
91
|
+
await self.gripper(action)
|
|
92
|
+
return f"gripper {action}"
|
|
93
|
+
except Exception as exc: # noqa: BLE001
|
|
94
|
+
return f"{kind} FAIL: {exc}"
|
|
95
|
+
return await super().simulate_step(step)
|
|
File without changes
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from mcp_core.adapters.base import AppServerAdapter
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
async def handle_compile_protocol(adapter: AppServerAdapter, protocol_id: str) -> str:
|
|
5
|
+
try:
|
|
6
|
+
result = await adapter.compile_protocol(protocol_id)
|
|
7
|
+
return f"Protocol '{protocol_id}' compiled. Plan ID: {result.plan_id}. Steps: {len(result.steps)}."
|
|
8
|
+
except Exception as e:
|
|
9
|
+
return f"Error compiling protocol {protocol_id}: {e}"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
async def handle_reset_robot(adapter: AppServerAdapter) -> str:
|
|
13
|
+
try:
|
|
14
|
+
result = await adapter.reset_robot()
|
|
15
|
+
return f"Robot reset. Status: {result.status}."
|
|
16
|
+
except Exception as e:
|
|
17
|
+
return f"Error resetting robot: {e}"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
async def handle_start_run(adapter: AppServerAdapter, run_id: str) -> str:
|
|
21
|
+
try:
|
|
22
|
+
result = await adapter.start_run(run_id)
|
|
23
|
+
return f"Run {result.run_id} started. Status: {result.status}."
|
|
24
|
+
except Exception as e:
|
|
25
|
+
return f"Error starting run {run_id}: {e}"
|
|
26
|
+
|
|
27
|
+
async def handle_stop_run(adapter: AppServerAdapter, run_id: str) -> str:
|
|
28
|
+
try:
|
|
29
|
+
result = await adapter.stop_run(run_id)
|
|
30
|
+
return f"Run {result.run_id} stopped. Status: {result.status}."
|
|
31
|
+
except Exception as e:
|
|
32
|
+
return f"Error stopping run {run_id}: {e}"
|
|
33
|
+
|
|
34
|
+
async def handle_pause_run(adapter: AppServerAdapter, run_id: str) -> str:
|
|
35
|
+
try:
|
|
36
|
+
result = await adapter.pause_run(run_id)
|
|
37
|
+
return f"Run {result.run_id} paused. Status: {result.status}."
|
|
38
|
+
except Exception as e:
|
|
39
|
+
return f"Error pausing run {run_id}: {e}"
|
|
40
|
+
|
|
41
|
+
async def handle_resume_run(adapter: AppServerAdapter, run_id: str) -> str:
|
|
42
|
+
try:
|
|
43
|
+
result = await adapter.resume_run(run_id)
|
|
44
|
+
return f"Run {result.run_id} resumed. Status: {result.status}."
|
|
45
|
+
except Exception as e:
|
|
46
|
+
return f"Error resuming run {run_id}: {e}"
|
|
47
|
+
|
|
48
|
+
async def handle_emergency_stop(adapter: AppServerAdapter) -> str:
|
|
49
|
+
try:
|
|
50
|
+
result = await adapter.emergency_stop()
|
|
51
|
+
return f"Emergency stop executed. Status: {result.status}."
|
|
52
|
+
except Exception as e:
|
|
53
|
+
return f"CRITICAL: Emergency stop failed — {e}"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
async def handle_move_z_up(adapter) -> str:
|
|
2
|
+
try:
|
|
3
|
+
await adapter.move_z_up()
|
|
4
|
+
return "Z axis raised to safe position."
|
|
5
|
+
except Exception as e:
|
|
6
|
+
return f"CRITICAL: move_z_up failed — {e}"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
async def handle_control_interlock(adapter, action: str) -> str:
|
|
10
|
+
try:
|
|
11
|
+
await adapter.control_interlock(action)
|
|
12
|
+
return f"Door interlock {action}."
|
|
13
|
+
except Exception as e:
|
|
14
|
+
return f"Error controlling interlock: {e}"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
async def handle_get_deck_status(adapter) -> str:
|
|
18
|
+
try:
|
|
19
|
+
data = await adapter.get_deck_status()
|
|
20
|
+
return f"Deck status: {data}"
|
|
21
|
+
except Exception as e:
|
|
22
|
+
return f"Error getting deck status: {e}"
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""MCP tool handlers for the protocol lifecycle (NOTABLE 96ch)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from mcp_core.protocol import ProtocolRegistry
|
|
8
|
+
from mcp_core.protocol.handlers import (
|
|
9
|
+
handle_add_step as _handle_add_step,
|
|
10
|
+
handle_create_protocol as _handle_create_protocol,
|
|
11
|
+
handle_list_protocols as _handle_list_protocols,
|
|
12
|
+
handle_load_protocol as _handle_load_protocol,
|
|
13
|
+
handle_save_protocol as _handle_save_protocol,
|
|
14
|
+
handle_simulate_protocol as _handle_simulate_protocol,
|
|
15
|
+
handle_validate_protocol as _handle_validate_protocol,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
DEVICE = "notable-96ch"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
async def handle_create_protocol(
|
|
22
|
+
registry: ProtocolRegistry,
|
|
23
|
+
name: str,
|
|
24
|
+
description: str | None = None,
|
|
25
|
+
metadata: dict[str, Any] | None = None,
|
|
26
|
+
) -> str:
|
|
27
|
+
return await _handle_create_protocol(
|
|
28
|
+
registry, DEVICE, name, description, metadata
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
async def handle_add_step(
|
|
33
|
+
registry: ProtocolRegistry,
|
|
34
|
+
protocol_id: str,
|
|
35
|
+
step_type: str,
|
|
36
|
+
params: dict[str, Any] | None = None,
|
|
37
|
+
comment: str | None = None,
|
|
38
|
+
) -> str:
|
|
39
|
+
return await _handle_add_step(
|
|
40
|
+
registry, protocol_id, step_type, params, comment
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
async def handle_save_protocol(
|
|
45
|
+
registry: ProtocolRegistry,
|
|
46
|
+
protocol_id: str,
|
|
47
|
+
path: str | None = None,
|
|
48
|
+
) -> str:
|
|
49
|
+
return await _handle_save_protocol(registry, protocol_id, path)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
async def handle_load_protocol(
|
|
53
|
+
registry: ProtocolRegistry, path: str
|
|
54
|
+
) -> str:
|
|
55
|
+
return await _handle_load_protocol(registry, path)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
async def handle_list_protocols(directory: str | None = None) -> str:
|
|
59
|
+
return await _handle_list_protocols(directory)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
async def handle_validate_protocol(
|
|
63
|
+
registry: ProtocolRegistry, protocol_id_or_path: str
|
|
64
|
+
) -> str:
|
|
65
|
+
return await _handle_validate_protocol(registry, protocol_id_or_path)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
async def handle_simulate_protocol(
|
|
69
|
+
registry: ProtocolRegistry,
|
|
70
|
+
simulator: Any,
|
|
71
|
+
protocol_id_or_path: str,
|
|
72
|
+
) -> str:
|
|
73
|
+
return await _handle_simulate_protocol(
|
|
74
|
+
registry, simulator, protocol_id_or_path
|
|
75
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from mcp_core.adapters.base import AppServerAdapter
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
async def handle_get_robot_status(adapter: AppServerAdapter) -> str:
|
|
5
|
+
try:
|
|
6
|
+
result = await adapter.get_robot_status()
|
|
7
|
+
return f"Robot status: {result.status.value}. {result.message}"
|
|
8
|
+
except Exception as e:
|
|
9
|
+
return f"Error getting robot status: {e}"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
async def handle_get_run_status(adapter: AppServerAdapter, run_id: str) -> str:
|
|
13
|
+
try:
|
|
14
|
+
result = await adapter.get_run_status(run_id)
|
|
15
|
+
return f"Run {result.run_id} status: {result.status}. {result.message}"
|
|
16
|
+
except Exception as e:
|
|
17
|
+
return f"Error getting run status for {run_id}: {e}"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
async def handle_get_teaching_slots(adapter) -> str:
|
|
2
|
+
try:
|
|
3
|
+
data = await adapter.get_teaching_slots()
|
|
4
|
+
items = data.get("items", data) if isinstance(data, dict) else data
|
|
5
|
+
return f"Teaching slots: {items}"
|
|
6
|
+
except Exception as e:
|
|
7
|
+
return f"Error getting teaching slots: {e}"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
async def handle_get_teaching_slot(adapter, slot_id: int) -> str:
|
|
11
|
+
try:
|
|
12
|
+
data = await adapter.get_teaching_slot(slot_id)
|
|
13
|
+
return f"Slot {slot_id}: {data}"
|
|
14
|
+
except Exception as e:
|
|
15
|
+
return f"Error getting teaching slot {slot_id}: {e}"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
async def handle_save_teaching_slot(
|
|
19
|
+
adapter,
|
|
20
|
+
slot_id: int,
|
|
21
|
+
origin_x: float,
|
|
22
|
+
origin_y: float,
|
|
23
|
+
origin_z: float,
|
|
24
|
+
labware_type: str | None = None,
|
|
25
|
+
) -> str:
|
|
26
|
+
try:
|
|
27
|
+
data = await adapter.save_teaching_slot(slot_id, origin_x, origin_y, origin_z, labware_type)
|
|
28
|
+
return f"Slot {slot_id} saved. {data}"
|
|
29
|
+
except Exception as e:
|
|
30
|
+
return f"Error saving teaching slot {slot_id}: {e}"
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"""Protocol-lifecycle tool tests for NOTABLE 96ch."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import re
|
|
5
|
+
|
|
6
|
+
from mcp import types
|
|
7
|
+
|
|
8
|
+
from notable_96_mcp.server import create_app, _REGISTRY
|
|
9
|
+
from notable_96_mcp.simulator import Notable96Simulator
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
async def _call(app, name: str, arguments: dict | None = None) -> str:
|
|
13
|
+
handler = app.request_handlers[types.CallToolRequest]
|
|
14
|
+
req = types.CallToolRequest(
|
|
15
|
+
method="tools/call",
|
|
16
|
+
params=types.CallToolRequestParams(
|
|
17
|
+
name=name, arguments=arguments or {}
|
|
18
|
+
),
|
|
19
|
+
)
|
|
20
|
+
result = await handler(req)
|
|
21
|
+
return result.root.content[0].text
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _pid(text: str) -> str:
|
|
25
|
+
match = re.search(r"protocol_id=([a-f0-9]+)", text)
|
|
26
|
+
assert match
|
|
27
|
+
return match.group(1)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
async def test_create_protocol_device_is_96ch():
|
|
31
|
+
app = create_app(Notable96Simulator())
|
|
32
|
+
text = await _call(app, "create_protocol", {"name": "demo96"})
|
|
33
|
+
assert "notable-96ch" in text
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
async def test_add_extension_step_gripper_ok():
|
|
37
|
+
app = create_app(Notable96Simulator())
|
|
38
|
+
created = await _call(app, "create_protocol", {"name": "ext"})
|
|
39
|
+
pid = _pid(created)
|
|
40
|
+
out = await _call(
|
|
41
|
+
app,
|
|
42
|
+
"add_step",
|
|
43
|
+
{"protocol_id": pid, "step_type": "gripper", "params": {"action": "open"}},
|
|
44
|
+
)
|
|
45
|
+
assert "step_count=1" in out
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
async def test_add_unsupported_step_rejected():
|
|
49
|
+
app = create_app(Notable96Simulator())
|
|
50
|
+
created = await _call(app, "create_protocol", {"name": "rej"})
|
|
51
|
+
pid = _pid(created)
|
|
52
|
+
out = await _call(
|
|
53
|
+
app,
|
|
54
|
+
"add_step",
|
|
55
|
+
{"protocol_id": pid, "step_type": "run_thermocycler", "params": {}},
|
|
56
|
+
)
|
|
57
|
+
assert "Error" in out
|
|
58
|
+
assert "run_thermocycler" in out
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
async def test_save_default_path(monkeypatch, tmp_path):
|
|
62
|
+
monkeypatch.setenv("HOME", str(tmp_path))
|
|
63
|
+
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
|
64
|
+
app = create_app(Notable96Simulator())
|
|
65
|
+
created = await _call(app, "create_protocol", {"name": "saved96"})
|
|
66
|
+
pid = _pid(created)
|
|
67
|
+
out = await _call(app, "save_protocol", {"protocol_id": pid})
|
|
68
|
+
expected = tmp_path / ".able-mcp" / "protocols" / "saved96.json"
|
|
69
|
+
assert str(expected.resolve()) in out
|
|
70
|
+
assert expected.exists()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
async def test_simulate_protocol():
|
|
74
|
+
app = create_app(Notable96Simulator())
|
|
75
|
+
created = await _call(app, "create_protocol", {"name": "sim96"})
|
|
76
|
+
pid = _pid(created)
|
|
77
|
+
await _call(
|
|
78
|
+
app,
|
|
79
|
+
"add_step",
|
|
80
|
+
{"protocol_id": pid, "step_type": "move_z_up", "params": {}},
|
|
81
|
+
)
|
|
82
|
+
await _call(
|
|
83
|
+
app,
|
|
84
|
+
"add_step",
|
|
85
|
+
{"protocol_id": pid, "step_type": "gripper", "params": {"action": "close"}},
|
|
86
|
+
)
|
|
87
|
+
out = await _call(app, "simulate_protocol", {"protocol_id_or_path": pid})
|
|
88
|
+
lines = out.splitlines()
|
|
89
|
+
assert len(lines) == 2
|
|
90
|
+
assert lines[0].startswith("[step 1] move_z_up")
|
|
91
|
+
assert lines[0].endswith("— OK")
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
async def test_validate_protocol_ok():
|
|
95
|
+
app = create_app(Notable96Simulator())
|
|
96
|
+
created = await _call(app, "create_protocol", {"name": "v96"})
|
|
97
|
+
pid = _pid(created)
|
|
98
|
+
await _call(
|
|
99
|
+
app,
|
|
100
|
+
"add_step",
|
|
101
|
+
{"protocol_id": pid, "step_type": "move_z_up", "params": {}},
|
|
102
|
+
)
|
|
103
|
+
out = await _call(app, "validate_protocol", {"protocol_id_or_path": pid})
|
|
104
|
+
data = json.loads(out)
|
|
105
|
+
assert data["ok"] is True
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from mcp import types
|
|
3
|
+
from mcp_core.simulator.base import BaseSimulator
|
|
4
|
+
from notable_96_mcp.server import create_app
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
async def call(app, name: str, arguments: dict = {}) -> str:
|
|
8
|
+
handler = app.request_handlers[types.CallToolRequest]
|
|
9
|
+
req = types.CallToolRequest(
|
|
10
|
+
method="tools/call",
|
|
11
|
+
params=types.CallToolRequestParams(name=name, arguments=arguments),
|
|
12
|
+
)
|
|
13
|
+
result = await handler(req)
|
|
14
|
+
return result.root.content[0].text
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
async def test_route_get_robot_status():
|
|
18
|
+
app = create_app(BaseSimulator())
|
|
19
|
+
assert "READY" in await call(app, "get_robot_status")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
async def test_route_compile_protocol():
|
|
23
|
+
app = create_app(BaseSimulator())
|
|
24
|
+
assert "proto-96" in await call(app, "compile_protocol", {"protocol_id": "proto-96"})
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
async def test_route_get_run_status():
|
|
28
|
+
sim = BaseSimulator()
|
|
29
|
+
await sim.start_run("run-96")
|
|
30
|
+
app = create_app(sim)
|
|
31
|
+
assert "run-96" in await call(app, "get_run_status", {"run_id": "run-96"})
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
async def test_route_start_stop_run():
|
|
35
|
+
app = create_app(BaseSimulator())
|
|
36
|
+
assert "RUNNING" in await call(app, "start_run", {"run_id": "r1"})
|
|
37
|
+
assert "READY" in await call(app, "stop_run", {"run_id": "r1"})
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
async def test_route_pause_resume():
|
|
41
|
+
sim = BaseSimulator()
|
|
42
|
+
app = create_app(sim)
|
|
43
|
+
await call(app, "start_run", {"run_id": "r2"})
|
|
44
|
+
assert "PAUSED" in await call(app, "pause_run", {"run_id": "r2"})
|
|
45
|
+
assert "RUNNING" in await call(app, "resume_run", {"run_id": "r2"})
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
async def test_route_reset_robot():
|
|
49
|
+
app = create_app(BaseSimulator())
|
|
50
|
+
assert "READY" in await call(app, "reset_robot")
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
async def test_route_emergency_stop():
|
|
54
|
+
app = create_app(BaseSimulator())
|
|
55
|
+
assert "Emergency stop" in await call(app, "emergency_stop")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
async def test_route_move_z_up():
|
|
59
|
+
from unittest.mock import AsyncMock
|
|
60
|
+
sim = AsyncMock()
|
|
61
|
+
sim.move_z_up = AsyncMock(return_value={})
|
|
62
|
+
app = create_app(sim)
|
|
63
|
+
text = await call(app, "move_z_up")
|
|
64
|
+
assert "Z axis" in text
|
|
65
|
+
sim.move_z_up.assert_called_once()
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
async def test_route_control_interlock():
|
|
69
|
+
from unittest.mock import AsyncMock
|
|
70
|
+
sim = AsyncMock()
|
|
71
|
+
sim.control_interlock = AsyncMock(return_value={})
|
|
72
|
+
app = create_app(sim)
|
|
73
|
+
text = await call(app, "control_interlock", {"action": "enable"})
|
|
74
|
+
assert "enable" in text
|
|
75
|
+
sim.control_interlock.assert_called_once_with("enable")
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
async def test_route_get_deck_status():
|
|
79
|
+
from unittest.mock import AsyncMock
|
|
80
|
+
sim = AsyncMock()
|
|
81
|
+
sim.get_deck_status = AsyncMock(return_value={"status": "ok"})
|
|
82
|
+
app = create_app(sim)
|
|
83
|
+
text = await call(app, "get_deck_status")
|
|
84
|
+
assert "Deck status" in text
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
async def test_route_get_teaching_slots():
|
|
88
|
+
from unittest.mock import AsyncMock
|
|
89
|
+
sim = AsyncMock()
|
|
90
|
+
sim.get_teaching_slots = AsyncMock(return_value={"items": [], "totalItems": 0})
|
|
91
|
+
app = create_app(sim)
|
|
92
|
+
text = await call(app, "get_teaching_slots")
|
|
93
|
+
assert "Teaching slots" in text
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
async def test_route_get_teaching_slot():
|
|
97
|
+
from unittest.mock import AsyncMock
|
|
98
|
+
sim = AsyncMock()
|
|
99
|
+
sim.get_teaching_slot = AsyncMock(return_value={"slotId": 5, "originX": 1.0})
|
|
100
|
+
app = create_app(sim)
|
|
101
|
+
text = await call(app, "get_teaching_slot", {"slot_id": 5})
|
|
102
|
+
assert "5" in text
|
|
103
|
+
sim.get_teaching_slot.assert_called_once_with(5)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
async def test_route_save_teaching_slot():
|
|
107
|
+
from unittest.mock import AsyncMock
|
|
108
|
+
sim = AsyncMock()
|
|
109
|
+
sim.save_teaching_slot = AsyncMock(return_value={"slotId": 3})
|
|
110
|
+
app = create_app(sim)
|
|
111
|
+
text = await call(app, "save_teaching_slot", {
|
|
112
|
+
"slot_id": 3, "origin_x": 1.0, "origin_y": 2.0, "origin_z": 3.0
|
|
113
|
+
})
|
|
114
|
+
assert "3" in text
|
|
115
|
+
sim.save_teaching_slot.assert_called_once_with(3, 1.0, 2.0, 3.0, None)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
async def test_route_unknown_tool():
|
|
119
|
+
app = create_app(BaseSimulator())
|
|
120
|
+
assert "Unknown tool" in await call(app, "no_such_tool")
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from mcp_core.simulator.base import BaseSimulator
|
|
3
|
+
from notable_96_mcp.tools.status import handle_get_robot_status, handle_get_run_status
|
|
4
|
+
from notable_96_mcp.tools.control import handle_compile_protocol, handle_reset_robot
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
async def test_get_robot_status_simulate():
|
|
8
|
+
sim = BaseSimulator()
|
|
9
|
+
result = await handle_get_robot_status(sim)
|
|
10
|
+
assert "READY" in result
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
async def test_get_run_status_after_start():
|
|
14
|
+
sim = BaseSimulator()
|
|
15
|
+
await sim.start_run("run-96-001")
|
|
16
|
+
result = await handle_get_run_status(sim, "run-96-001")
|
|
17
|
+
assert "run-96-001" in result
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
async def test_compile_protocol():
|
|
21
|
+
sim = BaseSimulator()
|
|
22
|
+
result = await handle_compile_protocol(sim, "proto-96")
|
|
23
|
+
assert "proto-96" in result
|
|
24
|
+
assert "Plan ID" in result
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
async def test_reset_robot():
|
|
28
|
+
sim = BaseSimulator()
|
|
29
|
+
await sim.start_run("run-96-001")
|
|
30
|
+
result = await handle_reset_robot(sim)
|
|
31
|
+
assert "READY" in result
|