@wheelfor/mcp 1.0.1 → 1.0.2

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/index.js +18 -5
  2. package/package.json +6 -4
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  ListToolsRequestSchema
9
9
  } from "@modelcontextprotocol/sdk/types.js";
10
10
  var API = "https://wheelfor.com/api";
11
+ var VERSION = "1.0.2";
11
12
  var THEMES = [
12
13
  "Fresh Air",
13
14
  "Popcorn",
@@ -19,9 +20,21 @@ var THEMES = [
19
20
  "Marshmallow"
20
21
  ];
21
22
  var server = new Server(
22
- { name: "wheelfor", version: "1.0.0" },
23
+ { name: "wheelfor", version: VERSION },
23
24
  { capabilities: { tools: {} } }
24
25
  );
26
+ function headerSafe(value) {
27
+ return value.replace(/[^\x20-\x7e]/g, "").slice(0, 100);
28
+ }
29
+ function apiHeaders() {
30
+ const client = server.getClientVersion();
31
+ const headers = {
32
+ "Content-Type": "application/json",
33
+ "User-Agent": `wheelfor-mcp/${VERSION}`
34
+ };
35
+ if (client) headers["X-MCP-Client"] = headerSafe(`${client.name}/${client.version}`);
36
+ return headers;
37
+ }
25
38
  server.setRequestHandler(ListToolsRequestSchema, async () => ({
26
39
  tools: [
27
40
  {
@@ -118,7 +131,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
118
131
  case "create_wheel": {
119
132
  const res = await fetch(`${API}/wheels`, {
120
133
  method: "POST",
121
- headers: { "Content-Type": "application/json" },
134
+ headers: apiHeaders(),
122
135
  body: JSON.stringify({
123
136
  name: args.name,
124
137
  choices: args.choices.join("\n"),
@@ -145,7 +158,7 @@ Edit key: ${data.editKey}`
145
158
  case "spin_wheel": {
146
159
  const raw = args.slug;
147
160
  const slug = raw.replace(/^https?:\/\/[^/]+\/wheel\//, "").replace(/\/.*$/, "");
148
- const res = await fetch(`${API}/wheels/${slug}/spin`);
161
+ const res = await fetch(`${API}/wheels/${slug}/spin`, { headers: apiHeaders() });
149
162
  const data = await res.json();
150
163
  return {
151
164
  content: [
@@ -172,7 +185,7 @@ Share: ${data.url}`
172
185
  if (args.choiceNounPlural) body.choiceNounPlural = args.choiceNounPlural;
173
186
  const res = await fetch(`${API}/wheels`, {
174
187
  method: "POST",
175
- headers: { "Content-Type": "application/json" },
188
+ headers: apiHeaders(),
176
189
  body: JSON.stringify(body)
177
190
  });
178
191
  const data = await res.json();
@@ -192,7 +205,7 @@ Share: ${data.url}`
192
205
  const topic = args.topic ?? "Decision";
193
206
  const res = await fetch(`${API}/wheels`, {
194
207
  method: "POST",
195
- headers: { "Content-Type": "application/json" },
208
+ headers: apiHeaders(),
196
209
  body: JSON.stringify({
197
210
  name: topic,
198
211
  choices: options.join("\n"),
package/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "@wheelfor/mcp",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "MCP server for wheelfor.com — create, spin, and manage decision wheels",
5
5
  "type": "module",
6
6
  "bin": {
7
- "wheelfor-mcp": "./dist/index.js"
7
+ "wheelfor-mcp": "dist/index.js"
8
8
  },
9
9
  "scripts": {
10
10
  "build": "tsup",
11
11
  "dev": "tsup --watch"
12
12
  },
13
- "files": ["dist"],
13
+ "files": [
14
+ "dist"
15
+ ],
14
16
  "dependencies": {
15
17
  "@modelcontextprotocol/sdk": "^1.29.0"
16
18
  },
@@ -22,7 +24,7 @@
22
24
  "license": "MIT",
23
25
  "repository": {
24
26
  "type": "git",
25
- "url": "https://github.com/wheelfor/mcp"
27
+ "url": "git+https://github.com/wheelfor/mcp.git"
26
28
  },
27
29
  "homepage": "https://wheelfor.com"
28
30
  }