bios-mcp 0.1.0-dev.1

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.
Files changed (2) hide show
  1. package/README.md +96 -0
  2. package/package.json +39 -0
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # BIOS MCP server
2
+
3
+ The MCP server exposes the authenticated BIOS training and model-serving
4
+ control planes to MCP-compatible automation clients.
5
+
6
+ Set these environment variables in the MCP client configuration:
7
+
8
+ ```json
9
+ {
10
+ "command": "npx",
11
+ "args": ["-y", "bios-mcp"],
12
+ "env": {
13
+ "BIOS_API_KEY": "bios-...",
14
+ "BIOS_BASE_URL": "https://api.usbios.ai",
15
+ "BIOS_WORKSPACE_ID": "workspace-id",
16
+ "BIOS_INFERENCE_KEY": "sk-usf-deployment-key"
17
+ }
18
+ }
19
+ ```
20
+
21
+ `BIOS_*` is the canonical environment prefix; the legacy `BIOS_*` names are
22
+ still read as a fallback, so existing client configs keep working.
23
+
24
+ `https://api.usbios.ai` is the canonical production hostname. Use
25
+ `https://api-dev.usbios.ai` explicitly during dev.
26
+
27
+ For interactive JWT authentication, omit `BIOS_API_KEY` and set
28
+ `BIOS_ACCESS_TOKEN`. The server never guesses credential type from a prefix:
29
+ API keys use `X-API-Key`, while access tokens use `Authorization: Bearer`.
30
+
31
+ `chat_with_inference` reads the deployment key only from
32
+ `BIOS_INFERENCE_KEY`; a model cannot place it in a tool argument or expose it
33
+ in a transcript. Set `BIOS_INFERENCE_BASE_URL=https://api-dev.usbios.ai`
34
+ explicitly for dev. The tool validates function schemas and matching tool
35
+ response messages, propagates MCP cancellation to the HTTP request, makes one
36
+ non-streaming OpenAI-compatible request, and never retries a dispatched
37
+ inference POST automatically. `BIOS_INFERENCE_TIMEOUT_MS` defaults to
38
+ `900000` (15 minutes). Its idempotency header is propagated, but replay/dedup is
39
+ not claimed without an explicit acknowledgement from the endpoint.
40
+
41
+ ## Safe inference workflow
42
+
43
+ 1. `get_inference_gpu_options` returns inference-fit configurations joined to
44
+ authoritative deployment prices and stock. `unknown` is not treated as
45
+ available.
46
+ 2. `preflight_inference` validates the exact source, model, GPU, queue, price
47
+ cap, and wallet-hold terms without creating a deployment or mutating funds.
48
+ 3. `create_inference` uses the same request contract. Queueing is opt-in, a
49
+ maximum total hourly price is explicit, and a GPU alternative is never
50
+ selected without approval. Its inference key is shown only once.
51
+ 4. `get_inference_status` reports durable queue expiry (including
52
+ `status_reason=queue_expired`), provisioning/loading, endpoint readiness,
53
+ price cap, notification summary, and wallet authorization. An endpoint is
54
+ live only when the returned status is `running`.
55
+ 5. `get_inference_notifications` reports durable lifecycle-email delivery,
56
+ bounded retries, and operator-visible dead letters.
57
+ 6. `update_inference_policy`, `stop_inference`, `resume_inference`,
58
+ `restart_inference`, and `delete_inference` manage the lifecycle.
59
+
60
+ Raw Hugging Face tokens are intentionally excluded from MCP tool inputs. Store
61
+ the token in a platform Hugging Face integration and pass `hf_integration_id`.
62
+
63
+ `create_training_job` and `resume_training_job` accept an optional
64
+ `idempotency_key`. Reuse the same value after a timeout so the API replays the
65
+ original acknowledgement instead of creating another job, wallet hold, queue
66
+ entry, or GPU request. The MCP server generates a fresh key when it is omitted.
67
+
68
+ Training and deployment share one authoritative GPU-capacity broker. Server
69
+ priority is evaluated first. Within an equal-priority class, the broker rotates
70
+ across users and preserves FIFO order within each user's own requests. This
71
+ anti-starvation policy prevents one user's large backlog from monopolizing GPU
72
+ capacity; consequently, a newer request from another user can run before an
73
+ older request in a busy user's backlog.
74
+
75
+ For each eligible request, the broker selects the lowest-ranked approved GPU
76
+ choice that is live, has enough cards, and remains within the accepted total
77
+ hourly price cap. Thus an older request's third choice can receive capacity
78
+ before a newer request's first choice. Unknown/stale provider inventory issues
79
+ no grant. Every vendor mutation requires the broker's short-lived fenced grant,
80
+ and atomic reservations prevent training and deployment replicas from booking
81
+ the same cards.
82
+
83
+ If capacity disappears before the vendor mutation, a queued request releases
84
+ the grant and returns to its original global position. Expired worker leases
85
+ are fenced and recovered with a new grant identity. Ambiguous provider results
86
+ retain the same immutable provisioning request and grant fence until
87
+ reconciliation proves success or definitive failure, so MCP clients should
88
+ retry with the same idempotency key rather than submit a replacement request.
89
+
90
+ ## Verification
91
+
92
+ ```bash
93
+ npm test
94
+ npm run typecheck
95
+ npm run build
96
+ ```
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "bios-mcp",
3
+ "version": "0.1.0-dev.1",
4
+ "description": "BIOS MCP server — train and deploy AI models from MCP-compatible automation clients",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "bios-mcp": "./dist/index.js"
9
+ },
10
+ "main": "./dist/index.js",
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc",
16
+ "dev": "tsx src/index.ts",
17
+ "start": "node dist/index.js",
18
+ "start:http": "node dist/http/main.js",
19
+ "typecheck": "tsc --noEmit",
20
+ "test": "node --import tsx --test test/**/*.test.ts"
21
+ },
22
+ "dependencies": {
23
+ "@modelcontextprotocol/sdk": "^1.12.1",
24
+ "express": "^4.21.2",
25
+ "pg": "^8.16.0",
26
+ "zod": "^4.4.3"
27
+ },
28
+ "devDependencies": {
29
+ "@types/express": "^4.17.23",
30
+ "@types/node": "^22.15.0",
31
+ "@types/pg": "^8.15.4",
32
+ "tsx": "^4.19.4",
33
+ "typescript": "^5.7.3"
34
+ },
35
+ "engines": {
36
+ "node": ">=18.0.0"
37
+ },
38
+ "homepage": "https://usbios.ai/docs/mcp"
39
+ }