@telitask/mcp-server 0.2.0 → 0.2.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/dist/index.js +46 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,50 @@
1
1
  #!/usr/bin/env node
2
+ // Polyfill Web API globals for environments that lack them (e.g. Claude Desktop's MCP host).
3
+ // Node 18+ exposes fetch/Headers globally, but some MCP hosts run older Node or strip globals.
4
+ // We try to load undici (Node's built-in fetch implementation) first, then fall back to node-fetch.
5
+ if (typeof globalThis.Headers === 'undefined') {
6
+ try {
7
+ // undici is Node's built-in fetch engine — available in Node 18+ as a module
8
+ // @ts-expect-error — undici may not have type declarations installed
9
+ const undici = await import('undici');
10
+ globalThis.Headers = undici.Headers;
11
+ globalThis.Request = undici.Request;
12
+ globalThis.Response = undici.Response;
13
+ if (typeof globalThis.fetch === 'undefined') {
14
+ globalThis.fetch = undici.fetch;
15
+ }
16
+ }
17
+ catch {
18
+ // Minimal Headers polyfill if undici isn't available
19
+ // @ts-expect-error — lightweight polyfill, not full spec
20
+ globalThis.Headers = class Headers {
21
+ _map = new Map();
22
+ constructor(init) {
23
+ if (init) {
24
+ if (init instanceof Map || (typeof init === 'object' && Symbol.iterator in Object(init))) {
25
+ for (const [key, value] of Object.entries(init)) {
26
+ this._map.set(key.toLowerCase(), value);
27
+ }
28
+ }
29
+ else if (typeof init === 'object') {
30
+ for (const [key, value] of Object.entries(init)) {
31
+ this._map.set(key.toLowerCase(), value);
32
+ }
33
+ }
34
+ }
35
+ }
36
+ get(name) { return this._map.get(name.toLowerCase()) ?? null; }
37
+ set(name, value) { this._map.set(name.toLowerCase(), value); }
38
+ has(name) { return this._map.has(name.toLowerCase()); }
39
+ delete(name) { this._map.delete(name.toLowerCase()); }
40
+ forEach(cb) { this._map.forEach(cb); }
41
+ entries() { return this._map.entries(); }
42
+ keys() { return this._map.keys(); }
43
+ values() { return this._map.values(); }
44
+ [Symbol.iterator]() { return this._map.entries(); }
45
+ };
46
+ }
47
+ }
2
48
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
49
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
50
  import { readCredentials, clearCredentials } from './auth/token-store.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telitask/mcp-server",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "TeliTask MCP server — manage contacts, tasks, and calls from AI assistants",
5
5
  "type": "module",
6
6
  "license": "MIT",