@wavespeed/mcp 1.0.4 → 1.0.5

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/dist/lib/api.js +16 -1
  2. package/package.json +2 -2
package/dist/lib/api.js CHANGED
@@ -6,7 +6,22 @@
6
6
  import fs from 'node:fs';
7
7
  import path from 'node:path';
8
8
  import os from 'node:os';
9
+ import { createRequire } from 'node:module';
9
10
  import { getApiKey, getBaseUrl } from './config.js';
11
+ const require = createRequire(import.meta.url);
12
+ const { version: PKG_VERSION } = require('../../package.json');
13
+ // Channel-attribution headers (X-Client-Name / X-Client-Version / X-Client-OS),
14
+ // following the wavespeed-desktop convention. The WAVESPEED_CLIENT_NAME
15
+ // environment variable overrides the name so wrapper channels can brand
16
+ // themselves without code changes.
17
+ export function clientAttributionHeaders() {
18
+ const platform = os.platform();
19
+ return {
20
+ 'X-Client-Name': process.env.WAVESPEED_CLIENT_NAME || 'wavespeed-mcp',
21
+ 'X-Client-Version': PKG_VERSION,
22
+ 'X-Client-OS': platform === 'win32' ? 'windows' : platform,
23
+ };
24
+ }
10
25
  const CACHE_TTL_MS = 60 * 60 * 1000; // 1 hour
11
26
  function cachePath() {
12
27
  return path.join(os.homedir(), '.cache', 'wavespeed', 'models.json');
@@ -57,7 +72,7 @@ function authHeaders() {
57
72
  if (!apiKey) {
58
73
  throw new Error('No WaveSpeed API key configured. Set WAVESPEED_API_KEY, or run `wavespeed login`.');
59
74
  }
60
- return { Authorization: `Bearer ${apiKey}` };
75
+ return { Authorization: `Bearer ${apiKey}`, ...clientAttributionHeaders() };
61
76
  }
62
77
  async function apiGet(apiPath) {
63
78
  const res = await fetch(`${getBaseUrl()}${apiPath}`, { headers: authHeaders() });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wavespeed/mcp",
3
- "version": "1.0.4",
4
- "description": "WaveSpeed MCP server \u2014 run any model on the live WaveSpeed catalog (image, video, audio, 3D) with schema introspection, local-file upload, and price quotes.",
3
+ "version": "1.0.5",
4
+ "description": "WaveSpeed MCP server — run any model on the live WaveSpeed catalog (image, video, audio, 3D) with schema introspection, local-file upload, and price quotes.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "wavespeed-mcp": "dist/index.js"