@telitask/mcp-server 0.2.0 → 0.2.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.
- package/dist/index.js +47 -1
- package/package.json +2 -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';
|
|
@@ -45,7 +91,7 @@ function registerAuthTools(server) {
|
|
|
45
91
|
}
|
|
46
92
|
async function runServer() {
|
|
47
93
|
const credentials = readCredentials();
|
|
48
|
-
const server = new McpServer({ name: 'telitask', version: '0.
|
|
94
|
+
const server = new McpServer({ name: 'telitask', version: '0.2.2' }, {
|
|
49
95
|
instructions: credentials
|
|
50
96
|
? 'TeliTask MCP server — manage contacts, tasks, and make phone calls. ' +
|
|
51
97
|
'Use make_call to initiate calls, schedule_call for future calls. ' +
|
package/package.json
CHANGED