@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.
@@ -0,0 +1,224 @@
1
+ const PASSTHROUGH = ["needed", "remaining", "mode", "reason", "field", "required", "current", "limit"];
2
+ function numberHeader(res, name) {
3
+ const v = res.headers.get(name);
4
+ if (v === null)
5
+ return null;
6
+ const n = Number(v);
7
+ return Number.isFinite(n) ? n : null;
8
+ }
9
+ function errorCodeFor(status, body) {
10
+ if (status === 401)
11
+ return "unauthorized";
12
+ if (status === 402)
13
+ return "credits_exhausted";
14
+ if (status === 403)
15
+ return "insufficient_scope";
16
+ if (status === 404 || status === 405)
17
+ return "tool_unavailable";
18
+ if (status === 422 && body.error === "egress_policy")
19
+ return "egress_policy";
20
+ if (status === 429)
21
+ return "rate_limited";
22
+ if (status >= 500)
23
+ return "upstream_error";
24
+ return "invalid_input";
25
+ }
26
+ const HINTS = {
27
+ missing_api_key: "Set OHMFRAME_API_KEY to an ohm_ key from https://ai.ohmframe.com/account (Pro MCP, Team or Enterprise plan).",
28
+ unauthorized: "The ohm_ key was rejected (invalid, expired, revoked, or the plan has no API access). Create or rotate a key in the portal.",
29
+ credits_exhausted: "The workspace is out of credits. A workspace owner can add credits, or wait for next month's allowance.",
30
+ insufficient_scope: "The ohm_ key lacks the scope for this tool. Create a key with the needed scope.",
31
+ tool_unavailable: "This Ohmframe portal does not offer this tool yet.",
32
+ egress_policy: "The workspace egress policy refused this input. Send extracted feature JSON or numbers, not raw CAD, meshes, PDFs or images.",
33
+ rate_limited: "Too many calls. Wait for retryAfterSeconds, then retry once.",
34
+ upstream_error: "Ohmframe had a temporary problem. Retry later; quote requestId if it persists.",
35
+ network_error: "Could not reach the Ohmframe portal. Check the network and OHMFRAME_BASE_URL.",
36
+ job_pending: "The job is still running. Call job_status with details.jobId later; credits are already reserved.",
37
+ job_cancelled: "The job was cancelled; its credits were refunded.",
38
+ };
39
+ /** POST JSON to a portal route with the configured key and headers. Never throws. */
40
+ export function callPortal(config, path, body, fetchImpl = fetch) {
41
+ return send(config, "POST", path, body, fetchImpl);
42
+ }
43
+ /** One HTTP call to the portal, mapped to a PortalResult. Never throws. */
44
+ export async function send(config, method, path, body, fetchImpl = fetch, extraHeaders = {}) {
45
+ if (!config.apiKey) {
46
+ return {
47
+ ok: false,
48
+ status: null,
49
+ error: "missing_api_key",
50
+ message: HINTS.missing_api_key,
51
+ requestId: null,
52
+ creditsRemaining: null,
53
+ };
54
+ }
55
+ const headers = {
56
+ "Content-Type": "application/json",
57
+ Accept: "application/json",
58
+ Authorization: `Bearer ${config.apiKey}`,
59
+ "User-Agent": "ohmframe-mcp-server",
60
+ };
61
+ if (config.egress)
62
+ headers["X-Ohmframe-Egress"] = config.egress;
63
+ if (config.project)
64
+ headers["X-Ohmframe-Project"] = config.project;
65
+ Object.assign(headers, extraHeaders);
66
+ if (method !== "POST")
67
+ delete headers["Content-Type"];
68
+ let res;
69
+ try {
70
+ res = await fetchImpl(`${config.baseUrl}${path}`, {
71
+ method,
72
+ headers,
73
+ ...(method === "POST" && { body: JSON.stringify(body) }),
74
+ signal: AbortSignal.timeout(config.timeoutMs),
75
+ });
76
+ }
77
+ catch (err) {
78
+ const timedOut = err instanceof Error && (err.name === "TimeoutError" || err.name === "AbortError");
79
+ return {
80
+ ok: false,
81
+ status: null,
82
+ error: "network_error",
83
+ message: timedOut ? `The portal did not answer within ${config.timeoutMs} ms.` : HINTS.network_error,
84
+ requestId: null,
85
+ creditsRemaining: null,
86
+ };
87
+ }
88
+ const requestId = res.headers.get("x-request-id");
89
+ const creditsRemaining = numberHeader(res, "x-ohmframe-credits-remaining");
90
+ const text = await res.text();
91
+ let parsed = null;
92
+ try {
93
+ parsed = text ? JSON.parse(text) : null;
94
+ }
95
+ catch {
96
+ // Non-JSON body (proxy error page); never pass HTML on to the agent
97
+ }
98
+ if (res.ok) {
99
+ if (parsed === null) {
100
+ return {
101
+ ok: false,
102
+ status: res.status,
103
+ error: "upstream_error",
104
+ message: "The portal returned a response that is not JSON.",
105
+ requestId,
106
+ creditsRemaining,
107
+ };
108
+ }
109
+ return { ok: true, status: res.status, data: parsed, requestId, creditsRemaining };
110
+ }
111
+ const obj = parsed && typeof parsed === "object" ? parsed : {};
112
+ const error = errorCodeFor(res.status, obj);
113
+ const portalMessage = typeof obj.message === "string" ? obj.message : typeof obj.error === "string" ? obj.error : null;
114
+ const details = {};
115
+ for (const key of PASSTHROUGH)
116
+ if (key in obj)
117
+ details[key] = obj[key];
118
+ const retryAfter = numberHeader(res, "retry-after") ?? (typeof obj.retryAfter === "number" ? obj.retryAfter : null);
119
+ return {
120
+ ok: false,
121
+ status: res.status,
122
+ error,
123
+ message: [portalMessage, HINTS[error]].filter(Boolean).join(" "),
124
+ requestId: requestId ?? (typeof obj.requestId === "string" ? obj.requestId : null),
125
+ creditsRemaining,
126
+ ...(retryAfter !== null && { retryAfterSeconds: retryAfter }),
127
+ ...(Object.keys(details).length > 0 && { details }),
128
+ };
129
+ }
130
+ const sleep = (ms, signal) => new Promise((resolve) => {
131
+ const t = setTimeout(resolve, ms);
132
+ signal?.addEventListener("abort", () => {
133
+ clearTimeout(t);
134
+ resolve();
135
+ });
136
+ });
137
+ /** Turn a finished job view into the same result shape as a synchronous call. */
138
+ export function jobOutcome(job, requestId, creditsRemaining) {
139
+ if (job.state === "completed") {
140
+ return { ok: true, status: 200, data: job.result ?? null, requestId, creditsRemaining };
141
+ }
142
+ if (job.state === "failed") {
143
+ const status = job.resultStatus ?? 500;
144
+ const body = job.error && typeof job.error === "object" ? job.error : {};
145
+ const error = errorCodeFor(status, body);
146
+ const portalMessage = typeof body.error === "string" ? body.error : null;
147
+ return {
148
+ ok: false,
149
+ status,
150
+ error,
151
+ message: [portalMessage, HINTS[error], "Failed jobs are not charged."].filter(Boolean).join(" "),
152
+ requestId,
153
+ creditsRemaining: null, // the failed job was refunded after the 202 count was reported
154
+ details: { jobId: job.jobId },
155
+ };
156
+ }
157
+ if (job.state === "cancelled") {
158
+ return {
159
+ ok: false,
160
+ status: null,
161
+ error: "job_cancelled",
162
+ message: HINTS.job_cancelled,
163
+ requestId,
164
+ creditsRemaining: null,
165
+ details: { jobId: job.jobId },
166
+ };
167
+ }
168
+ return null;
169
+ }
170
+ /**
171
+ * Submit with `Prefer: respond-async` and wait for the job, reporting progress.
172
+ * A synchronous answer (older portal, or route without async) passes through.
173
+ * If the caller aborts, the job is cancelled so its credits are refunded.
174
+ */
175
+ export async function callPortalAsync(config, path, body, fetchImpl = fetch, opts = {}) {
176
+ const first = await send(config, "POST", path, body, fetchImpl, { Prefer: "respond-async" });
177
+ if (!first.ok || first.status !== 202)
178
+ return first;
179
+ const submitted = first.data;
180
+ const statusPath = submitted.statusUrl ?? `/api/jobs/${submitted.jobId}`;
181
+ const interval = Math.min(5_000, Math.max(1_000, submitted.pollIntervalMs ?? 2_000));
182
+ const deadline = Date.now() + config.jobTimeoutMs;
183
+ let polls = 0;
184
+ let transient = 0;
185
+ while (Date.now() < deadline) {
186
+ await sleep(interval, opts.signal);
187
+ if (opts.signal?.aborted) {
188
+ await send(config, "DELETE", statusPath, undefined, fetchImpl);
189
+ return {
190
+ ok: false,
191
+ status: null,
192
+ error: "job_cancelled",
193
+ message: "The tool call was cancelled, so the job was cancelled and refunded.",
194
+ requestId: first.requestId,
195
+ creditsRemaining: null,
196
+ details: { jobId: submitted.jobId },
197
+ };
198
+ }
199
+ const r = await send(config, "GET", statusPath, undefined, fetchImpl);
200
+ polls++;
201
+ if (!r.ok) {
202
+ // Ride out brief network or 5xx blips; give up on anything else
203
+ if ((r.error === "network_error" || r.error === "upstream_error" || r.error === "rate_limited") && ++transient <= 3) {
204
+ continue;
205
+ }
206
+ return { ...r, details: { ...(r.details ?? {}), jobId: submitted.jobId } };
207
+ }
208
+ transient = 0;
209
+ const job = r.data;
210
+ await opts.onProgress?.(job.state, polls);
211
+ const done = jobOutcome(job, first.requestId, first.creditsRemaining);
212
+ if (done)
213
+ return done;
214
+ }
215
+ return {
216
+ ok: false,
217
+ status: 202,
218
+ error: "job_pending",
219
+ message: HINTS.job_pending,
220
+ requestId: first.requestId,
221
+ creditsRemaining: first.creditsRemaining,
222
+ details: { jobId: submitted.jobId },
223
+ };
224
+ }
@@ -0,0 +1,13 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
+ import type { Config } from "./config.js";
4
+ import { type FetchLike, type PortalResult } from "./portal-client.js";
5
+ import { type ToolDef } from "./tools.js";
6
+ export declare const SERVER_NAME = "ohmframe";
7
+ export declare const SERVER_VERSION: string;
8
+ /** Turn a portal result into an MCP tool result with billing metadata. */
9
+ export declare function toToolResult(tool: ToolDef, result: PortalResult): CallToolResult;
10
+ /** Resume a job that outlived a tool call's wait (error job_pending). Free; needs jobs:read. */
11
+ export declare const JOB_STATUS: ToolDef;
12
+ export declare function enabledTools(config: Config): ToolDef[];
13
+ export declare function createServer(config: Config, fetchImpl?: FetchLike): McpServer;
package/dist/server.js ADDED
@@ -0,0 +1,101 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { z } from "zod";
4
+ import { callPortal, callPortalAsync, jobOutcome, send } from "./portal-client.js";
5
+ import { TOOLS } from "./tools.js";
6
+ const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
7
+ export const SERVER_NAME = "ohmframe";
8
+ export const SERVER_VERSION = typeof pkg.version === "string" && pkg.version ? pkg.version : "0.1.0";
9
+ function textResult(payload, isError) {
10
+ return {
11
+ content: [{ type: "text", text: JSON.stringify(payload, null, 2) }],
12
+ structuredContent: payload,
13
+ ...(isError && { isError: true }),
14
+ };
15
+ }
16
+ /** Turn a portal result into an MCP tool result with billing metadata. */
17
+ export function toToolResult(tool, result) {
18
+ const meta = {
19
+ tool: tool.name,
20
+ requestId: result.requestId,
21
+ creditsRemaining: result.creditsRemaining,
22
+ };
23
+ if (result.ok)
24
+ return textResult({ ...meta, result: result.data }, false);
25
+ const { ok: _ok, ...error } = result;
26
+ return textResult({ ...meta, ...error }, true);
27
+ }
28
+ /** Resume a job that outlived a tool call's wait (error job_pending). Free; needs jobs:read. */
29
+ export const JOB_STATUS = {
30
+ name: "job_status",
31
+ title: "Check a running Ohmframe job",
32
+ path: "/api/jobs",
33
+ credits: 0,
34
+ scope: "jobs:read",
35
+ description: "Get the state or result of a long Ohmframe job by jobId, after a tool returned job_pending. " +
36
+ "Free (no credits). Needs key scope jobs:read.",
37
+ inputSchema: {},
38
+ };
39
+ export function enabledTools(config) {
40
+ return TOOLS.filter((t) => t.gated !== "patent" || config.enablePatent);
41
+ }
42
+ export function createServer(config, fetchImpl = fetch) {
43
+ const server = new McpServer({ name: SERVER_NAME, version: SERVER_VERSION }, {
44
+ instructions: "Ohmframe engineering tools. Extract geometry locally with ohmframe-step-features and pass the " +
45
+ "feature JSON; never upload raw CAD. Every result reports creditsRemaining; stop and tell the user " +
46
+ "on credits_exhausted, and do not retry calls that failed with unauthorized, insufficient_scope or egress_policy.",
47
+ });
48
+ for (const tool of enabledTools(config)) {
49
+ server.registerTool(tool.name, {
50
+ title: tool.title,
51
+ description: tool.description,
52
+ inputSchema: tool.inputSchema,
53
+ annotations: {
54
+ title: tool.title,
55
+ readOnlyHint: true,
56
+ destructiveHint: false,
57
+ idempotentHint: true,
58
+ openWorldHint: true,
59
+ },
60
+ }, async (args, extra) => {
61
+ const problems = tool.preflight?.(args);
62
+ if (problems) {
63
+ return textResult({
64
+ tool: tool.name,
65
+ error: "invalid_input",
66
+ message: "Input failed local validation; nothing was sent and no credits were used.",
67
+ problems,
68
+ }, true);
69
+ }
70
+ if (!tool.async)
71
+ return toToolResult(tool, await callPortal(config, tool.path, args, fetchImpl));
72
+ const progressToken = extra._meta?.progressToken;
73
+ const result = await callPortalAsync(config, tool.path, args, fetchImpl, {
74
+ signal: extra.signal,
75
+ onProgress: progressToken === undefined
76
+ ? undefined
77
+ : (state, polls) => extra
78
+ .sendNotification({
79
+ method: "notifications/progress",
80
+ params: { progressToken, progress: polls, message: `job ${state}` },
81
+ })
82
+ .catch(() => { }),
83
+ });
84
+ return toToolResult(tool, result);
85
+ });
86
+ }
87
+ server.registerTool(JOB_STATUS.name, {
88
+ title: JOB_STATUS.title,
89
+ description: JOB_STATUS.description,
90
+ inputSchema: { jobId: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/) },
91
+ annotations: { title: JOB_STATUS.title, readOnlyHint: true, idempotentHint: true, openWorldHint: true },
92
+ }, async ({ jobId }) => {
93
+ const r = await send(config, "GET", `/api/jobs/${jobId}`, undefined, fetchImpl);
94
+ if (!r.ok)
95
+ return toToolResult(JOB_STATUS, r);
96
+ const job = r.data;
97
+ const done = jobOutcome(job, r.requestId, r.creditsRemaining);
98
+ return toToolResult(JOB_STATUS, done ?? { ...r, data: { jobId: job.jobId, state: job.state } });
99
+ });
100
+ return server;
101
+ }
@@ -0,0 +1,26 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Release Brain tools (plan M-1). Each maps one-to-one to a portal route that
4
+ * runs through withEngineeringRoute (auth, scope, egress, credits, receipt).
5
+ * Credit weights mirror TOOL_CREDITS in the portal (src/types/index.ts) and
6
+ * are stated in every description so agents can budget.
7
+ */
8
+ export interface ToolDef {
9
+ name: string;
10
+ title: string;
11
+ /** Portal route */
12
+ path: string;
13
+ /** Credits per call (Pro MCP / Team). Unchanged re-checks within 30 days are free. */
14
+ credits: number;
15
+ /** ohm_ key scope the portal requires */
16
+ scope: string;
17
+ description: string;
18
+ inputSchema: z.ZodRawShape;
19
+ /** Local checks before any network call; returns errors or null */
20
+ preflight?: (args: Record<string, unknown>) => string[] | null;
21
+ /** Registered only when the matching config flag is on */
22
+ gated?: "patent";
23
+ /** Long model-backed tool: runs as a portal job (A-7) and reports progress */
24
+ async?: boolean;
25
+ }
26
+ export declare const TOOLS: ToolDef[];
package/dist/tools.js ADDED
@@ -0,0 +1,199 @@
1
+ import { z } from "zod";
2
+ import { checkFeatureSet } from "./feature-set.js";
3
+ const PROCESSES = [
4
+ "sheet_metal",
5
+ "cnc_machining",
6
+ "injection_molding",
7
+ "die_casting",
8
+ "3d_printing_fdm",
9
+ "3d_printing_sla",
10
+ "weldment",
11
+ "pcba",
12
+ ];
13
+ const text = (max) => z.string().trim().min(1).max(max);
14
+ function billing(credits, scope) {
15
+ return `Cost: ${credits} credit${credits === 1 ? "" : "s"} per call (re-checking unchanged input within 30 days is free). Needs key scope ${scope}.`;
16
+ }
17
+ export const TOOLS = [
18
+ {
19
+ name: "dfm_analyze",
20
+ title: "DFM analysis from feature JSON",
21
+ path: "/api/dfm",
22
+ credits: 3,
23
+ scope: "brain:dfm",
24
+ description: "Design-for-manufacturing review of a part described by an Ohmframe feature set v0 " +
25
+ "(extract it locally with `uvx ohmframe-step-features part.step`). Returns rule results " +
26
+ "with severity, the feature ids involved and fix suggestions. Never send raw STEP, meshes " +
27
+ `or images: only the feature JSON leaves the machine. ${billing(3, "brain:dfm")}`,
28
+ inputSchema: {
29
+ featureSet: z
30
+ .record(z.string(), z.unknown())
31
+ .describe("Feature set v0 object (schema https://ai.ohmframe.com/api/schemas/feature-set.v0.json), at most 256 KB"),
32
+ process: z
33
+ .enum(PROCESSES)
34
+ .optional()
35
+ .describe("Manufacturing process to check against; defaults to the feature set's part.processHint"),
36
+ },
37
+ preflight: (args) => {
38
+ const r = checkFeatureSet(args.featureSet);
39
+ return r.ok ? null : r.errors;
40
+ },
41
+ },
42
+ {
43
+ name: "cost_estimate",
44
+ title: "Should-cost estimate",
45
+ path: "/api/cost/estimate",
46
+ credits: 2,
47
+ scope: "brain:cost",
48
+ description: "Should-cost estimate for a part: material (live commodity pricing where available), " +
49
+ "process and setup cost per unit at a quantity, with a breakdown and cheaper alternatives. " +
50
+ `Estimates are indicative, not quotes. ${billing(2, "brain:cost")}`,
51
+ inputSchema: {
52
+ process: z.enum(PROCESSES),
53
+ quantity: z.number().int().min(1).max(10_000_000),
54
+ material: z
55
+ .object({ type: text(64).describe("e.g. aluminum, steel, stainless_steel, abs_plastic"), grade: text(64).optional() })
56
+ .optional(),
57
+ geometry: z
58
+ .object({
59
+ boundingBox: z.object({ dimensions: z.tuple([z.number().positive(), z.number().positive(), z.number().positive()]) }).optional(),
60
+ volume: z.number().positive().optional().describe("mm^3"),
61
+ surfaceArea: z.number().positive().optional().describe("mm^2"),
62
+ })
63
+ .passthrough()
64
+ .optional()
65
+ .describe("Dimensions in mm. Fields from a feature set's part summary fit here."),
66
+ flatPattern: z
67
+ .object({
68
+ thickness: z.number().positive(),
69
+ length: z.number().positive(),
70
+ width: z.number().positive(),
71
+ bends: z.number().int().min(0).optional(),
72
+ holes: z.number().int().min(0).optional(),
73
+ })
74
+ .optional()
75
+ .describe("Sheet metal only: flat blank in mm"),
76
+ includeAlternatives: z.boolean().optional(),
77
+ },
78
+ },
79
+ {
80
+ name: "tolerance_stackup",
81
+ title: "Tolerance stack-up",
82
+ path: "/api/tolerance",
83
+ credits: 2,
84
+ scope: "brain:tolerance",
85
+ description: "1-D tolerance stack-up by worst case, RSS or Monte Carlo, with each dimension's percent " +
86
+ `contribution. Up to 20 dimensions. ${billing(2, "brain:tolerance")}`,
87
+ inputSchema: {
88
+ dimensions: z
89
+ .array(z.object({
90
+ name: text(100),
91
+ nominal: z.number(),
92
+ tolerance: z.number().min(0).describe("Symmetric ± tolerance"),
93
+ direction: z.enum(["positive", "negative"]),
94
+ }))
95
+ .min(1)
96
+ .max(20),
97
+ method: z.enum(["worst_case", "rss", "monte_carlo"]),
98
+ gapAnalysis: z.boolean().optional(),
99
+ },
100
+ },
101
+ {
102
+ name: "gdt_check",
103
+ async: true,
104
+ title: "GD&T recommendations",
105
+ path: "/api/gdt",
106
+ credits: 2,
107
+ scope: "brain:gdt",
108
+ description: "Recommends GD&T controls (ASME Y14.5) and datum scheme for a described feature, with " +
109
+ `rationale and typical tolerance values. ${billing(2, "brain:gdt")}`,
110
+ inputSchema: {
111
+ featureDescription: text(5000),
112
+ partContext: text(5000).optional(),
113
+ function: text(2000).optional().describe("What the feature does in the assembly"),
114
+ matingParts: text(2000).optional(),
115
+ manufacturingProcess: text(200).optional(),
116
+ industry: text(200).optional(),
117
+ },
118
+ },
119
+ {
120
+ name: "standards_lookup",
121
+ async: true,
122
+ title: "Applicable standards",
123
+ path: "/api/standards",
124
+ credits: 1,
125
+ scope: "brain:reference",
126
+ description: "Lists standards and certifications that likely apply to an application (IEC, UL, ISO, " +
127
+ `EN, SAE...), by region and industry. Reference tool; sends no design data. ${billing(1, "brain:reference")}`,
128
+ inputSchema: {
129
+ applicationDescription: text(10_000),
130
+ industry: text(200).optional(),
131
+ region: text(200).optional(),
132
+ specificAspects: z.array(text(200)).max(20).optional(),
133
+ existingCertifications: z.array(text(200)).max(20).optional(),
134
+ },
135
+ },
136
+ {
137
+ name: "material_select",
138
+ async: true,
139
+ title: "Material selection",
140
+ path: "/api/material",
141
+ credits: 2,
142
+ scope: "brain:reference",
143
+ description: "Ranks candidate materials for stated mechanical, thermal, environmental, manufacturing " +
144
+ `and cost requirements, with properties and trade-offs. ${billing(2, "brain:reference")}`,
145
+ inputSchema: {
146
+ applicationDescription: text(10_000),
147
+ applicationName: text(200).optional(),
148
+ industry: text(200).optional(),
149
+ tensileStrengthMin: z.number().min(0).optional().describe("MPa"),
150
+ tensileStrengthMax: z.number().min(0).optional().describe("MPa"),
151
+ densityPreference: text(100).optional(),
152
+ stiffnessRequirement: text(100).optional(),
153
+ maxTemperature: z.number().optional().describe("°C"),
154
+ thermalConductivity: text(100).optional(),
155
+ corrosionResistance: text(100).optional(),
156
+ chemicalExposure: text(500).optional(),
157
+ machinability: text(100).optional(),
158
+ weldability: text(100).optional(),
159
+ costSensitivity: text(100).optional(),
160
+ additionalRequirements: text(2000).optional(),
161
+ },
162
+ },
163
+ {
164
+ name: "fmea_generate",
165
+ async: true,
166
+ title: "FMEA draft",
167
+ path: "/api/fmea",
168
+ credits: 3,
169
+ scope: "brain:fmea",
170
+ description: "Drafts a design or process FMEA (failure modes, effects, causes, controls, S/O/D and RPN) " +
171
+ `for review by an engineer. ${billing(3, "brain:fmea")}`,
172
+ inputSchema: {
173
+ productName: text(200),
174
+ productDescription: text(10_000),
175
+ industry: text(200).optional(),
176
+ analysisType: z.enum(["Design FMEA (DFMEA)", "Process FMEA (PFMEA)"]).optional(),
177
+ additionalContext: text(5000).optional(),
178
+ },
179
+ },
180
+ {
181
+ name: "patent_prior_art",
182
+ async: true,
183
+ title: "Patent prior-art scan",
184
+ path: "/api/patent",
185
+ credits: 3,
186
+ scope: "brain:patent",
187
+ description: "Prior-art search terms, classifications and claim-element mapping for an invention " +
188
+ "description. Not legal advice and no claim drafting. Off by default: the description " +
189
+ `leaves the machine, so it needs OHMFRAME_ENABLE_PATENT=1. ${billing(3, "brain:patent")}`,
190
+ inputSchema: {
191
+ inventionDescription: text(10_000),
192
+ technicalField: text(500).optional(),
193
+ noveltyAssessment: text(5000).optional(),
194
+ existingPatents: text(5000).optional(),
195
+ targetMarkets: z.array(text(100)).max(20).optional(),
196
+ },
197
+ gated: "patent",
198
+ },
199
+ ];
package/package.json CHANGED
@@ -1,6 +1,81 @@
1
1
  {
2
2
  "name": "@ohmframe/mcp-server",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Ohmframe MCP server: DFM, should-cost, tolerance, GD&T, FMEA, and engineering reference tools for AI agents",
5
+ "author": "Ohmframe",
6
+ "license": "Apache-2.0",
7
+ "homepage": "https://ai.ohmframe.com",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/itachimoonshot/ohmframe-mcp-server.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/itachimoonshot/ohmframe-mcp-server/issues"
14
+ },
15
+ "keywords": [
16
+ "mcp",
17
+ "model-context-protocol",
18
+ "ohmframe",
19
+ "dfm",
20
+ "cad",
21
+ "engineering",
22
+ "should-cost",
23
+ "tolerance",
24
+ "gdt",
25
+ "fmea"
26
+ ],
27
+ "type": "module",
28
+ "main": "./dist/server.js",
29
+ "types": "./dist/server.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/server.d.ts",
33
+ "import": "./dist/server.js"
34
+ },
35
+ "./package.json": "./package.json",
36
+ "./schemas/feature-set.v0.json": "./schemas/feature-set.v0.schema.json"
37
+ },
38
+ "bin": {
39
+ "ohmframe-mcp": "./dist/cli.js"
40
+ },
41
+ "files": [
42
+ "dist",
43
+ "schemas",
44
+ "skills",
45
+ "CHANGELOG.md",
46
+ "LICENSE",
47
+ "README.md"
48
+ ],
49
+ "publishConfig": {
50
+ "access": "public",
51
+ "provenance": true
52
+ },
53
+ "engines": {
54
+ "node": ">=20"
55
+ },
56
+ "scripts": {
57
+ "build": "tsc -p tsconfig.build.json",
58
+ "typecheck": "tsc --noEmit",
59
+ "lint": "eslint .",
60
+ "test": "vitest run",
61
+ "test:e2e": "node scripts/e2e.mjs",
62
+ "pack:check": "node scripts/pack-check.mjs",
63
+ "check:licenses": "node scripts/check-licenses.mjs",
64
+ "check:skills": "node scripts/skill-manifest.mjs",
65
+ "start": "node dist/cli.js",
66
+ "prepublishOnly": "npm run lint && npm run typecheck && npm test && npm run build && npm run check:skills && npm run check:licenses && npm run test:e2e"
67
+ },
68
+ "dependencies": {
69
+ "@modelcontextprotocol/sdk": "1.32.2",
70
+ "ajv": "8.20.0",
71
+ "zod": "4.6.7"
72
+ },
73
+ "devDependencies": {
74
+ "@eslint/js": "10.0.1",
75
+ "@types/node": "20.19.43",
76
+ "eslint": "10.15.0",
77
+ "typescript": "5.9.3",
78
+ "typescript-eslint": "8.73.0",
79
+ "vitest": "3.2.7"
80
+ }
81
+ }