@raywake/mcp 0.0.0-stage → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Raywake
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,208 @@
1
- # Temporary Holding Version
1
+ # Raywake MCP
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 500+ AI image, video and audio models in Claude, ChatGPT, Cursor and any MCP client.
4
+
5
+ An open-source TypeScript MCP server for [Raywake](https://raywake.si). Use the hosted connector at `https://mcp.raywake.com/v1` with nothing to install, or run this package locally over stdio with `npx` (Node.js 20 or later).
6
+
7
+ ## Get an API key
8
+
9
+ Create a key at [raywake.si/api-keys](https://raywake.si/api-keys). Enable `models:read`, `generate`, `jobs:read`, and `wallet:read` for all tools (`upload_file` needs `generate`, `list_media` needs `jobs:read`). Add USD balance at [raywake.si/billing](https://raywake.si/billing) when you want to generate. Browsing, uploads, quotes and job checks are free.
10
+
11
+ Replace `YOUR_RAYWAKE_API_KEY` in the configurations below. Keep your key private and keep configuration files containing it out of version control.
12
+
13
+ ## Claude Code
14
+
15
+ ```sh
16
+ claude mcp add raywake -e RAYWAKE_API_KEY=YOUR_RAYWAKE_API_KEY -- npx -y @raywake/mcp
17
+ ```
18
+
19
+ ## Cursor
20
+
21
+ Add to `~/.cursor/mcp.json` (or your project's `.cursor/mcp.json`), then enable Raywake in MCP settings:
22
+
23
+ ```json
24
+ {
25
+ "mcpServers": {
26
+ "raywake": {
27
+ "command": "npx",
28
+ "args": ["-y", "@raywake/mcp"],
29
+ "env": { "RAYWAKE_API_KEY": "YOUR_RAYWAKE_API_KEY" }
30
+ }
31
+ }
32
+ }
33
+ ```
34
+
35
+ ## Claude Desktop
36
+
37
+ Open Settings > Developer > Edit Config and add to `claude_desktop_config.json`. Restart Claude Desktop after saving.
38
+
39
+ ```json
40
+ {
41
+ "mcpServers": {
42
+ "raywake": {
43
+ "command": "npx",
44
+ "args": ["-y", "@raywake/mcp"],
45
+ "env": { "RAYWAKE_API_KEY": "YOUR_RAYWAKE_API_KEY" }
46
+ }
47
+ }
48
+ }
49
+ ```
50
+
51
+ ## Windsurf
52
+
53
+ Add to `~/.codeium/windsurf/mcp_config.json`, then refresh MCP servers:
54
+
55
+ ```json
56
+ {
57
+ "mcpServers": {
58
+ "raywake": {
59
+ "command": "npx",
60
+ "args": ["-y", "@raywake/mcp"],
61
+ "env": { "RAYWAKE_API_KEY": "YOUR_RAYWAKE_API_KEY" }
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ ## VS Code
68
+
69
+ Add to `.vscode/mcp.json`. VS Code prompts for your key and stores the input securely:
70
+
71
+ ```json
72
+ {
73
+ "inputs": [
74
+ {
75
+ "type": "promptString",
76
+ "id": "raywake-api-key",
77
+ "description": "Raywake API key",
78
+ "password": true
79
+ }
80
+ ],
81
+ "servers": {
82
+ "raywake": {
83
+ "type": "stdio",
84
+ "command": "npx",
85
+ "args": ["-y", "@raywake/mcp"],
86
+ "env": { "RAYWAKE_API_KEY": "${input:raywake-api-key}" }
87
+ }
88
+ }
89
+ }
90
+ ```
91
+
92
+ These JSON examples are complete minimal configurations. Merge the `raywake` entry into an existing configuration to retain your other servers. On Windows, if the client cannot start `npx`, use `"command": "cmd"` and `"args": ["/c", "npx", "-y", "@raywake/mcp"]`.
93
+
94
+ ## Remote (no install)
95
+
96
+ Raywake also hosts the same tools over Streamable HTTP:
97
+
98
+ ```text
99
+ https://mcp.raywake.com/v1
100
+ ```
101
+
102
+ - **Claude.ai / Claude Desktop:** Settings > Connectors > Add custom connector, paste the URL, then sign in with your Raywake account.
103
+ - **ChatGPT:** Settings > Connectors > Create (developer mode), paste the URL, then sign in with your Raywake account.
104
+ - **Claude Code:** `claude mcp add --transport http raywake https://mcp.raywake.com/v1`, then run `/mcp` to sign in. To use an API key instead: add `--header "Authorization: Bearer YOUR_RAYWAKE_API_KEY"`.
105
+
106
+ OAuth connections set a per-generation spending limit at sign-in and expire after 30 days; you can disconnect them at any time in Raywake settings.
107
+
108
+ ## Tools
109
+
110
+ | Tool | Cost | Purpose |
111
+ | --- | --- | --- |
112
+ | `search_models` | Free | Search by `query`, `category`, `modality` (`image`, `video`, `audio`) and `page` (starts at 1; 20 results per page) |
113
+ | `list_categories` | Free | List available categories |
114
+ | `get_model` | Free | Read the exact input schema and indicative starting price in USD |
115
+ | `quote` | Free | Price an exact `model` and `input`; returns `quote_id`, `price_usd`, `expires_at` |
116
+ | `generate` | Paid | Submit the approved exact `model`, `input`, `quote_id`; optional `idempotency_key` for recovery |
117
+ | `get_job` | Free | Read `job_id`, outputs and status; optional `wait_seconds` from 0 to 45 |
118
+ | `list_jobs` | Free | List account history; optional `limit` (1–500), `offset`, `status` |
119
+ | `get_account` | Free | Read available, reserved and debt balances in USD |
120
+ | `upload_file` | Free | Upload one local image, video or audio file by `path` to your private Raywake files; returns the `url` to put into a model's media input |
121
+ | `list_media` | Free | List your uploaded files, newest first, with fresh links; optional `page` (20 per page) |
122
+ | `get_playbook` | Free | Read the short workflow, spending and file rules |
123
+
124
+ `search_models` maps `query` to the API's `search`, and `page` to `limit`/`offset`. Because the API has no modality parameter, modality matches category/tags locally before pagination. Some models may match multiple modalities. `get_model` preserves the gateway's `openapi` schema and derives a starting price from its retail price guide when necessary. Starting prices are per the returned unit, such as image or second; they are not a quote for a complete run. An unavailable starting price is returned as `null`.
125
+
126
+ ## Example prompts
127
+
128
+ - "Find image models for product photography and compare their starting prices in USD."
129
+ - "Show the schema for this model, prepare my input and get a quote. Ask me before spending anything."
130
+ - "Animate ~/Pictures/product.png into a short video. Show me the price before generating."
131
+ - "Quote a short video using this public HTTPS image URL. Show me the price before generating."
132
+ - "I approve this quoted price and input. Generate it, then check the existing job until it finishes."
133
+ - "Show my recent jobs and retrieve the newest result."
134
+ - "What is my available USD balance?"
135
+
136
+ ## What costs money
137
+
138
+ Only `generate` can spend your Raywake balance. Search, schemas, uploads, quotes, wallet reads and job polling are free. The assistant must follow:
139
+
140
+ 1. Search for a model and read its schema with `get_model`.
141
+ 2. Call `quote` with the complete input.
142
+ 3. Show you the USD price, expiry and whether it is a usage-based maximum reservation, and get your approval.
143
+ 4. Call `generate` with that exact model, input and quote ID.
144
+ 5. Continue with `get_job`; polling never starts another generation.
145
+
146
+ The quote's `settles_on_usage` flag indicates a maximum reservation: actual billed usage is charged and unused balance is returned. For an expired quote or changed input, obtain a new quote and approval. If balance is insufficient, [top up](https://raywake.si/billing).
147
+
148
+ Approval is a rule communicated to the assistant through descriptions and the built-in playbook; the server cannot independently verify a conversation's human approval. Your MCP client's confirmation settings should require approval for the paid `generate` tool. Quote ownership, expiry and exact input binding are enforced by Raywake's gateway, with additional matching checks for quotes known to this process.
149
+
150
+ ### Waiting and safe retries
151
+
152
+ `generate` waits for up to 45 seconds including submission, then returns the known `job_id`, latest status and its generated `idempotency_key`. If polling fails, it retains the job reference. Continue using `get_job` with `wait_seconds` up to 45. Terminal states are `succeeded`, `failed`, `needs_review`, `submission_unknown`, and `needs_reconciliation`. Review and reconciliation states require attention; do not submit a replacement run automatically.
153
+
154
+ Save the `idempotency_key`, including from an error result. If the submission response is lost, retry `generate` with the same key, model, input and quote ID. The gateway returns the existing job for an exact retry, including after quote expiry. Never use a new key to recover an uncertain submission. Within a running server, repeating the same generation request also reuses its saved key. After restarting, supply the saved key; the gateway remains the authority for recovery of quotes no longer in local memory. Keys and quote fingerprints are held only in memory. If the entire tool response and process are lost, use `list_jobs` to find the existing job before doing anything that may spend again.
155
+
156
+ ## Media inputs
157
+
158
+ To use a file from your computer, ask the assistant to use it; it calls `upload_file` with the file's path. In one call the tool checks the file, uploads the unchanged bytes to your private Raywake files and returns an owned `url`. The assistant puts that `url` into the model's image, video or audio input and then quotes. The file is never resized, re-encoded or embedded as base64, and it is never sent anywhere but Raywake.
159
+
160
+ | Type | Limit |
161
+ | --- | --- |
162
+ | JPEG, PNG, WebP | 25 MB |
163
+ | MP4, MOV | 200 MB |
164
+ | WebM | 100 MB |
165
+ | MP3, WAV | 50 MB |
166
+
167
+ The type is detected from the file's own bytes, not just its extension. Per account, at most 3 uploads can be unfinished at once and 250 MB can be stored. Files are kept for 30 days; a returned link stays valid for 7 days, and `list_media` returns fresh links. Large files are streamed from disk, not loaded into memory.
168
+
169
+ **Which files can be read.** By default `upload_file` reads only files inside your home folder and the folder the server was started in (ignored when that is the filesystem root or a folder above your home). Symlinks are resolved before the check. Files in hidden folders such as `~/.ssh`, `~/.aws` or `~/.config`, and anything that is not one of the types above, are refused before the file is opened. Set `RAYWAKE_UPLOAD_ROOTS` to replace the allowed folders. Errors tell the assistant what to do next: file not found, folder not allowed, wrong type, too large, upload limit reached, upload failed (retry), or an API key without the `generate` permission.
170
+
171
+ A public HTTPS link can still go into a model input directly. Importing a web link into your Raywake files and reusing an earlier result as an uploaded file are available only through the hosted connector signed in with your Raywake account: the API rejects those two operations for API keys, so this package has no tools for them. Output links may be temporary; call `get_job` again to retrieve current links.
172
+
173
+ ## Configuration
174
+
175
+ | Environment variable | Required | Default |
176
+ | --- | --- | --- |
177
+ | `RAYWAKE_API_KEY` | Yes | None; sent as a Bearer token |
178
+ | `RAYWAKE_API_BASE` | No | `https://api.raywake.com` |
179
+ | `RAYWAKE_UPLOAD_ROOTS` | No | Your home folder and the working folder. Absolute folders separated by `:` (`;` on Windows); `~` means your home folder. Hidden folders inside them stay refused |
180
+
181
+ The base override must use HTTPS, except HTTP on localhost for local mocks. It must not contain credentials, a query or a fragment. Only use an override you trust: it receives your API key. Redirects are rejected. The server reserves stdout for MCP and never logs the key or raw upstream error bodies.
182
+
183
+ ## Privacy
184
+
185
+ Prompts and inputs go to Raywake and the selected model provider to fulfil your request. Your MCP client also handles the conversation and tool results. Do not include secrets in model inputs. This local package does not add analytics or write prompts, keys, quotes or results to disk. `upload_file` reads only the file you ask it to upload, and only from the allowed folders. Client logging and the services' retention policies apply separately.
186
+
187
+ ## Development
188
+
189
+ ```sh
190
+ npm install
191
+ npm run build
192
+ npm test
193
+ npm run smoke
194
+ ```
195
+
196
+ `npm test` builds the CLI, uses Vitest with a mocked fetch and dummy credentials, and checks real stdio tool discovery without API access. The separate `npm run smoke` SDK test starts its own HTTP server on `127.0.0.1` with a dummy key, launches the compiled CLI, lists all eleven tools and exercises discovery, file upload to a local stand-in for the signed upload link, quote, generation and job retrieval. Neither command calls `api.raywake.com`. The HTTP smoke requires permission to bind a local port; restricted sandboxes may reject it with `EPERM`.
197
+
198
+ To connect an MCP client to this unpublished checkout, replace the `npx` configuration with `"command": "node"` and `"args": ["/absolute/path/to/raywake-mcp/dist/index.js"]`; keep the same environment configuration. For a terminal launch after building:
199
+
200
+ ```sh
201
+ RAYWAKE_API_KEY=YOUR_RAYWAKE_API_KEY node dist/index.js
202
+ ```
203
+
204
+ `server.json` is the metadata published to the [official MCP Registry](https://registry.modelcontextprotocol.io) as `si.raywake/mcp`. Release and registry publication are separate manual steps. The npm package's `mcpName` matches `si.raywake/mcp`; version fields must stay in sync.
205
+
206
+ ## License
207
+
208
+ [MIT](LICENSE), copyright Raywake.
@@ -0,0 +1,93 @@
1
+ export type JsonObject = Record<string, unknown>;
2
+ export declare const TERMINAL_STATUSES: Set<string>;
3
+ export declare class RaywakeError extends Error {
4
+ readonly details: JsonObject;
5
+ constructor(message: string, details?: JsonObject);
6
+ }
7
+ export interface ClientOptions {
8
+ apiKey: string;
9
+ baseUrl?: string;
10
+ fetch?: typeof fetch;
11
+ /** Folders upload_file may read; default is the home folder and the working folder. */
12
+ uploadRoots?: string[];
13
+ home?: string;
14
+ cwd?: string;
15
+ }
16
+ export declare class RaywakeClient {
17
+ private readonly options;
18
+ private readonly baseUrl;
19
+ private readonly fetcher;
20
+ private readonly quotes;
21
+ private readonly attempts;
22
+ private readonly keys;
23
+ constructor(options: ClientOptions);
24
+ private request;
25
+ searchModels(params: {
26
+ query?: string;
27
+ category?: string;
28
+ modality?: 'image' | 'video' | 'audio';
29
+ page?: number;
30
+ }): Promise<{
31
+ models: JsonObject[];
32
+ page: number;
33
+ page_size: number;
34
+ next_page: number | null;
35
+ }>;
36
+ listCategories(): Promise<{
37
+ categories: unknown;
38
+ }>;
39
+ getModel(model: string): Promise<JsonObject>;
40
+ quote(model: string, input: JsonObject): Promise<{
41
+ quote_id: string;
42
+ model: string;
43
+ price_usd: {} | undefined;
44
+ expires_at: unknown;
45
+ settles_on_usage: {};
46
+ approval_required: boolean;
47
+ instruction: string;
48
+ }>;
49
+ generate(model: string, input: JsonObject, quoteId: string, suppliedKey?: string, signal?: AbortSignal): Promise<{
50
+ idempotency_key: string;
51
+ }>;
52
+ private waitForJob;
53
+ getJob(jobId: string, waitSeconds?: number, signal?: AbortSignal): Promise<JsonObject>;
54
+ listJobs(params: {
55
+ limit?: number;
56
+ offset?: number;
57
+ status?: string;
58
+ }): Promise<{
59
+ jobs: JsonObject[];
60
+ }>;
61
+ getAccount(): Promise<{
62
+ account_id: unknown;
63
+ currency: string;
64
+ available_usd: {} | undefined;
65
+ reserved_usd: {} | undefined;
66
+ debt_usd: {} | undefined;
67
+ }>;
68
+ /** Upload one local file and return its owned Raywake URL. Free; nothing is generated. */
69
+ uploadFile(filePath: string, signal?: AbortSignal): Promise<{
70
+ asset_id: string;
71
+ url: string;
72
+ kind: string;
73
+ content_type: string;
74
+ size_bytes: {};
75
+ file_name: string;
76
+ kept_until: {} | null;
77
+ use: string;
78
+ }>;
79
+ /** The account's uploaded input files, newest first. */
80
+ listMedia(page?: number): Promise<{
81
+ files: {
82
+ asset_id: unknown;
83
+ url: string;
84
+ kind: string;
85
+ content_type: string;
86
+ size_bytes: {} | null;
87
+ added_at: {} | null;
88
+ kept_until: {} | null;
89
+ }[];
90
+ page: number;
91
+ next_page: number | null;
92
+ }>;
93
+ }