fastmcp 3.25.4 → 3.26.3
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/FastMCP.cjs +1931 -0
- package/dist/FastMCP.cjs.map +1 -0
- package/dist/FastMCP.d.cts +754 -0
- package/dist/FastMCP.d.ts +3 -1
- package/dist/FastMCP.js +6 -0
- package/dist/FastMCP.js.map +1 -1
- package/dist/{OAuthProxy-BOCkkAhO.d.ts → OAuthProxy-jvsyum7s.d.cts} +5 -0
- package/dist/OAuthProxy-jvsyum7s.d.ts +524 -0
- package/dist/auth/index.cjs +1875 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +445 -0
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +34 -3
- package/dist/auth/index.js.map +1 -1
- package/dist/bin/fastmcp.cjs +152 -0
- package/dist/bin/fastmcp.cjs.map +1 -0
- package/dist/bin/fastmcp.d.cts +1 -0
- package/package.json +7 -4
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict"; function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3
|
+
// src/bin/fastmcp.ts
|
|
4
|
+
var _execa = require('execa');
|
|
5
|
+
var _yargs = require('yargs'); var _yargs2 = _interopRequireDefault(_yargs);
|
|
6
|
+
var _helpers = require('yargs/helpers');
|
|
7
|
+
await _yargs2.default.call(void 0, _helpers.hideBin.call(void 0, process.argv)).scriptName("fastmcp").command(
|
|
8
|
+
"dev <file>",
|
|
9
|
+
"Start a development server",
|
|
10
|
+
(yargs2) => {
|
|
11
|
+
return yargs2.positional("file", {
|
|
12
|
+
demandOption: true,
|
|
13
|
+
describe: "The path to the server file",
|
|
14
|
+
type: "string"
|
|
15
|
+
}).option("watch", {
|
|
16
|
+
alias: "w",
|
|
17
|
+
default: false,
|
|
18
|
+
describe: "Watch for file changes and restart server",
|
|
19
|
+
type: "boolean"
|
|
20
|
+
}).option("verbose", {
|
|
21
|
+
alias: "v",
|
|
22
|
+
default: false,
|
|
23
|
+
describe: "Enable verbose logging",
|
|
24
|
+
type: "boolean"
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
async (argv) => {
|
|
28
|
+
try {
|
|
29
|
+
const command = argv.watch ? `npx @wong2/mcp-cli npx tsx --watch ${argv.file}` : `npx @wong2/mcp-cli npx tsx ${argv.file}`;
|
|
30
|
+
if (argv.verbose) {
|
|
31
|
+
console.log(`[FastMCP] Starting server: ${command}`);
|
|
32
|
+
console.log(`[FastMCP] File: ${argv.file}`);
|
|
33
|
+
console.log(
|
|
34
|
+
`[FastMCP] Watch mode: ${argv.watch ? "enabled" : "disabled"}`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
await _execa.execa.call(void 0, {
|
|
38
|
+
shell: true,
|
|
39
|
+
stderr: "inherit",
|
|
40
|
+
stdin: "inherit",
|
|
41
|
+
stdout: "inherit"
|
|
42
|
+
})`${command}`;
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error(
|
|
45
|
+
"[FastMCP Error] Failed to start development server:",
|
|
46
|
+
error instanceof Error ? error.message : String(error)
|
|
47
|
+
);
|
|
48
|
+
if (argv.verbose && error instanceof Error && error.stack) {
|
|
49
|
+
console.error("[FastMCP Debug] Stack trace:", error.stack);
|
|
50
|
+
}
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
).command(
|
|
55
|
+
"inspect <file>",
|
|
56
|
+
"Inspect a server file",
|
|
57
|
+
(yargs2) => {
|
|
58
|
+
return yargs2.positional("file", {
|
|
59
|
+
demandOption: true,
|
|
60
|
+
describe: "The path to the server file",
|
|
61
|
+
type: "string"
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
async (argv) => {
|
|
65
|
+
try {
|
|
66
|
+
await _execa.execa.call(void 0, {
|
|
67
|
+
stderr: "inherit",
|
|
68
|
+
stdout: "inherit"
|
|
69
|
+
})`npx @modelcontextprotocol/inspector npx tsx ${argv.file}`;
|
|
70
|
+
} catch (error) {
|
|
71
|
+
console.error(
|
|
72
|
+
"[FastMCP Error] Failed to inspect server:",
|
|
73
|
+
error instanceof Error ? error.message : String(error)
|
|
74
|
+
);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
).command(
|
|
79
|
+
"validate <file>",
|
|
80
|
+
"Validate a FastMCP server file for syntax and basic structure",
|
|
81
|
+
(yargs2) => {
|
|
82
|
+
return yargs2.positional("file", {
|
|
83
|
+
demandOption: true,
|
|
84
|
+
describe: "The path to the server file",
|
|
85
|
+
type: "string"
|
|
86
|
+
}).option("strict", {
|
|
87
|
+
alias: "s",
|
|
88
|
+
default: false,
|
|
89
|
+
describe: "Enable strict validation (type checking)",
|
|
90
|
+
type: "boolean"
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
async (argv) => {
|
|
94
|
+
try {
|
|
95
|
+
const { existsSync } = await Promise.resolve().then(() => _interopRequireWildcard(require("fs")));
|
|
96
|
+
const { resolve } = await Promise.resolve().then(() => _interopRequireWildcard(require("path")));
|
|
97
|
+
const filePath = resolve(argv.file);
|
|
98
|
+
if (!existsSync(filePath)) {
|
|
99
|
+
console.error(`[FastMCP Error] File not found: ${filePath}`);
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
console.log(`[FastMCP] Validating server file: ${filePath}`);
|
|
103
|
+
const command = argv.strict ? `npx tsc --noEmit --strict ${filePath}` : `npx tsc --noEmit ${filePath}`;
|
|
104
|
+
try {
|
|
105
|
+
await _execa.execa.call(void 0, {
|
|
106
|
+
shell: true,
|
|
107
|
+
stderr: "pipe",
|
|
108
|
+
stdout: "pipe"
|
|
109
|
+
})`${command}`;
|
|
110
|
+
console.log("[FastMCP] \u2713 TypeScript compilation successful");
|
|
111
|
+
} catch (tsError) {
|
|
112
|
+
console.error("[FastMCP] \u2717 TypeScript compilation failed");
|
|
113
|
+
if (tsError instanceof Error && "stderr" in tsError) {
|
|
114
|
+
console.error(tsError.stderr);
|
|
115
|
+
}
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
await _execa.execa.call(void 0, {
|
|
120
|
+
shell: true,
|
|
121
|
+
stderr: "pipe",
|
|
122
|
+
stdout: "pipe"
|
|
123
|
+
})`node -e "
|
|
124
|
+
(async () => {
|
|
125
|
+
try {
|
|
126
|
+
const { FastMCP } = await import('fastmcp');
|
|
127
|
+
await import('file://${filePath}');
|
|
128
|
+
console.log('[FastMCP] ✓ Server structure validation passed');
|
|
129
|
+
} catch (error) {
|
|
130
|
+
console.error('[FastMCP] ✗ Server structure validation failed:', error.message);
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
})();
|
|
134
|
+
"`;
|
|
135
|
+
} catch (e) {
|
|
136
|
+
console.error("[FastMCP] \u2717 Server structure validation failed");
|
|
137
|
+
console.error("Make sure the file properly imports and uses FastMCP");
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
140
|
+
console.log(
|
|
141
|
+
"[FastMCP] \u2713 All validations passed! Server file looks good."
|
|
142
|
+
);
|
|
143
|
+
} catch (error) {
|
|
144
|
+
console.error(
|
|
145
|
+
"[FastMCP Error] Validation failed:",
|
|
146
|
+
error instanceof Error ? error.message : String(error)
|
|
147
|
+
);
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
).help().parseAsync();
|
|
152
|
+
//# sourceMappingURL=fastmcp.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/fastmcp/fastmcp/dist/bin/fastmcp.cjs","../../src/b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AACA,EAAA;AACW,EAAA;AACuB,IAAA;AAChB,MAAA;AACJ,MAAA;AACJ,MAAA;AACP,IAAA;AACH,EAAA;AAEgB,EAAA;AACV,IAAA;AACU,MAAA;AACF,QAAA;AACA,QAAA;AACgD,MAAA;AAC5C,IAAA;AACN,MAAA;AACN,QAAA;AACqD,QAAA;AACvD,MAAA;AAEc,MAAA;AAChB,IAAA;AACF,EAAA;AAGD;AACC,EAAA;AACA,EAAA;AACW,EAAA;AAEa,IAAA;AACJ,MAAA;AACJ,MAAA;AACJ,MAAA;AAGU,IAAA;AACT,MAAA;AACE,MAAA;AACC,MAAA;AACJ,MAAA;AACP,IAAA;AACL,EAAA;AAEgB,EAAA;AACV,IAAA;AACsC,MAAA;AACD,MAAA;AACL,MAAA;AAEP,MAAA;AACkC,QAAA;AAC7C,QAAA;AAChB,MAAA;AAE2D,MAAA;AAIvD,MAAA;AAEA,MAAA;AACU,QAAA;AACH,UAAA;AACC,UAAA;AACA,UAAA;AACE,QAAA;AAE+C,QAAA;AAC3C,MAAA;AACyC,QAAA;AAEJ,QAAA;AACvB,UAAA;AAC9B,QAAA;AAEc,QAAA;AAChB,MAAA;AAEI,MAAA;AACU,QAAA;AACH,UAAA;AACC,UAAA;AACA,UAAA;AACT,QAAA;AAAA;AAAA;AAAA;AAIoC,qCAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAA;AAQ/B,MAAA;AACwD,QAAA;AACM,QAAA;AAEtD,QAAA;AAChB,MAAA;AAEQ,MAAA;AACN,QAAA;AACF,MAAA;AACc,IAAA;AACN,MAAA;AACN,QAAA;AACqD,QAAA;AACvD,MAAA;AAEc,MAAA;AAChB,IAAA;AACF,EAAA;AAIU","file":"/home/runner/work/fastmcp/fastmcp/dist/bin/fastmcp.cjs","sourcesContent":[null,"#!/usr/bin/env node\n\nimport { execa } from \"execa\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\n\nawait yargs(hideBin(process.argv))\n .scriptName(\"fastmcp\")\n .command(\n \"dev <file>\",\n \"Start a development server\",\n (yargs) => {\n return yargs\n .positional(\"file\", {\n demandOption: true,\n describe: \"The path to the server file\",\n type: \"string\",\n })\n\n .option(\"watch\", {\n alias: \"w\",\n default: false,\n describe: \"Watch for file changes and restart server\",\n type: \"boolean\",\n })\n\n .option(\"verbose\", {\n alias: \"v\",\n default: false,\n describe: \"Enable verbose logging\",\n type: \"boolean\",\n });\n },\n\n async (argv) => {\n try {\n const command = argv.watch\n ? `npx @wong2/mcp-cli npx tsx --watch ${argv.file}`\n : `npx @wong2/mcp-cli npx tsx ${argv.file}`;\n\n if (argv.verbose) {\n console.log(`[FastMCP] Starting server: ${command}`);\n console.log(`[FastMCP] File: ${argv.file}`);\n console.log(\n `[FastMCP] Watch mode: ${argv.watch ? \"enabled\" : \"disabled\"}`,\n );\n }\n\n await execa({\n shell: true,\n stderr: \"inherit\",\n stdin: \"inherit\",\n stdout: \"inherit\",\n })`${command}`;\n } catch (error) {\n console.error(\n \"[FastMCP Error] Failed to start development server:\",\n error instanceof Error ? error.message : String(error),\n );\n\n if (argv.verbose && error instanceof Error && error.stack) {\n console.error(\"[FastMCP Debug] Stack trace:\", error.stack);\n }\n\n process.exit(1);\n }\n },\n )\n\n .command(\n \"inspect <file>\",\n \"Inspect a server file\",\n (yargs) => {\n return yargs.positional(\"file\", {\n demandOption: true,\n describe: \"The path to the server file\",\n type: \"string\",\n });\n },\n\n async (argv) => {\n try {\n await execa({\n stderr: \"inherit\",\n stdout: \"inherit\",\n })`npx @modelcontextprotocol/inspector npx tsx ${argv.file}`;\n } catch (error) {\n console.error(\n \"[FastMCP Error] Failed to inspect server:\",\n error instanceof Error ? error.message : String(error),\n );\n\n process.exit(1);\n }\n },\n )\n\n .command(\n \"validate <file>\",\n \"Validate a FastMCP server file for syntax and basic structure\",\n (yargs) => {\n return yargs\n .positional(\"file\", {\n demandOption: true,\n describe: \"The path to the server file\",\n type: \"string\",\n })\n\n .option(\"strict\", {\n alias: \"s\",\n default: false,\n describe: \"Enable strict validation (type checking)\",\n type: \"boolean\",\n });\n },\n\n async (argv) => {\n try {\n const { existsSync } = await import(\"fs\");\n const { resolve } = await import(\"path\");\n const filePath = resolve(argv.file);\n\n if (!existsSync(filePath)) {\n console.error(`[FastMCP Error] File not found: ${filePath}`);\n process.exit(1);\n }\n\n console.log(`[FastMCP] Validating server file: ${filePath}`);\n\n const command = argv.strict\n ? `npx tsc --noEmit --strict ${filePath}`\n : `npx tsc --noEmit ${filePath}`;\n\n try {\n await execa({\n shell: true,\n stderr: \"pipe\",\n stdout: \"pipe\",\n })`${command}`;\n\n console.log(\"[FastMCP] ✓ TypeScript compilation successful\");\n } catch (tsError) {\n console.error(\"[FastMCP] ✗ TypeScript compilation failed\");\n\n if (tsError instanceof Error && \"stderr\" in tsError) {\n console.error(tsError.stderr);\n }\n\n process.exit(1);\n }\n\n try {\n await execa({\n shell: true,\n stderr: \"pipe\",\n stdout: \"pipe\",\n })`node -e \"\n (async () => {\n try {\n const { FastMCP } = await import('fastmcp');\n await import('file://${filePath}');\n console.log('[FastMCP] ✓ Server structure validation passed');\n } catch (error) {\n console.error('[FastMCP] ✗ Server structure validation failed:', error.message);\n process.exit(1);\n }\n })();\n \"`;\n } catch {\n console.error(\"[FastMCP] ✗ Server structure validation failed\");\n console.error(\"Make sure the file properly imports and uses FastMCP\");\n\n process.exit(1);\n }\n\n console.log(\n \"[FastMCP] ✓ All validations passed! Server file looks good.\",\n );\n } catch (error) {\n console.error(\n \"[FastMCP Error] Validation failed:\",\n error instanceof Error ? error.message : String(error),\n );\n\n process.exit(1);\n }\n },\n )\n\n .help()\n .parseAsync();\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastmcp",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.26.3",
|
|
4
4
|
"main": "dist/FastMCP.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -24,11 +24,13 @@
|
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
26
|
"import": "./dist/FastMCP.js",
|
|
27
|
-
"types": "./dist/FastMCP.d.ts"
|
|
27
|
+
"types": "./dist/FastMCP.d.ts",
|
|
28
|
+
"require": "./dist/FastMCP.cjs"
|
|
28
29
|
},
|
|
29
30
|
"./auth": {
|
|
30
31
|
"import": "./dist/auth/index.js",
|
|
31
|
-
"types": "./dist/auth/index.d.ts"
|
|
32
|
+
"types": "./dist/auth/index.d.ts",
|
|
33
|
+
"require": "./dist/auth/index.cjs"
|
|
32
34
|
}
|
|
33
35
|
},
|
|
34
36
|
"dependencies": {
|
|
@@ -107,7 +109,8 @@
|
|
|
107
109
|
"src/auth/index.ts"
|
|
108
110
|
],
|
|
109
111
|
"format": [
|
|
110
|
-
"esm"
|
|
112
|
+
"esm",
|
|
113
|
+
"cjs"
|
|
111
114
|
],
|
|
112
115
|
"dts": true,
|
|
113
116
|
"splitting": true,
|