@ohmframe/mcp-server 0.0.0-stage → 0.1.0
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.
- package/CHANGELOG.md +28 -0
- package/LICENSE +190 -0
- package/README.md +171 -2
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +41 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.js +25 -0
- package/dist/feature-set.d.ts +16 -0
- package/dist/feature-set.js +33 -0
- package/dist/portal-client.d.ts +50 -0
- package/dist/portal-client.js +224 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.js +101 -0
- package/dist/tools.d.ts +26 -0
- package/dist/tools.js +199 -0
- package/package.json +79 -4
- package/schemas/examples/bracket.feature-set.json +32 -0
- package/schemas/feature-set.v0.schema.json +332 -0
- package/skills/ohmframe-release-brain/SKILL.md +63 -0
- package/skills/ohmframe-release-brain/examples/bracket.feature-set.json +32 -0
- package/skills/ohmframe-release-brain/examples/dfm-review.md +25 -0
- package/skills/ohmframe-release-brain/manifest.json +18 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@ohmframe/mcp-server` are documented in this file.
|
|
4
|
+
|
|
5
|
+
This project adheres to [Semantic Versioning 2.0.0](https://semver.org/) and uses the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format.
|
|
6
|
+
|
|
7
|
+
## SemVer Policy
|
|
8
|
+
|
|
9
|
+
- **0.x (pre-1.0):** Minor bumps (`0.x.0`) may introduce breaking changes to tool schemas or CLI flags; patch bumps (`0.x.y`) are backwards-compatible fixes and non-breaking additions.
|
|
10
|
+
- **1.0+:** Major bumps (`X.0.0`) for breaking changes to MCP tool names, required arguments, error code vocabulary, or CLI flags; minor bumps (`X.Y.0`) for new tools or optional parameters; patch bumps (`X.Y.Z`) for fixes and documentation updates.
|
|
11
|
+
- **Supported Node.js versions:** Active LTS releases (currently Node `>=20`). Dropping an EOL Node version requires at least a minor bump during `0.x` and a major bump at `1.0+`.
|
|
12
|
+
|
|
13
|
+
## [Unreleased]
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- Scripted end-to-end stdio MCP test suite (`npm run test:e2e` / `scripts/e2e.mjs`) covering tool discovery, `dfm_analyze` with feature-set v0 JSON, local refusal of smuggled raw STEP (0 bytes sent), `cost_estimate`, async jobs with progress notifications, `job_pending` → `job_status` resume, and portal error mappings (`401`, `402`, `403`, `422`, `429`).
|
|
17
|
+
- Packaging and clean-install verification script (`npm run pack:check` / `scripts/pack-check.mjs`) validating `npm pack --dry-run`, LF CLI shebang, TypeScript `.d.ts` declarations, and clean tarball installation.
|
|
18
|
+
- GitHub Actions release workflow (`.github/workflows/publish.yml`) configured for `npm publish --provenance --access public` on `v*.*.*` and `release/*` tags (plus dry-run `workflow_dispatch`).
|
|
19
|
+
- `--help` / `-h` and `-v` flags in `ohmframe-mcp` CLI, dynamic `SERVER_VERSION` loaded from `package.json`, and host setup documentation (`docs/hosts.md`).
|
|
20
|
+
- Apache-2.0 `LICENSE` and public npm package metadata (`exports`, `types`, `repository`, `publishConfig`).
|
|
21
|
+
|
|
22
|
+
## [0.1.0] - 2026-11-21
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- Initial `@ohmframe/mcp-server` stdio MCP server exposing Ohmframe Release Brain tools (`dfm_analyze`, `cost_estimate`, `tolerance_stackup`, `gdt_check`, `standards_lookup`, `material_select`, `fmea_generate`, opt-in `patent_prior_art`, and `job_status`).
|
|
26
|
+
- Local JSON Schema validation for `feature-set.v0` (≤ 256 KB, no raw CAD, unique feature IDs).
|
|
27
|
+
- Asynchronous portal job polling (`Prefer: respond-async`) with MCP progress notifications and cancellation refunds.
|
|
28
|
+
- Hash-pinned Release Brain skill pack (`skills/ohmframe-release-brain/`).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
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 discussing 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" 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 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 file 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, strengths, or service marks of the Licensor, except
|
|
140
|
+
as required for reasonable and customary use in describing the origin
|
|
141
|
+
of the Work and reproducing the copyright notice.
|
|
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 gross
|
|
156
|
+
negligence) 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 other
|
|
162
|
+
commercial damages or losses), even if such Contributor has been
|
|
163
|
+
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 choose to offer,
|
|
167
|
+
and accept support, warranty, indemnity, or other liability
|
|
168
|
+
obligations and/or rights consistent with this License. However,
|
|
169
|
+
in accepting such obligations, You may act only on Your own behalf
|
|
170
|
+
and on Your own sole responsibility, and 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
|
|
173
|
+
claims asserted against, such Contributor by reason of your accepting
|
|
174
|
+
any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Ohmframe
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,172 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@ohmframe/mcp-server`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@ohmframe/mcp-server` is the Ohmframe Model Context Protocol (MCP) server. We built it so AI engineering agents (Claude Code, Cursor, Codex, and other MCP hosts) can call Ohmframe Release Brain tools—DFM analysis, should-cost estimation, tolerance stack-up, GD&T, FMEA, material selection, and standards lookup—backed by [ai.ohmframe.com](https://ai.ohmframe.com).
|
|
4
|
+
|
|
5
|
+
## How it works
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
your CAD file ──► ohmframe-step-features (local, no network) ──► feature JSON
|
|
9
|
+
│
|
|
10
|
+
agent host ──stdio──► ohmframe-mcp ──HTTPS + ohm_ key──► ai.ohmframe.com ──► result + credits
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- **Raw CAD never leaves your machine through this server.** `dfm_analyze` accepts **feature set v0** JSON only and validates it locally against the published JSON Schema (`<= 256 KB`, no unknown fields, unique feature IDs) before any HTTP request is sent.
|
|
14
|
+
- **Server-side enforcement.** The Ohmframe portal enforces key scopes, workspace egress policy (`local_only` / `summaries_only` / `cloud_full`), credit metering, and run receipts on every request.
|
|
15
|
+
|
|
16
|
+
## Prerequisites
|
|
17
|
+
|
|
18
|
+
1. **Node.js 20+** (`node -v`).
|
|
19
|
+
2. **An Ohmframe API key (`ohm_...`)** created in [ai.ohmframe.com/account](https://ai.ohmframe.com/account) (Pro MCP, Team, or Enterprise plan) with the scopes for the tools you want to call.
|
|
20
|
+
3. *(Recommended for DFM)* `ohmframe-step-features` to extract compact feature JSON locally from STEP files without uploading raw CAD.
|
|
21
|
+
|
|
22
|
+
## Quick start (connect your agent)
|
|
23
|
+
|
|
24
|
+
> **Pre-publish note:** Until `@ohmframe/mcp-server` is published to npm, build this repository locally (`npm ci && npm run build`) and replace `npx -y @ohmframe/mcp-server` with `node /path/to/ohmframe-mcp-server/dist/cli.js`.
|
|
25
|
+
|
|
26
|
+
### Claude Code
|
|
27
|
+
|
|
28
|
+
Run in your project directory:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
claude mcp add ohmframe -e OHMFRAME_API_KEY=ohm_YOUR_API_KEY -- npx -y @ohmframe/mcp-server
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Or save to `.mcp.json` in your project root (do not commit live keys):
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"ohmframe": {
|
|
40
|
+
"command": "npx",
|
|
41
|
+
"args": ["-y", "@ohmframe/mcp-server"],
|
|
42
|
+
"env": {
|
|
43
|
+
"OHMFRAME_API_KEY": "ohm_YOUR_API_KEY"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Cursor
|
|
51
|
+
|
|
52
|
+
Add to `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (global), then reload MCP servers in **Settings → Tools & MCP**:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"mcpServers": {
|
|
57
|
+
"ohmframe": {
|
|
58
|
+
"command": "npx",
|
|
59
|
+
"args": ["-y", "@ohmframe/mcp-server"],
|
|
60
|
+
"env": {
|
|
61
|
+
"OHMFRAME_API_KEY": "ohm_YOUR_API_KEY"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Codex
|
|
69
|
+
|
|
70
|
+
Run:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
codex mcp add ohmframe --env OHMFRAME_API_KEY=ohm_YOUR_API_KEY -- npx -y @ohmframe/mcp-server
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Or add to `~/.codex/config.toml`:
|
|
77
|
+
|
|
78
|
+
```toml
|
|
79
|
+
[mcp_servers.ohmframe]
|
|
80
|
+
command = "npx"
|
|
81
|
+
args = ["-y", "@ohmframe/mcp-server"]
|
|
82
|
+
|
|
83
|
+
[mcp_servers.ohmframe.env]
|
|
84
|
+
OHMFRAME_API_KEY = "ohm_YOUR_API_KEY"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### CLI flags
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npx -y @ohmframe/mcp-server --version
|
|
91
|
+
npx -y @ohmframe/mcp-server --help
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
See [docs/hosts.md](docs/hosts.md) for host-specific setup notes, optional `OHMFRAME_PROJECT` tagging, and verification steps.
|
|
95
|
+
|
|
96
|
+
## Tools
|
|
97
|
+
|
|
98
|
+
| Tool | Portal route | Credits | Key scope |
|
|
99
|
+
|---|---|---|---|
|
|
100
|
+
| `dfm_analyze` | `/api/dfm` | 3 | `brain:dfm` |
|
|
101
|
+
| `cost_estimate` | `/api/cost/estimate` | 2 | `brain:cost` |
|
|
102
|
+
| `tolerance_stackup` | `/api/tolerance` | 2 | `brain:tolerance` |
|
|
103
|
+
| `gdt_check` | `/api/gdt` | 2 | `brain:gdt` |
|
|
104
|
+
| `standards_lookup` | `/api/standards` | 1 | `brain:reference` |
|
|
105
|
+
| `material_select` | `/api/material` | 2 | `brain:reference` |
|
|
106
|
+
| `fmea_generate` | `/api/fmea` | 3 | `brain:fmea` |
|
|
107
|
+
| `patent_prior_art` | `/api/patent` | 3 | `brain:patent` (off unless `OHMFRAME_ENABLE_PATENT=1`) |
|
|
108
|
+
| `job_status` | `/api/jobs/:id` | 0 | `jobs:read` |
|
|
109
|
+
|
|
110
|
+
**Long tools** run as portal jobs (`gdt_check`, `standards_lookup`, `material_select`, `fmea_generate`, and `patent_prior_art`):
|
|
111
|
+
|
|
112
|
+
1. The server submits with `Prefer: respond-async`.
|
|
113
|
+
2. It polls the job and emits MCP `notifications/progress` updates when the host requests them.
|
|
114
|
+
3. It returns the finished result without hitting proxy timeouts (`524`).
|
|
115
|
+
|
|
116
|
+
If a job exceeds `OHMFRAME_JOB_TIMEOUT_MS`, the tool returns `job_pending` with `details.jobId`; call `job_status` later at no credit cost. Cancelling an in-flight tool call cancels the job and refunds its credits.
|
|
117
|
+
|
|
118
|
+
Re-checking unchanged input within 30 days is free. Every result includes `requestId` and `creditsRemaining`.
|
|
119
|
+
|
|
120
|
+
### Error codes
|
|
121
|
+
|
|
122
|
+
Failed calls return `isError: true` with a stable `error` code:
|
|
123
|
+
|
|
124
|
+
| Code | Meaning | Agent action |
|
|
125
|
+
|---|---|---|
|
|
126
|
+
| `missing_api_key` | `OHMFRAME_API_KEY` not set | Ask the user to configure an `ohm_` key |
|
|
127
|
+
| `unauthorized` | Key invalid, expired, revoked, or plan without API access | Tell the user; do not retry |
|
|
128
|
+
| `credits_exhausted` | Workspace out of credits (`details.needed`, `details.remaining`) | Stop and tell the user |
|
|
129
|
+
| `insufficient_scope` | Key lacks the tool's scope (`details.required`) | Ask the user for a key with that scope |
|
|
130
|
+
| `egress_policy` | Workspace policy refused the input (`details.mode`, `details.reason`) | Send feature JSON instead; do not retry raw CAD |
|
|
131
|
+
| `invalid_input` | Input failed local or portal validation (`problems`) | Fix the input |
|
|
132
|
+
| `rate_limited` | Too many calls (`retryAfterSeconds`) | Wait and retry once |
|
|
133
|
+
| `tool_unavailable` | Portal does not expose this tool yet | Skip it |
|
|
134
|
+
| `upstream_error`, `network_error` | Temporary portal/network error | Retry later; quote `requestId` if persistent |
|
|
135
|
+
| `job_pending` | Long job still running (`details.jobId`) | Call `job_status` later |
|
|
136
|
+
| `job_cancelled` | Job cancelled and refunded | Resubmit if still needed |
|
|
137
|
+
|
|
138
|
+
## Skill pack
|
|
139
|
+
|
|
140
|
+
`skills/ohmframe-release-brain/` ships the Release Brain skill (`SKILL.md` and examples). Copy the folder into your host's skills directory (for example `~/.claude/skills/` for Claude Code). `manifest.json` pins every file by SHA-256 and `npm run check:skills` verifies integrity in CI. After editing any skill file, regenerate the manifest with `node scripts/skill-manifest.mjs --write`.
|
|
141
|
+
|
|
142
|
+
## Configuration
|
|
143
|
+
|
|
144
|
+
| Variable | Default | Purpose |
|
|
145
|
+
|---|---|---|
|
|
146
|
+
| `OHMFRAME_API_KEY` | none | `ohm_` API key (Pro MCP, Team, or Enterprise plan) |
|
|
147
|
+
| `OHMFRAME_BASE_URL` | `https://ai.ohmframe.com` | Portal origin; must use `https://` except `localhost` / `127.0.0.1` |
|
|
148
|
+
| `OHMFRAME_EGRESS` | workspace setting | `summaries_only` or `local_only` to tighten egress for this machine |
|
|
149
|
+
| `OHMFRAME_PROJECT` | none | Project tag recorded on Ohmframe run receipts |
|
|
150
|
+
| `OHMFRAME_ENABLE_PATENT` | off | `1` registers `patent_prior_art` |
|
|
151
|
+
| `OHMFRAME_TIMEOUT_MS` | `120000` | Per-request HTTP timeout in milliseconds |
|
|
152
|
+
| `OHMFRAME_JOB_TIMEOUT_MS` | `600000` | Async job polling limit before returning `job_pending` |
|
|
153
|
+
|
|
154
|
+
## Versioning & Releases
|
|
155
|
+
|
|
156
|
+
We follow [Semantic Versioning 2.0.0](https://semver.org/) and maintain [CHANGELOG.md](CHANGELOG.md).
|
|
157
|
+
|
|
158
|
+
- **Git Flow:** `feature/*` → `develop`; `release/*` → `main` with a matching tag (`vX.Y.Z` or `release/X.Y.Z`).
|
|
159
|
+
- **Publishing:** `.github/workflows/publish.yml` verifies lint, typecheck, unit tests, build, skill manifest pins, license policy, dependency audit, stdio E2E, and tarball install before running `npm publish --provenance --access public` via GitHub OIDC (`id-token: write`).
|
|
160
|
+
|
|
161
|
+
## Development
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
npm ci
|
|
165
|
+
npm run lint && npm run typecheck && npm test
|
|
166
|
+
npm run build && npm run check:skills && npm run check:licenses
|
|
167
|
+
npm run test:e2e && npm run pack:check
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
- Node 20 and 22 are tested in CI.
|
|
171
|
+
- `schemas/feature-set.v0.schema.json` mirrors the portal's generated schema (`https://ai.ohmframe.com/api/schemas/feature-set.v0.json`).
|
|
172
|
+
- Licensed under [Apache-2.0](LICENSE). Shipped dependencies are gated by `npm run check:licenses` to permissive licenses only.
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { loadConfig } from "./config.js";
|
|
4
|
+
import { createServer, SERVER_VERSION } from "./server.js";
|
|
5
|
+
const HELP_TEXT = `ohmframe-mcp v${SERVER_VERSION} — Ohmframe MCP server (stdio)
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
npx -y @ohmframe/mcp-server
|
|
9
|
+
ohmframe-mcp [--version | --help]
|
|
10
|
+
|
|
11
|
+
Environment variables:
|
|
12
|
+
OHMFRAME_API_KEY ohm_ API key from https://ai.ohmframe.com/account
|
|
13
|
+
OHMFRAME_BASE_URL Portal origin (default: https://ai.ohmframe.com)
|
|
14
|
+
OHMFRAME_EGRESS Optional egress cap: summaries_only | local_only
|
|
15
|
+
OHMFRAME_PROJECT Optional project tag recorded on portal receipts
|
|
16
|
+
OHMFRAME_ENABLE_PATENT Set to 1 to register patent_prior_art
|
|
17
|
+
OHMFRAME_TIMEOUT_MS Per-request HTTP timeout in ms (default: 120000)
|
|
18
|
+
OHMFRAME_JOB_TIMEOUT_MS Async job polling timeout in ms (default: 600000)
|
|
19
|
+
|
|
20
|
+
Docs: https://github.com/itachimoonshot/ohmframe-mcp-server#readme`;
|
|
21
|
+
async function main() {
|
|
22
|
+
const args = process.argv.slice(2);
|
|
23
|
+
if (args.includes("--version") || args.includes("-v")) {
|
|
24
|
+
console.log(SERVER_VERSION);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
28
|
+
console.log(HELP_TEXT);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const config = loadConfig();
|
|
32
|
+
// stdout carries the protocol; diagnostics go to stderr only, and never the key
|
|
33
|
+
if (!config.apiKey)
|
|
34
|
+
console.error("ohmframe-mcp: OHMFRAME_API_KEY is not set; tools will return missing_api_key.");
|
|
35
|
+
const server = createServer(config);
|
|
36
|
+
await server.connect(new StdioServerTransport());
|
|
37
|
+
}
|
|
38
|
+
main().catch((err) => {
|
|
39
|
+
console.error(`ohmframe-mcp: ${err instanceof Error ? err.message : String(err)}`);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
});
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Runtime settings, read from environment variables (see README). */
|
|
2
|
+
export interface Config {
|
|
3
|
+
/** `ohm_` key from the Ohmframe portal. Missing = every tool returns an auth error. */
|
|
4
|
+
apiKey: string | undefined;
|
|
5
|
+
/** Portal origin, no trailing slash. */
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
/** Optional egress mode sent as X-Ohmframe-Egress. The portal only lets it tighten. */
|
|
8
|
+
egress: "cloud_full" | "summaries_only" | "local_only" | undefined;
|
|
9
|
+
/** Optional project reference sent as X-Ohmframe-Project (appears on receipts). */
|
|
10
|
+
project: string | undefined;
|
|
11
|
+
/** Register patent_prior_art (needs the brain:patent key scope, off by default). */
|
|
12
|
+
enablePatent: boolean;
|
|
13
|
+
/** Per-request timeout in milliseconds. */
|
|
14
|
+
timeoutMs: number;
|
|
15
|
+
/** How long a tool call waits for an async job before returning job_pending. */
|
|
16
|
+
jobTimeoutMs: number;
|
|
17
|
+
}
|
|
18
|
+
export declare const DEFAULT_BASE_URL = "https://ai.ohmframe.com";
|
|
19
|
+
export declare function loadConfig(env?: NodeJS.ProcessEnv): Config;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const DEFAULT_BASE_URL = "https://ai.ohmframe.com";
|
|
2
|
+
const EGRESS = new Set(["cloud_full", "summaries_only", "local_only"]);
|
|
3
|
+
export function loadConfig(env = process.env) {
|
|
4
|
+
const baseUrl = (env.OHMFRAME_BASE_URL?.trim() || DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
5
|
+
const url = new URL(baseUrl);
|
|
6
|
+
const local = url.hostname === "localhost" || url.hostname === "127.0.0.1";
|
|
7
|
+
if (url.protocol !== "https:" && !local) {
|
|
8
|
+
throw new Error(`OHMFRAME_BASE_URL must use https (got ${url.protocol}//${url.host})`);
|
|
9
|
+
}
|
|
10
|
+
const egress = env.OHMFRAME_EGRESS?.trim();
|
|
11
|
+
if (egress && !EGRESS.has(egress)) {
|
|
12
|
+
throw new Error(`OHMFRAME_EGRESS must be one of cloud_full, summaries_only, local_only`);
|
|
13
|
+
}
|
|
14
|
+
const timeout = Number(env.OHMFRAME_TIMEOUT_MS ?? 120_000);
|
|
15
|
+
const jobTimeout = Number(env.OHMFRAME_JOB_TIMEOUT_MS ?? 600_000);
|
|
16
|
+
return {
|
|
17
|
+
apiKey: env.OHMFRAME_API_KEY?.trim() || undefined,
|
|
18
|
+
baseUrl,
|
|
19
|
+
egress: (egress || undefined),
|
|
20
|
+
project: env.OHMFRAME_PROJECT?.trim() || undefined,
|
|
21
|
+
enablePatent: env.OHMFRAME_ENABLE_PATENT === "1",
|
|
22
|
+
timeoutMs: Number.isFinite(timeout) && timeout > 0 ? timeout : 120_000,
|
|
23
|
+
jobTimeoutMs: Number.isFinite(jobTimeout) && jobTimeout > 0 ? jobTimeout : 600_000,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local validation of feature set v0 (R-5) before anything leaves the machine.
|
|
3
|
+
* The schema file is a copy of the portal's published
|
|
4
|
+
* https://ai.ohmframe.com/api/schemas/feature-set.v0.json; the portal
|
|
5
|
+
* validates again on receipt.
|
|
6
|
+
*/
|
|
7
|
+
export declare const FEATURE_SET_SCHEMA_ID = "https://ai.ohmframe.com/api/schemas/feature-set.v0.json";
|
|
8
|
+
export declare const FEATURE_SET_MAX_BYTES: number;
|
|
9
|
+
export type FeatureSetCheck = {
|
|
10
|
+
ok: true;
|
|
11
|
+
} | {
|
|
12
|
+
ok: false;
|
|
13
|
+
errors: string[];
|
|
14
|
+
};
|
|
15
|
+
export declare function checkFeatureSet(value: unknown): FeatureSetCheck;
|
|
16
|
+
export declare const schemaId: unknown;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { Ajv2020 } from "ajv/dist/2020.js";
|
|
3
|
+
/**
|
|
4
|
+
* Local validation of feature set v0 (R-5) before anything leaves the machine.
|
|
5
|
+
* The schema file is a copy of the portal's published
|
|
6
|
+
* https://ai.ohmframe.com/api/schemas/feature-set.v0.json; the portal
|
|
7
|
+
* validates again on receipt.
|
|
8
|
+
*/
|
|
9
|
+
export const FEATURE_SET_SCHEMA_ID = "https://ai.ohmframe.com/api/schemas/feature-set.v0.json";
|
|
10
|
+
export const FEATURE_SET_MAX_BYTES = 256 * 1024;
|
|
11
|
+
const schema = JSON.parse(readFileSync(new URL("../schemas/feature-set.v0.schema.json", import.meta.url), "utf8"));
|
|
12
|
+
// Formats are expressed as patterns in the generated schema
|
|
13
|
+
const ajv = new Ajv2020({ allErrors: true, strict: false, validateFormats: false });
|
|
14
|
+
const validate = ajv.compile(schema);
|
|
15
|
+
export function checkFeatureSet(value) {
|
|
16
|
+
const bytes = Buffer.byteLength(JSON.stringify(value ?? null), "utf8");
|
|
17
|
+
if (bytes > FEATURE_SET_MAX_BYTES) {
|
|
18
|
+
return { ok: false, errors: [`feature set is ${bytes} bytes; the limit is ${FEATURE_SET_MAX_BYTES}`] };
|
|
19
|
+
}
|
|
20
|
+
if (!validate(value)) {
|
|
21
|
+
const errors = (validate.errors ?? [])
|
|
22
|
+
.slice(0, 20)
|
|
23
|
+
.map((e) => `${e.instancePath || "/"} ${e.message ?? "is invalid"}`);
|
|
24
|
+
return { ok: false, errors };
|
|
25
|
+
}
|
|
26
|
+
// Uniqueness is a refinement in the portal's Zod schema, not expressible in JSON Schema
|
|
27
|
+
const ids = value.features.map((f) => f.id);
|
|
28
|
+
const dup = ids.find((id, i) => ids.indexOf(id) !== i);
|
|
29
|
+
if (dup)
|
|
30
|
+
return { ok: false, errors: [`/features duplicate feature id "${dup}"`] };
|
|
31
|
+
return { ok: true };
|
|
32
|
+
}
|
|
33
|
+
export const schemaId = schema.$id;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Config } from "./config.js";
|
|
2
|
+
/**
|
|
3
|
+
* Error codes an agent can act on. Each maps from a portal status so the
|
|
4
|
+
* agent sees one stable vocabulary whatever the HTTP detail.
|
|
5
|
+
*/
|
|
6
|
+
export type PortalErrorCode = "missing_api_key" | "unauthorized" | "credits_exhausted" | "insufficient_scope" | "tool_unavailable" | "egress_policy" | "invalid_input" | "rate_limited" | "upstream_error" | "network_error" | "job_pending" | "job_cancelled";
|
|
7
|
+
export type PortalResult = {
|
|
8
|
+
ok: true;
|
|
9
|
+
status: number;
|
|
10
|
+
data: unknown;
|
|
11
|
+
requestId: string | null;
|
|
12
|
+
creditsRemaining: number | null;
|
|
13
|
+
} | {
|
|
14
|
+
ok: false;
|
|
15
|
+
status: number | null;
|
|
16
|
+
error: PortalErrorCode;
|
|
17
|
+
message: string;
|
|
18
|
+
requestId: string | null;
|
|
19
|
+
creditsRemaining: number | null;
|
|
20
|
+
retryAfterSeconds?: number;
|
|
21
|
+
/** Extra fields from the portal body that help the agent (needed, mode, reason, required...). */
|
|
22
|
+
details?: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
export type FetchLike = (input: string, init: RequestInit) => Promise<Response>;
|
|
25
|
+
/** POST JSON to a portal route with the configured key and headers. Never throws. */
|
|
26
|
+
export declare function callPortal(config: Config, path: string, body: unknown, fetchImpl?: FetchLike): Promise<PortalResult>;
|
|
27
|
+
/** One HTTP call to the portal, mapped to a PortalResult. Never throws. */
|
|
28
|
+
export declare function send(config: Config, method: "GET" | "POST" | "DELETE", path: string, body: unknown, fetchImpl?: FetchLike, extraHeaders?: Record<string, string>): Promise<PortalResult>;
|
|
29
|
+
export type JobProgress = (state: string, polls: number) => void | Promise<void>;
|
|
30
|
+
interface JobView {
|
|
31
|
+
jobId: string;
|
|
32
|
+
state: string;
|
|
33
|
+
result?: unknown;
|
|
34
|
+
error?: unknown;
|
|
35
|
+
resultStatus?: number;
|
|
36
|
+
statusUrl?: string;
|
|
37
|
+
pollIntervalMs?: number;
|
|
38
|
+
}
|
|
39
|
+
/** Turn a finished job view into the same result shape as a synchronous call. */
|
|
40
|
+
export declare function jobOutcome(job: JobView, requestId: string | null, creditsRemaining: number | null): PortalResult | null;
|
|
41
|
+
/**
|
|
42
|
+
* Submit with `Prefer: respond-async` and wait for the job, reporting progress.
|
|
43
|
+
* A synchronous answer (older portal, or route without async) passes through.
|
|
44
|
+
* If the caller aborts, the job is cancelled so its credits are refunded.
|
|
45
|
+
*/
|
|
46
|
+
export declare function callPortalAsync(config: Config, path: string, body: unknown, fetchImpl?: FetchLike, opts?: {
|
|
47
|
+
onProgress?: JobProgress;
|
|
48
|
+
signal?: AbortSignal;
|
|
49
|
+
}): Promise<PortalResult>;
|
|
50
|
+
export {};
|