@codeqr/ts-mcp 0.8.0 → 0.19.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/LICENSE +1 -1
- package/README.md +16 -218
- package/auth.d.mts +6 -0
- package/auth.d.mts.map +1 -0
- package/auth.d.ts +6 -0
- package/auth.d.ts.map +1 -0
- package/auth.js +37 -0
- package/auth.js.map +1 -0
- package/{headers.mjs → auth.mjs} +16 -2
- package/auth.mjs.map +1 -0
- package/code-tool-paths.cjs +4 -2
- package/code-tool-paths.cjs.map +1 -1
- package/code-tool-paths.d.cts +1 -1
- package/code-tool-paths.d.cts.map +1 -1
- package/code-tool-types.d.mts +7 -9
- package/code-tool-types.d.mts.map +1 -1
- package/code-tool-types.d.ts +7 -9
- package/code-tool-types.d.ts.map +1 -1
- package/code-tool-worker.d.mts.map +1 -1
- package/code-tool-worker.d.ts.map +1 -1
- package/code-tool-worker.js +95 -32
- package/code-tool-worker.js.map +1 -1
- package/code-tool-worker.mjs +95 -32
- package/code-tool-worker.mjs.map +1 -1
- package/code-tool.d.mts +12 -3
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +12 -3
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +275 -109
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +275 -109
- package/code-tool.mjs.map +1 -1
- package/docs-search-tool.d.mts +22 -9
- package/docs-search-tool.d.mts.map +1 -1
- package/docs-search-tool.d.ts +22 -9
- package/docs-search-tool.d.ts.map +1 -1
- package/docs-search-tool.js +31 -5
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +31 -5
- package/docs-search-tool.mjs.map +1 -1
- package/http.d.mts +6 -3
- package/http.d.mts.map +1 -1
- package/http.d.ts +6 -3
- package/http.d.ts.map +1 -1
- package/http.js +108 -49
- package/http.js.map +1 -1
- package/http.mjs +108 -49
- package/http.mjs.map +1 -1
- package/index.js +19 -50
- package/index.js.map +1 -1
- package/index.mjs +19 -50
- package/index.mjs.map +1 -1
- package/instructions.d.mts +2 -0
- package/instructions.d.mts.map +1 -0
- package/instructions.d.ts +2 -0
- package/instructions.d.ts.map +1 -0
- package/instructions.js +42 -0
- package/instructions.js.map +1 -0
- package/instructions.mjs +39 -0
- package/instructions.mjs.map +1 -0
- package/logger.d.mts +7 -0
- package/logger.d.mts.map +1 -0
- package/logger.d.ts +7 -0
- package/logger.d.ts.map +1 -0
- package/logger.js +29 -0
- package/logger.js.map +1 -0
- package/logger.mjs +22 -0
- package/logger.mjs.map +1 -0
- package/methods.d.mts +10 -0
- package/methods.d.mts.map +1 -0
- package/methods.d.ts +10 -0
- package/methods.d.ts.map +1 -0
- package/methods.js +215 -0
- package/methods.js.map +1 -0
- package/methods.mjs +211 -0
- package/methods.mjs.map +1 -0
- package/options.d.mts +9 -9
- package/options.d.mts.map +1 -1
- package/options.d.ts +9 -9
- package/options.d.ts.map +1 -1
- package/options.js +54 -359
- package/options.js.map +1 -1
- package/options.mjs +54 -359
- package/options.mjs.map +1 -1
- package/package.json +67 -60
- package/server.d.mts +11 -16
- package/server.d.mts.map +1 -1
- package/server.d.ts +11 -16
- package/server.d.ts.map +1 -1
- package/server.js +86 -101
- package/server.js.map +1 -1
- package/server.mjs +85 -96
- package/server.mjs.map +1 -1
- package/src/{headers.ts → auth.ts} +18 -1
- package/src/code-tool-paths.cts +3 -1
- package/src/code-tool-types.ts +8 -9
- package/src/code-tool-worker.ts +110 -47
- package/src/code-tool.ts +362 -134
- package/src/docs-search-tool.ts +54 -6
- package/src/http.ts +128 -54
- package/src/index.ts +22 -63
- package/src/instructions.ts +60 -0
- package/src/logger.ts +28 -0
- package/src/methods.ts +236 -0
- package/src/options.ts +72 -384
- package/src/server.ts +99 -116
- package/src/stdio.ts +6 -5
- package/src/{tools/types.ts → types.ts} +14 -5
- package/src/util.ts +25 -0
- package/stdio.d.mts +1 -1
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts +1 -1
- package/stdio.d.ts.map +1 -1
- package/stdio.js +5 -4
- package/stdio.js.map +1 -1
- package/stdio.mjs +5 -4
- package/stdio.mjs.map +1 -1
- package/{tools/types.d.mts → types.d.mts} +10 -2
- package/types.d.mts.map +1 -0
- package/{tools/types.d.ts → types.d.ts} +10 -2
- package/types.d.ts.map +1 -0
- package/types.js.map +1 -0
- package/types.mjs.map +1 -0
- package/util.d.mts +4 -0
- package/util.d.mts.map +1 -0
- package/util.d.ts +4 -0
- package/util.d.ts.map +1 -0
- package/util.js +30 -0
- package/util.js.map +1 -0
- package/util.mjs +24 -0
- package/util.mjs.map +1 -0
- package/compat.d.mts +0 -58
- package/compat.d.mts.map +0 -1
- package/compat.d.ts +0 -58
- package/compat.d.ts.map +0 -1
- package/compat.js +0 -387
- package/compat.js.map +0 -1
- package/compat.mjs +0 -378
- package/compat.mjs.map +0 -1
- package/dynamic-tools.d.mts +0 -12
- package/dynamic-tools.d.mts.map +0 -1
- package/dynamic-tools.d.ts +0 -12
- package/dynamic-tools.d.ts.map +0 -1
- package/dynamic-tools.js +0 -135
- package/dynamic-tools.js.map +0 -1
- package/dynamic-tools.mjs +0 -132
- package/dynamic-tools.mjs.map +0 -1
- package/filtering.d.mts +0 -3
- package/filtering.d.mts.map +0 -1
- package/filtering.d.ts +0 -3
- package/filtering.d.ts.map +0 -1
- package/filtering.js +0 -24
- package/filtering.js.map +0 -1
- package/filtering.mjs +0 -16
- package/filtering.mjs.map +0 -1
- package/headers.d.mts +0 -4
- package/headers.d.mts.map +0 -1
- package/headers.d.ts +0 -4
- package/headers.d.ts.map +0 -1
- package/headers.js +0 -22
- package/headers.js.map +0 -1
- package/headers.mjs.map +0 -1
- package/src/compat.ts +0 -483
- package/src/dynamic-tools.ts +0 -153
- package/src/filtering.ts +0 -18
- package/src/tools/analytics/retrieve-analytics.ts +0 -441
- package/src/tools/domains/create-domains.ts +0 -75
- package/src/tools/domains/delete-domains.ts +0 -55
- package/src/tools/domains/list-domains.ts +0 -68
- package/src/tools/domains/update-domains.ts +0 -79
- package/src/tools/events/list-events.ts +0 -421
- package/src/tools/index.ts +0 -133
- package/src/tools/links/bulk/create-links-bulk.ts +0 -966
- package/src/tools/links/bulk/delete-links-bulk.ts +0 -59
- package/src/tools/links/count-links.ts +0 -957
- package/src/tools/links/create-links.ts +0 -957
- package/src/tools/links/delete-links.ts +0 -56
- package/src/tools/links/list-links.ts +0 -980
- package/src/tools/links/retrieve-info-links.ts +0 -75
- package/src/tools/links/update-links.ts +0 -964
- package/src/tools/links/upsert-links.ts +0 -958
- package/src/tools/projects/list-projects.ts +0 -51
- package/src/tools/projects/retrieve-projects.ts +0 -56
- package/src/tools/qrcodes/bulk/create-qrcodes-bulk.ts +0 -1077
- package/src/tools/qrcodes/bulk/delete-qrcodes-bulk.ts +0 -59
- package/src/tools/qrcodes/count-qrcodes.ts +0 -220
- package/src/tools/qrcodes/create-qrcodes.ts +0 -1067
- package/src/tools/qrcodes/delete-qrcodes.ts +0 -56
- package/src/tools/qrcodes/list-qrcodes.ts +0 -221
- package/src/tools/qrcodes/retrieve-qrcodes.ts +0 -67
- package/src/tools/qrcodes/update-qrcodes.ts +0 -1074
- package/src/tools/qrcodes/upsert-qrcodes.ts +0 -1068
- package/src/tools/tags/create-tags.ts +0 -59
- package/src/tools/tags/delete-tags.ts +0 -55
- package/src/tools/tags/list-tags.ts +0 -87
- package/src/tools/tags/update-tags.ts +0 -63
- package/src/tools/track/track-lead-track.ts +0 -93
- package/src/tools/track/track-sale-track.ts +0 -108
- package/src/tools.ts +0 -1
- package/tools/analytics/retrieve-analytics.d.mts +0 -45
- package/tools/analytics/retrieve-analytics.d.mts.map +0 -1
- package/tools/analytics/retrieve-analytics.d.ts +0 -45
- package/tools/analytics/retrieve-analytics.d.ts.map +0 -1
- package/tools/analytics/retrieve-analytics.js +0 -438
- package/tools/analytics/retrieve-analytics.js.map +0 -1
- package/tools/analytics/retrieve-analytics.mjs +0 -431
- package/tools/analytics/retrieve-analytics.mjs.map +0 -1
- package/tools/domains/create-domains.d.mts +0 -45
- package/tools/domains/create-domains.d.mts.map +0 -1
- package/tools/domains/create-domains.d.ts +0 -45
- package/tools/domains/create-domains.d.ts.map +0 -1
- package/tools/domains/create-domains.js +0 -74
- package/tools/domains/create-domains.js.map +0 -1
- package/tools/domains/create-domains.mjs +0 -67
- package/tools/domains/create-domains.mjs.map +0 -1
- package/tools/domains/delete-domains.d.mts +0 -45
- package/tools/domains/delete-domains.d.mts.map +0 -1
- package/tools/domains/delete-domains.d.ts +0 -45
- package/tools/domains/delete-domains.d.ts.map +0 -1
- package/tools/domains/delete-domains.js +0 -55
- package/tools/domains/delete-domains.js.map +0 -1
- package/tools/domains/delete-domains.mjs +0 -48
- package/tools/domains/delete-domains.mjs.map +0 -1
- package/tools/domains/list-domains.d.mts +0 -45
- package/tools/domains/list-domains.d.mts.map +0 -1
- package/tools/domains/list-domains.d.ts +0 -45
- package/tools/domains/list-domains.d.ts.map +0 -1
- package/tools/domains/list-domains.js +0 -67
- package/tools/domains/list-domains.js.map +0 -1
- package/tools/domains/list-domains.mjs +0 -60
- package/tools/domains/list-domains.mjs.map +0 -1
- package/tools/domains/update-domains.d.mts +0 -45
- package/tools/domains/update-domains.d.mts.map +0 -1
- package/tools/domains/update-domains.d.ts +0 -45
- package/tools/domains/update-domains.d.ts.map +0 -1
- package/tools/domains/update-domains.js +0 -78
- package/tools/domains/update-domains.js.map +0 -1
- package/tools/domains/update-domains.mjs +0 -71
- package/tools/domains/update-domains.mjs.map +0 -1
- package/tools/events/list-events.d.mts +0 -45
- package/tools/events/list-events.d.mts.map +0 -1
- package/tools/events/list-events.d.ts +0 -45
- package/tools/events/list-events.d.ts.map +0 -1
- package/tools/events/list-events.js +0 -418
- package/tools/events/list-events.js.map +0 -1
- package/tools/events/list-events.mjs +0 -411
- package/tools/events/list-events.mjs.map +0 -1
- package/tools/index.d.mts +0 -10
- package/tools/index.d.mts.map +0 -1
- package/tools/index.d.ts +0 -10
- package/tools/index.d.ts.map +0 -1
- package/tools/index.js +0 -117
- package/tools/index.js.map +0 -1
- package/tools/index.mjs +0 -110
- package/tools/index.mjs.map +0 -1
- package/tools/links/bulk/create-links-bulk.d.mts +0 -45
- package/tools/links/bulk/create-links-bulk.d.mts.map +0 -1
- package/tools/links/bulk/create-links-bulk.d.ts +0 -45
- package/tools/links/bulk/create-links-bulk.d.ts.map +0 -1
- package/tools/links/bulk/create-links-bulk.js +0 -956
- package/tools/links/bulk/create-links-bulk.js.map +0 -1
- package/tools/links/bulk/create-links-bulk.mjs +0 -949
- package/tools/links/bulk/create-links-bulk.mjs.map +0 -1
- package/tools/links/bulk/delete-links-bulk.d.mts +0 -45
- package/tools/links/bulk/delete-links-bulk.d.mts.map +0 -1
- package/tools/links/bulk/delete-links-bulk.d.ts +0 -45
- package/tools/links/bulk/delete-links-bulk.d.ts.map +0 -1
- package/tools/links/bulk/delete-links-bulk.js +0 -58
- package/tools/links/bulk/delete-links-bulk.js.map +0 -1
- package/tools/links/bulk/delete-links-bulk.mjs +0 -51
- package/tools/links/bulk/delete-links-bulk.mjs.map +0 -1
- package/tools/links/count-links.d.mts +0 -45
- package/tools/links/count-links.d.mts.map +0 -1
- package/tools/links/count-links.d.ts +0 -45
- package/tools/links/count-links.d.ts.map +0 -1
- package/tools/links/count-links.js +0 -951
- package/tools/links/count-links.js.map +0 -1
- package/tools/links/count-links.mjs +0 -944
- package/tools/links/count-links.mjs.map +0 -1
- package/tools/links/create-links.d.mts +0 -45
- package/tools/links/create-links.d.mts.map +0 -1
- package/tools/links/create-links.d.ts +0 -45
- package/tools/links/create-links.d.ts.map +0 -1
- package/tools/links/create-links.js +0 -947
- package/tools/links/create-links.js.map +0 -1
- package/tools/links/create-links.mjs +0 -940
- package/tools/links/create-links.mjs.map +0 -1
- package/tools/links/delete-links.d.mts +0 -45
- package/tools/links/delete-links.d.mts.map +0 -1
- package/tools/links/delete-links.d.ts +0 -45
- package/tools/links/delete-links.d.ts.map +0 -1
- package/tools/links/delete-links.js +0 -55
- package/tools/links/delete-links.js.map +0 -1
- package/tools/links/delete-links.mjs +0 -48
- package/tools/links/delete-links.mjs.map +0 -1
- package/tools/links/list-links.d.mts +0 -45
- package/tools/links/list-links.d.mts.map +0 -1
- package/tools/links/list-links.d.ts +0 -45
- package/tools/links/list-links.d.ts.map +0 -1
- package/tools/links/list-links.js +0 -973
- package/tools/links/list-links.js.map +0 -1
- package/tools/links/list-links.mjs +0 -966
- package/tools/links/list-links.mjs.map +0 -1
- package/tools/links/retrieve-info-links.d.mts +0 -45
- package/tools/links/retrieve-info-links.d.mts.map +0 -1
- package/tools/links/retrieve-info-links.d.ts +0 -45
- package/tools/links/retrieve-info-links.d.ts.map +0 -1
- package/tools/links/retrieve-info-links.js +0 -71
- package/tools/links/retrieve-info-links.js.map +0 -1
- package/tools/links/retrieve-info-links.mjs +0 -64
- package/tools/links/retrieve-info-links.mjs.map +0 -1
- package/tools/links/update-links.d.mts +0 -45
- package/tools/links/update-links.d.mts.map +0 -1
- package/tools/links/update-links.d.ts +0 -45
- package/tools/links/update-links.d.ts.map +0 -1
- package/tools/links/update-links.js +0 -953
- package/tools/links/update-links.js.map +0 -1
- package/tools/links/update-links.mjs +0 -946
- package/tools/links/update-links.mjs.map +0 -1
- package/tools/links/upsert-links.d.mts +0 -45
- package/tools/links/upsert-links.d.mts.map +0 -1
- package/tools/links/upsert-links.d.ts +0 -45
- package/tools/links/upsert-links.d.ts.map +0 -1
- package/tools/links/upsert-links.js +0 -947
- package/tools/links/upsert-links.js.map +0 -1
- package/tools/links/upsert-links.mjs +0 -940
- package/tools/links/upsert-links.mjs.map +0 -1
- package/tools/projects/list-projects.d.mts +0 -45
- package/tools/projects/list-projects.d.mts.map +0 -1
- package/tools/projects/list-projects.d.ts +0 -45
- package/tools/projects/list-projects.d.ts.map +0 -1
- package/tools/projects/list-projects.js +0 -51
- package/tools/projects/list-projects.js.map +0 -1
- package/tools/projects/list-projects.mjs +0 -44
- package/tools/projects/list-projects.mjs.map +0 -1
- package/tools/projects/retrieve-projects.d.mts +0 -45
- package/tools/projects/retrieve-projects.d.mts.map +0 -1
- package/tools/projects/retrieve-projects.d.ts +0 -45
- package/tools/projects/retrieve-projects.d.ts.map +0 -1
- package/tools/projects/retrieve-projects.js +0 -55
- package/tools/projects/retrieve-projects.js.map +0 -1
- package/tools/projects/retrieve-projects.mjs +0 -48
- package/tools/projects/retrieve-projects.mjs.map +0 -1
- package/tools/qrcodes/bulk/create-qrcodes-bulk.d.mts +0 -45
- package/tools/qrcodes/bulk/create-qrcodes-bulk.d.mts.map +0 -1
- package/tools/qrcodes/bulk/create-qrcodes-bulk.d.ts +0 -45
- package/tools/qrcodes/bulk/create-qrcodes-bulk.d.ts.map +0 -1
- package/tools/qrcodes/bulk/create-qrcodes-bulk.js +0 -1068
- package/tools/qrcodes/bulk/create-qrcodes-bulk.js.map +0 -1
- package/tools/qrcodes/bulk/create-qrcodes-bulk.mjs +0 -1061
- package/tools/qrcodes/bulk/create-qrcodes-bulk.mjs.map +0 -1
- package/tools/qrcodes/bulk/delete-qrcodes-bulk.d.mts +0 -45
- package/tools/qrcodes/bulk/delete-qrcodes-bulk.d.mts.map +0 -1
- package/tools/qrcodes/bulk/delete-qrcodes-bulk.d.ts +0 -45
- package/tools/qrcodes/bulk/delete-qrcodes-bulk.d.ts.map +0 -1
- package/tools/qrcodes/bulk/delete-qrcodes-bulk.js +0 -58
- package/tools/qrcodes/bulk/delete-qrcodes-bulk.js.map +0 -1
- package/tools/qrcodes/bulk/delete-qrcodes-bulk.mjs +0 -51
- package/tools/qrcodes/bulk/delete-qrcodes-bulk.mjs.map +0 -1
- package/tools/qrcodes/count-qrcodes.d.mts +0 -45
- package/tools/qrcodes/count-qrcodes.d.mts.map +0 -1
- package/tools/qrcodes/count-qrcodes.d.ts +0 -45
- package/tools/qrcodes/count-qrcodes.d.ts.map +0 -1
- package/tools/qrcodes/count-qrcodes.js +0 -215
- package/tools/qrcodes/count-qrcodes.js.map +0 -1
- package/tools/qrcodes/count-qrcodes.mjs +0 -208
- package/tools/qrcodes/count-qrcodes.mjs.map +0 -1
- package/tools/qrcodes/create-qrcodes.d.mts +0 -45
- package/tools/qrcodes/create-qrcodes.d.mts.map +0 -1
- package/tools/qrcodes/create-qrcodes.d.ts +0 -45
- package/tools/qrcodes/create-qrcodes.d.ts.map +0 -1
- package/tools/qrcodes/create-qrcodes.js +0 -1059
- package/tools/qrcodes/create-qrcodes.js.map +0 -1
- package/tools/qrcodes/create-qrcodes.mjs +0 -1052
- package/tools/qrcodes/create-qrcodes.mjs.map +0 -1
- package/tools/qrcodes/delete-qrcodes.d.mts +0 -45
- package/tools/qrcodes/delete-qrcodes.d.mts.map +0 -1
- package/tools/qrcodes/delete-qrcodes.d.ts +0 -45
- package/tools/qrcodes/delete-qrcodes.d.ts.map +0 -1
- package/tools/qrcodes/delete-qrcodes.js +0 -55
- package/tools/qrcodes/delete-qrcodes.js.map +0 -1
- package/tools/qrcodes/delete-qrcodes.mjs +0 -48
- package/tools/qrcodes/delete-qrcodes.mjs.map +0 -1
- package/tools/qrcodes/list-qrcodes.d.mts +0 -45
- package/tools/qrcodes/list-qrcodes.d.mts.map +0 -1
- package/tools/qrcodes/list-qrcodes.d.ts +0 -45
- package/tools/qrcodes/list-qrcodes.d.ts.map +0 -1
- package/tools/qrcodes/list-qrcodes.js +0 -217
- package/tools/qrcodes/list-qrcodes.js.map +0 -1
- package/tools/qrcodes/list-qrcodes.mjs +0 -210
- package/tools/qrcodes/list-qrcodes.mjs.map +0 -1
- package/tools/qrcodes/retrieve-qrcodes.d.mts +0 -45
- package/tools/qrcodes/retrieve-qrcodes.d.mts.map +0 -1
- package/tools/qrcodes/retrieve-qrcodes.d.ts +0 -45
- package/tools/qrcodes/retrieve-qrcodes.d.ts.map +0 -1
- package/tools/qrcodes/retrieve-qrcodes.js +0 -65
- package/tools/qrcodes/retrieve-qrcodes.js.map +0 -1
- package/tools/qrcodes/retrieve-qrcodes.mjs +0 -58
- package/tools/qrcodes/retrieve-qrcodes.mjs.map +0 -1
- package/tools/qrcodes/update-qrcodes.d.mts +0 -45
- package/tools/qrcodes/update-qrcodes.d.mts.map +0 -1
- package/tools/qrcodes/update-qrcodes.d.ts +0 -45
- package/tools/qrcodes/update-qrcodes.d.ts.map +0 -1
- package/tools/qrcodes/update-qrcodes.js +0 -1065
- package/tools/qrcodes/update-qrcodes.js.map +0 -1
- package/tools/qrcodes/update-qrcodes.mjs +0 -1058
- package/tools/qrcodes/update-qrcodes.mjs.map +0 -1
- package/tools/qrcodes/upsert-qrcodes.d.mts +0 -45
- package/tools/qrcodes/upsert-qrcodes.d.mts.map +0 -1
- package/tools/qrcodes/upsert-qrcodes.d.ts +0 -45
- package/tools/qrcodes/upsert-qrcodes.d.ts.map +0 -1
- package/tools/qrcodes/upsert-qrcodes.js +0 -1059
- package/tools/qrcodes/upsert-qrcodes.js.map +0 -1
- package/tools/qrcodes/upsert-qrcodes.mjs +0 -1052
- package/tools/qrcodes/upsert-qrcodes.mjs.map +0 -1
- package/tools/tags/create-tags.d.mts +0 -45
- package/tools/tags/create-tags.d.mts.map +0 -1
- package/tools/tags/create-tags.d.ts +0 -45
- package/tools/tags/create-tags.d.ts.map +0 -1
- package/tools/tags/create-tags.js +0 -58
- package/tools/tags/create-tags.js.map +0 -1
- package/tools/tags/create-tags.mjs +0 -51
- package/tools/tags/create-tags.mjs.map +0 -1
- package/tools/tags/delete-tags.d.mts +0 -45
- package/tools/tags/delete-tags.d.mts.map +0 -1
- package/tools/tags/delete-tags.d.ts +0 -45
- package/tools/tags/delete-tags.d.ts.map +0 -1
- package/tools/tags/delete-tags.js +0 -55
- package/tools/tags/delete-tags.js.map +0 -1
- package/tools/tags/delete-tags.mjs +0 -48
- package/tools/tags/delete-tags.mjs.map +0 -1
- package/tools/tags/list-tags.d.mts +0 -45
- package/tools/tags/list-tags.d.mts.map +0 -1
- package/tools/tags/list-tags.d.ts +0 -45
- package/tools/tags/list-tags.d.ts.map +0 -1
- package/tools/tags/list-tags.js +0 -87
- package/tools/tags/list-tags.js.map +0 -1
- package/tools/tags/list-tags.mjs +0 -80
- package/tools/tags/list-tags.mjs.map +0 -1
- package/tools/tags/update-tags.d.mts +0 -45
- package/tools/tags/update-tags.d.mts.map +0 -1
- package/tools/tags/update-tags.d.ts +0 -45
- package/tools/tags/update-tags.d.ts.map +0 -1
- package/tools/tags/update-tags.js +0 -63
- package/tools/tags/update-tags.js.map +0 -1
- package/tools/tags/update-tags.mjs +0 -56
- package/tools/tags/update-tags.mjs.map +0 -1
- package/tools/track/track-lead-track.d.mts +0 -45
- package/tools/track/track-lead-track.d.mts.map +0 -1
- package/tools/track/track-lead-track.d.ts +0 -45
- package/tools/track/track-lead-track.d.ts.map +0 -1
- package/tools/track/track-lead-track.js +0 -87
- package/tools/track/track-lead-track.js.map +0 -1
- package/tools/track/track-lead-track.mjs +0 -80
- package/tools/track/track-lead-track.mjs.map +0 -1
- package/tools/track/track-sale-track.d.mts +0 -45
- package/tools/track/track-sale-track.d.mts.map +0 -1
- package/tools/track/track-sale-track.d.ts +0 -45
- package/tools/track/track-sale-track.d.ts.map +0 -1
- package/tools/track/track-sale-track.js +0 -99
- package/tools/track/track-sale-track.js.map +0 -1
- package/tools/track/track-sale-track.mjs +0 -92
- package/tools/track/track-sale-track.mjs.map +0 -1
- package/tools/types.d.mts.map +0 -1
- package/tools/types.d.ts.map +0 -1
- package/tools/types.js.map +0 -1
- package/tools/types.mjs.map +0 -1
- package/tools.d.mts +0 -2
- package/tools.d.mts.map +0 -1
- package/tools.d.ts +0 -2
- package/tools.d.ts.map +0 -1
- package/tools.js +0 -18
- package/tools.js.map +0 -1
- package/tools.mjs +0 -2
- package/tools.mjs.map +0 -1
- /package/{tools/types.js → types.js} +0 -0
- /package/{tools/types.mjs → types.mjs} +0 -0
package/src/http.ts
CHANGED
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
|
|
4
4
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
5
|
-
|
|
5
|
+
import { ClientOptions } from '@codeqr/ts';
|
|
6
6
|
import express from 'express';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import pino from 'pino';
|
|
8
|
+
import pinoHttp from 'pino-http';
|
|
9
|
+
import { getStainlessApiKey, parseClientAuthHeaders } from './auth';
|
|
10
|
+
import { getLogger } from './logger';
|
|
11
|
+
import { McpOptions } from './options';
|
|
12
|
+
import { initMcpServer, newMcpServer } from './server';
|
|
11
13
|
|
|
12
|
-
const newServer = ({
|
|
14
|
+
const newServer = async ({
|
|
13
15
|
clientOptions,
|
|
14
|
-
mcpOptions
|
|
16
|
+
mcpOptions,
|
|
15
17
|
req,
|
|
16
18
|
res,
|
|
17
19
|
}: {
|
|
@@ -19,58 +21,75 @@ const newServer = ({
|
|
|
19
21
|
mcpOptions: McpOptions;
|
|
20
22
|
req: express.Request;
|
|
21
23
|
res: express.Response;
|
|
22
|
-
}): McpServer | null => {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
}): Promise<McpServer | null> => {
|
|
25
|
+
const stainlessApiKey = getStainlessApiKey(req, mcpOptions);
|
|
26
|
+
const server = await newMcpServer(stainlessApiKey);
|
|
27
|
+
|
|
28
|
+
const authOptions = parseClientAuthHeaders(req, false);
|
|
29
|
+
|
|
30
|
+
let upstreamClientEnvs: Record<string, string> | undefined;
|
|
31
|
+
const clientEnvsHeader = req.headers['x-stainless-mcp-client-envs'];
|
|
32
|
+
if (typeof clientEnvsHeader === 'string') {
|
|
33
|
+
try {
|
|
34
|
+
const parsed = JSON.parse(clientEnvsHeader);
|
|
35
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
36
|
+
upstreamClientEnvs = parsed;
|
|
37
|
+
}
|
|
38
|
+
} catch {
|
|
39
|
+
// Ignore malformed header
|
|
40
|
+
}
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
// Parse x-stainless-mcp-client-permissions header to override permission options
|
|
44
|
+
//
|
|
45
|
+
// Note: Permissions are best-effort and intended to prevent clients from doing unexpected things;
|
|
46
|
+
// they're not a hard security boundary, so we allow arbitrary, client-driven overrides.
|
|
47
|
+
//
|
|
48
|
+
// See the Stainless MCP documentation for more details.
|
|
49
|
+
let effectiveMcpOptions = mcpOptions;
|
|
50
|
+
const clientPermissionsHeader = req.headers['x-stainless-mcp-client-permissions'];
|
|
51
|
+
if (typeof clientPermissionsHeader === 'string') {
|
|
52
|
+
try {
|
|
53
|
+
const parsed = JSON.parse(clientPermissionsHeader);
|
|
54
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
55
|
+
effectiveMcpOptions = {
|
|
56
|
+
...mcpOptions,
|
|
57
|
+
...(typeof parsed.allow_http_gets === 'boolean' && { codeAllowHttpGets: parsed.allow_http_gets }),
|
|
58
|
+
...(Array.isArray(parsed.allowed_methods) && { codeAllowedMethods: parsed.allowed_methods }),
|
|
59
|
+
...(Array.isArray(parsed.blocked_methods) && { codeBlockedMethods: parsed.blocked_methods }),
|
|
60
|
+
};
|
|
61
|
+
getLogger().info(
|
|
62
|
+
{ clientPermissions: parsed },
|
|
63
|
+
'Overriding code execution permissions from x-stainless-mcp-client-permissions header',
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
} catch (error) {
|
|
67
|
+
getLogger().warn({ error }, 'Failed to parse x-stainless-mcp-client-permissions header');
|
|
68
|
+
}
|
|
58
69
|
}
|
|
59
70
|
|
|
71
|
+
await initMcpServer({
|
|
72
|
+
server: server,
|
|
73
|
+
mcpOptions: effectiveMcpOptions,
|
|
74
|
+
clientOptions: {
|
|
75
|
+
...clientOptions,
|
|
76
|
+
...authOptions,
|
|
77
|
+
},
|
|
78
|
+
stainlessApiKey: stainlessApiKey,
|
|
79
|
+
upstreamClientEnvs,
|
|
80
|
+
});
|
|
81
|
+
|
|
60
82
|
return server;
|
|
61
83
|
};
|
|
62
84
|
|
|
63
85
|
const post =
|
|
64
86
|
(options: { clientOptions: ClientOptions; mcpOptions: McpOptions }) =>
|
|
65
87
|
async (req: express.Request, res: express.Response) => {
|
|
66
|
-
const server = newServer({ ...options, req, res });
|
|
88
|
+
const server = await newServer({ ...options, req, res });
|
|
67
89
|
// If we return null, we already set the authorization error.
|
|
68
90
|
if (server === null) return;
|
|
69
|
-
const transport = new StreamableHTTPServerTransport(
|
|
70
|
-
|
|
71
|
-
sessionIdGenerator: undefined,
|
|
72
|
-
});
|
|
73
|
-
await server.connect(transport);
|
|
91
|
+
const transport = new StreamableHTTPServerTransport();
|
|
92
|
+
await server.connect(transport as any);
|
|
74
93
|
await transport.handleRequest(req, res, req.body);
|
|
75
94
|
};
|
|
76
95
|
|
|
@@ -94,17 +113,64 @@ const del = async (req: express.Request, res: express.Response) => {
|
|
|
94
113
|
});
|
|
95
114
|
};
|
|
96
115
|
|
|
116
|
+
const redactHeaders = (headers: Record<string, any>) => {
|
|
117
|
+
const hiddenHeaders = /auth|cookie|key|token|x-stainless-mcp-client-envs/i;
|
|
118
|
+
const filtered = { ...headers };
|
|
119
|
+
Object.keys(filtered).forEach((key) => {
|
|
120
|
+
if (hiddenHeaders.test(key)) {
|
|
121
|
+
filtered[key] = '[REDACTED]';
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
return filtered;
|
|
125
|
+
};
|
|
126
|
+
|
|
97
127
|
export const streamableHTTPApp = ({
|
|
98
128
|
clientOptions = {},
|
|
99
|
-
mcpOptions
|
|
129
|
+
mcpOptions,
|
|
100
130
|
}: {
|
|
101
131
|
clientOptions?: ClientOptions;
|
|
102
|
-
mcpOptions
|
|
132
|
+
mcpOptions: McpOptions;
|
|
103
133
|
}): express.Express => {
|
|
104
134
|
const app = express();
|
|
105
135
|
app.set('query parser', 'extended');
|
|
106
136
|
app.use(express.json());
|
|
137
|
+
app.use(
|
|
138
|
+
pinoHttp({
|
|
139
|
+
logger: getLogger(),
|
|
140
|
+
customLogLevel: (req, res) => {
|
|
141
|
+
if (res.statusCode >= 500) {
|
|
142
|
+
return 'error';
|
|
143
|
+
} else if (res.statusCode >= 400) {
|
|
144
|
+
return 'warn';
|
|
145
|
+
}
|
|
146
|
+
return 'info';
|
|
147
|
+
},
|
|
148
|
+
customSuccessMessage: function (req, res) {
|
|
149
|
+
return `Request ${req.method} to ${req.url} completed with status ${res.statusCode}`;
|
|
150
|
+
},
|
|
151
|
+
customErrorMessage: function (req, res, err) {
|
|
152
|
+
return `Request ${req.method} to ${req.url} errored with status ${res.statusCode}`;
|
|
153
|
+
},
|
|
154
|
+
serializers: {
|
|
155
|
+
req: pino.stdSerializers.wrapRequestSerializer((req) => {
|
|
156
|
+
return {
|
|
157
|
+
...req,
|
|
158
|
+
headers: redactHeaders(req.raw.headers),
|
|
159
|
+
};
|
|
160
|
+
}),
|
|
161
|
+
res: pino.stdSerializers.wrapResponseSerializer((res) => {
|
|
162
|
+
return {
|
|
163
|
+
...res,
|
|
164
|
+
headers: redactHeaders(res.headers),
|
|
165
|
+
};
|
|
166
|
+
}),
|
|
167
|
+
},
|
|
168
|
+
}),
|
|
169
|
+
);
|
|
107
170
|
|
|
171
|
+
app.get('/health', async (req: express.Request, res: express.Response) => {
|
|
172
|
+
res.status(200).send('OK');
|
|
173
|
+
});
|
|
108
174
|
app.get('/', get);
|
|
109
175
|
app.post('/', post({ clientOptions, mcpOptions }));
|
|
110
176
|
app.delete('/', del);
|
|
@@ -112,16 +178,24 @@ export const streamableHTTPApp = ({
|
|
|
112
178
|
return app;
|
|
113
179
|
};
|
|
114
180
|
|
|
115
|
-
export const launchStreamableHTTPServer = async (
|
|
116
|
-
|
|
181
|
+
export const launchStreamableHTTPServer = async ({
|
|
182
|
+
mcpOptions,
|
|
183
|
+
port,
|
|
184
|
+
}: {
|
|
185
|
+
mcpOptions: McpOptions;
|
|
186
|
+
port: number | string | undefined;
|
|
187
|
+
}) => {
|
|
188
|
+
const app = streamableHTTPApp({ mcpOptions });
|
|
117
189
|
const server = app.listen(port);
|
|
118
190
|
const address = server.address();
|
|
119
191
|
|
|
192
|
+
const logger = getLogger();
|
|
193
|
+
|
|
120
194
|
if (typeof address === 'string') {
|
|
121
|
-
|
|
195
|
+
logger.info(`MCP Server running on streamable HTTP at ${address}`);
|
|
122
196
|
} else if (address !== null) {
|
|
123
|
-
|
|
197
|
+
logger.info(`MCP Server running on streamable HTTP on port ${address.port}`);
|
|
124
198
|
} else {
|
|
125
|
-
|
|
199
|
+
logger.info(`MCP Server running on streamable HTTP on port ${port}`);
|
|
126
200
|
}
|
|
127
201
|
};
|
package/src/index.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { selectTools } from './server';
|
|
4
|
-
import { Endpoint, endpoints } from './tools';
|
|
5
4
|
import { McpOptions, parseCLIOptions } from './options';
|
|
6
5
|
import { launchStdioServer } from './stdio';
|
|
7
6
|
import { launchStreamableHTTPServer } from './http';
|
|
7
|
+
import type { McpTool } from './types';
|
|
8
|
+
import { configureLogger, getLogger } from './logger';
|
|
8
9
|
|
|
9
10
|
async function main() {
|
|
10
11
|
const options = parseOptionsOrError();
|
|
12
|
+
configureLogger({
|
|
13
|
+
level: options.debug ? 'debug' : 'info',
|
|
14
|
+
pretty: options.logFormat === 'pretty',
|
|
15
|
+
});
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
listAllTools();
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const selectedTools = await selectToolsOrError(endpoints, options);
|
|
17
|
+
const selectedTools = await selectToolsOrError(options);
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
selectedTools.
|
|
19
|
+
getLogger().info(
|
|
20
|
+
{ tools: selectedTools.map((e) => e.tool.name) },
|
|
21
|
+
`MCP Server starting with ${selectedTools.length} tools`,
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
switch (options.transport) {
|
|
@@ -26,14 +26,18 @@ async function main() {
|
|
|
26
26
|
await launchStdioServer(options);
|
|
27
27
|
break;
|
|
28
28
|
case 'http':
|
|
29
|
-
await launchStreamableHTTPServer(
|
|
29
|
+
await launchStreamableHTTPServer({
|
|
30
|
+
mcpOptions: options,
|
|
31
|
+
port: options.socket ?? options.port,
|
|
32
|
+
});
|
|
30
33
|
break;
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
if (require.main === module) {
|
|
35
38
|
main().catch((error) => {
|
|
36
|
-
|
|
39
|
+
// Logger might not be initialized yet
|
|
40
|
+
console.error('Fatal error in main()', error);
|
|
37
41
|
process.exit(1);
|
|
38
42
|
});
|
|
39
43
|
}
|
|
@@ -42,67 +46,22 @@ function parseOptionsOrError() {
|
|
|
42
46
|
try {
|
|
43
47
|
return parseCLIOptions();
|
|
44
48
|
} catch (error) {
|
|
45
|
-
|
|
49
|
+
// Logger is initialized after options, so use console.error here
|
|
50
|
+
console.error('Error parsing options', error);
|
|
46
51
|
process.exit(1);
|
|
47
52
|
}
|
|
48
53
|
}
|
|
49
54
|
|
|
50
|
-
async function selectToolsOrError(
|
|
55
|
+
async function selectToolsOrError(options: McpOptions): Promise<McpTool[]> {
|
|
51
56
|
try {
|
|
52
|
-
const includedTools =
|
|
57
|
+
const includedTools = selectTools(options);
|
|
53
58
|
if (includedTools.length === 0) {
|
|
54
|
-
|
|
59
|
+
getLogger().error('No tools match the provided filters');
|
|
55
60
|
process.exit(1);
|
|
56
61
|
}
|
|
57
62
|
return includedTools;
|
|
58
63
|
} catch (error) {
|
|
59
|
-
|
|
60
|
-
console.error('Error filtering tools:', error.message);
|
|
61
|
-
} else {
|
|
62
|
-
console.error('Error filtering tools:', error);
|
|
63
|
-
}
|
|
64
|
+
getLogger().error({ error }, 'Error filtering tools');
|
|
64
65
|
process.exit(1);
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
-
function listAllTools() {
|
|
69
|
-
if (endpoints.length === 0) {
|
|
70
|
-
console.log('No tools available.');
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
console.log('Available tools:\n');
|
|
74
|
-
|
|
75
|
-
// Group endpoints by resource
|
|
76
|
-
const resourceGroups = new Map<string, typeof endpoints>();
|
|
77
|
-
|
|
78
|
-
for (const endpoint of endpoints) {
|
|
79
|
-
const resource = endpoint.metadata.resource;
|
|
80
|
-
if (!resourceGroups.has(resource)) {
|
|
81
|
-
resourceGroups.set(resource, []);
|
|
82
|
-
}
|
|
83
|
-
resourceGroups.get(resource)!.push(endpoint);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Sort resources alphabetically
|
|
87
|
-
const sortedResources = Array.from(resourceGroups.keys()).sort();
|
|
88
|
-
|
|
89
|
-
// Display hierarchically by resource
|
|
90
|
-
for (const resource of sortedResources) {
|
|
91
|
-
console.log(`Resource: ${resource}`);
|
|
92
|
-
|
|
93
|
-
const resourceEndpoints = resourceGroups.get(resource)!;
|
|
94
|
-
// Sort endpoints by tool name
|
|
95
|
-
resourceEndpoints.sort((a, b) => a.tool.name.localeCompare(b.tool.name));
|
|
96
|
-
|
|
97
|
-
for (const endpoint of resourceEndpoints) {
|
|
98
|
-
const {
|
|
99
|
-
tool,
|
|
100
|
-
metadata: { operation, tags },
|
|
101
|
-
} = endpoint;
|
|
102
|
-
|
|
103
|
-
console.log(` - ${tool.name} (${operation}) ${tags.length > 0 ? `tags: ${tags.join(', ')}` : ''}`);
|
|
104
|
-
console.log(` Description: ${tool.description}`);
|
|
105
|
-
}
|
|
106
|
-
console.log('');
|
|
107
|
-
}
|
|
108
|
-
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { readEnv } from './util';
|
|
4
|
+
import { getLogger } from './logger';
|
|
5
|
+
|
|
6
|
+
const INSTRUCTIONS_CACHE_TTL_MS = 15 * 60 * 1000; // 15 minutes
|
|
7
|
+
|
|
8
|
+
interface InstructionsCacheEntry {
|
|
9
|
+
fetchedInstructions: string;
|
|
10
|
+
fetchedAt: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const instructionsCache = new Map<string, InstructionsCacheEntry>();
|
|
14
|
+
|
|
15
|
+
export async function getInstructions(stainlessApiKey: string | undefined): Promise<string> {
|
|
16
|
+
const now = Date.now();
|
|
17
|
+
const cacheKey = stainlessApiKey ?? '';
|
|
18
|
+
const cached = instructionsCache.get(cacheKey);
|
|
19
|
+
|
|
20
|
+
if (cached && now - cached.fetchedAt <= INSTRUCTIONS_CACHE_TTL_MS) {
|
|
21
|
+
return cached.fetchedInstructions;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Evict stale entries so the cache doesn't grow unboundedly.
|
|
25
|
+
for (const [key, entry] of instructionsCache) {
|
|
26
|
+
if (now - entry.fetchedAt > INSTRUCTIONS_CACHE_TTL_MS) {
|
|
27
|
+
instructionsCache.delete(key);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const fetchedInstructions = await fetchLatestInstructions(stainlessApiKey);
|
|
32
|
+
instructionsCache.set(cacheKey, { fetchedInstructions, fetchedAt: now });
|
|
33
|
+
return fetchedInstructions;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function fetchLatestInstructions(stainlessApiKey: string | undefined): Promise<string> {
|
|
37
|
+
// Setting the stainless API key is optional, but may be required
|
|
38
|
+
// to authenticate requests to the Stainless API.
|
|
39
|
+
const response = await fetch(
|
|
40
|
+
readEnv('CODE_MODE_INSTRUCTIONS_URL') ?? 'https://api.stainless.com/api/ai/instructions/codeqr',
|
|
41
|
+
{
|
|
42
|
+
method: 'GET',
|
|
43
|
+
headers: { ...(stainlessApiKey && { Authorization: stainlessApiKey }) },
|
|
44
|
+
},
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
let instructions: string | undefined;
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
getLogger().warn(
|
|
50
|
+
'Warning: failed to retrieve MCP server instructions. Proceeding with default instructions...',
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
instructions =
|
|
54
|
+
'\n This is the codeqr MCP server.\n\n Available tools:\n - search_docs: Search SDK documentation to find the right methods and parameters.\n - execute: Run TypeScript code against a pre-authenticated SDK client. Define an async run(client) function.\n\n Workflow:\n - If unsure about the API, call search_docs first.\n - Write complete solutions in a single execute call when possible. For large datasets, use API filters to narrow results or paginate within a single execute block.\n - If execute returns an error, read the error and fix your code rather than retrying the same approach.\n - Variables do not persist between execute calls. Return or log all data you need.\n - Individual HTTP requests to the API have a 30-second timeout. If a request times out, try a smaller query or add filters.\n - Code execution has a total timeout of approximately 5 minutes. If your code times out, simplify it or break it into smaller steps.\n ';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
instructions ??= ((await response.json()) as { instructions: string }).instructions;
|
|
58
|
+
|
|
59
|
+
return instructions;
|
|
60
|
+
}
|
package/src/logger.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { pino, type Level, type Logger } from 'pino';
|
|
4
|
+
import pretty from 'pino-pretty';
|
|
5
|
+
|
|
6
|
+
let _logger: Logger | undefined;
|
|
7
|
+
|
|
8
|
+
export function configureLogger({ level, pretty: usePretty }: { level: Level; pretty: boolean }): void {
|
|
9
|
+
_logger = pino(
|
|
10
|
+
{
|
|
11
|
+
level,
|
|
12
|
+
timestamp: pino.stdTimeFunctions.isoTime,
|
|
13
|
+
formatters: {
|
|
14
|
+
level(label) {
|
|
15
|
+
return { level: label };
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
usePretty ? pretty({ colorize: true, levelFirst: true, destination: 2 }) : process.stderr,
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getLogger(): Logger {
|
|
24
|
+
if (!_logger) {
|
|
25
|
+
throw new Error('Logger has not been configured. Call configureLogger() before using the logger.');
|
|
26
|
+
}
|
|
27
|
+
return _logger;
|
|
28
|
+
}
|
package/src/methods.ts
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { McpOptions } from './options';
|
|
4
|
+
|
|
5
|
+
export type SdkMethod = {
|
|
6
|
+
clientCallName: string;
|
|
7
|
+
fullyQualifiedName: string;
|
|
8
|
+
httpMethod?: 'get' | 'post' | 'put' | 'patch' | 'delete' | 'query';
|
|
9
|
+
httpPath?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const sdkMethods: SdkMethod[] = [
|
|
13
|
+
{
|
|
14
|
+
clientCallName: 'client.links.create',
|
|
15
|
+
fullyQualifiedName: 'links.create',
|
|
16
|
+
httpMethod: 'post',
|
|
17
|
+
httpPath: '/links',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
clientCallName: 'client.links.update',
|
|
21
|
+
fullyQualifiedName: 'links.update',
|
|
22
|
+
httpMethod: 'put',
|
|
23
|
+
httpPath: '/links/{linkId}',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
clientCallName: 'client.links.list',
|
|
27
|
+
fullyQualifiedName: 'links.list',
|
|
28
|
+
httpMethod: 'get',
|
|
29
|
+
httpPath: '/links',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
clientCallName: 'client.links.delete',
|
|
33
|
+
fullyQualifiedName: 'links.delete',
|
|
34
|
+
httpMethod: 'delete',
|
|
35
|
+
httpPath: '/links/{linkId}',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
clientCallName: 'client.links.retrieveInfo',
|
|
39
|
+
fullyQualifiedName: 'links.retrieveInfo',
|
|
40
|
+
httpMethod: 'get',
|
|
41
|
+
httpPath: '/links/info',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
clientCallName: 'client.links.bulk.create',
|
|
45
|
+
fullyQualifiedName: 'links.bulk.create',
|
|
46
|
+
httpMethod: 'post',
|
|
47
|
+
httpPath: '/links/bulk',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
clientCallName: 'client.qrcodes.create',
|
|
51
|
+
fullyQualifiedName: 'qrcodes.create',
|
|
52
|
+
httpMethod: 'post',
|
|
53
|
+
httpPath: '/qrcodes',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
clientCallName: 'client.qrcodes.retrieve',
|
|
57
|
+
fullyQualifiedName: 'qrcodes.retrieve',
|
|
58
|
+
httpMethod: 'get',
|
|
59
|
+
httpPath: '/qrcodes/info',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
clientCallName: 'client.qrcodes.update',
|
|
63
|
+
fullyQualifiedName: 'qrcodes.update',
|
|
64
|
+
httpMethod: 'put',
|
|
65
|
+
httpPath: '/qrcodes/{qrcodeId}',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
clientCallName: 'client.qrcodes.list',
|
|
69
|
+
fullyQualifiedName: 'qrcodes.list',
|
|
70
|
+
httpMethod: 'get',
|
|
71
|
+
httpPath: '/qrcodes',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
clientCallName: 'client.qrcodes.delete',
|
|
75
|
+
fullyQualifiedName: 'qrcodes.delete',
|
|
76
|
+
httpMethod: 'delete',
|
|
77
|
+
httpPath: '/qrcodes/{qrcodeId}',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
clientCallName: 'client.qrcodes.bulk.create',
|
|
81
|
+
fullyQualifiedName: 'qrcodes.bulk.create',
|
|
82
|
+
httpMethod: 'post',
|
|
83
|
+
httpPath: '/qrcodes/bulk',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
clientCallName: 'client.analytics.retrieve',
|
|
87
|
+
fullyQualifiedName: 'analytics.retrieve',
|
|
88
|
+
httpMethod: 'get',
|
|
89
|
+
httpPath: '/analytics',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
clientCallName: 'client.events.list',
|
|
93
|
+
fullyQualifiedName: 'events.list',
|
|
94
|
+
httpMethod: 'get',
|
|
95
|
+
httpPath: '/events',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
clientCallName: 'client.tags.create',
|
|
99
|
+
fullyQualifiedName: 'tags.create',
|
|
100
|
+
httpMethod: 'post',
|
|
101
|
+
httpPath: '/tags',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
clientCallName: 'client.tags.update',
|
|
105
|
+
fullyQualifiedName: 'tags.update',
|
|
106
|
+
httpMethod: 'put',
|
|
107
|
+
httpPath: '/tags/{id}',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
clientCallName: 'client.tags.list',
|
|
111
|
+
fullyQualifiedName: 'tags.list',
|
|
112
|
+
httpMethod: 'get',
|
|
113
|
+
httpPath: '/tags',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
clientCallName: 'client.tags.delete',
|
|
117
|
+
fullyQualifiedName: 'tags.delete',
|
|
118
|
+
httpMethod: 'delete',
|
|
119
|
+
httpPath: '/tags/{id}',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
clientCallName: 'client.domains.create',
|
|
123
|
+
fullyQualifiedName: 'domains.create',
|
|
124
|
+
httpMethod: 'post',
|
|
125
|
+
httpPath: '/domains',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
clientCallName: 'client.domains.update',
|
|
129
|
+
fullyQualifiedName: 'domains.update',
|
|
130
|
+
httpMethod: 'patch',
|
|
131
|
+
httpPath: '/domains/{slug}',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
clientCallName: 'client.domains.list',
|
|
135
|
+
fullyQualifiedName: 'domains.list',
|
|
136
|
+
httpMethod: 'get',
|
|
137
|
+
httpPath: '/domains',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
clientCallName: 'client.domains.delete',
|
|
141
|
+
fullyQualifiedName: 'domains.delete',
|
|
142
|
+
httpMethod: 'delete',
|
|
143
|
+
httpPath: '/domains/{slug}',
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
clientCallName: 'client.track.trackLead',
|
|
147
|
+
fullyQualifiedName: 'track.trackLead',
|
|
148
|
+
httpMethod: 'post',
|
|
149
|
+
httpPath: '/track/lead',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
clientCallName: 'client.track.trackSale',
|
|
153
|
+
fullyQualifiedName: 'track.trackSale',
|
|
154
|
+
httpMethod: 'post',
|
|
155
|
+
httpPath: '/track/sale',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
clientCallName: 'client.projects.list',
|
|
159
|
+
fullyQualifiedName: 'projects.list',
|
|
160
|
+
httpMethod: 'get',
|
|
161
|
+
httpPath: '/projects',
|
|
162
|
+
},
|
|
163
|
+
];
|
|
164
|
+
|
|
165
|
+
function allowedMethodsForCodeTool(options: McpOptions | undefined): SdkMethod[] | undefined {
|
|
166
|
+
if (!options) {
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
let allowedMethods: SdkMethod[];
|
|
171
|
+
|
|
172
|
+
if (options.codeAllowHttpGets || options.codeAllowedMethods) {
|
|
173
|
+
// Start with nothing allowed and then add into it from options
|
|
174
|
+
let allowedMethodsSet = new Set<SdkMethod>();
|
|
175
|
+
|
|
176
|
+
if (options.codeAllowHttpGets) {
|
|
177
|
+
// Add all methods that map to an HTTP GET
|
|
178
|
+
sdkMethods
|
|
179
|
+
.filter((method) => method.httpMethod === 'get')
|
|
180
|
+
.forEach((method) => allowedMethodsSet.add(method));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (options.codeAllowedMethods) {
|
|
184
|
+
// Add all methods that match any of the allowed regexps
|
|
185
|
+
const allowedRegexps = options.codeAllowedMethods.map((pattern) => {
|
|
186
|
+
try {
|
|
187
|
+
return new RegExp(pattern);
|
|
188
|
+
} catch (e) {
|
|
189
|
+
throw new Error(
|
|
190
|
+
`Invalid regex pattern for allowed method: "${pattern}": ${e instanceof Error ? e.message : e}`,
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
sdkMethods
|
|
196
|
+
.filter((method) => allowedRegexps.some((regexp) => regexp.test(method.fullyQualifiedName)))
|
|
197
|
+
.forEach((method) => allowedMethodsSet.add(method));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
allowedMethods = Array.from(allowedMethodsSet);
|
|
201
|
+
} else {
|
|
202
|
+
// Start with everything allowed
|
|
203
|
+
allowedMethods = [...sdkMethods];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (options.codeBlockedMethods) {
|
|
207
|
+
// Filter down based on blocked regexps
|
|
208
|
+
const blockedRegexps = options.codeBlockedMethods.map((pattern) => {
|
|
209
|
+
try {
|
|
210
|
+
return new RegExp(pattern);
|
|
211
|
+
} catch (e) {
|
|
212
|
+
throw new Error(
|
|
213
|
+
`Invalid regex pattern for blocked method: "${pattern}": ${e instanceof Error ? e.message : e}`,
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
allowedMethods = allowedMethods.filter(
|
|
219
|
+
(method) => !blockedRegexps.some((regexp) => regexp.test(method.fullyQualifiedName)),
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return allowedMethods;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function blockedMethodsForCodeTool(options: McpOptions | undefined): SdkMethod[] | undefined {
|
|
227
|
+
const allowedMethods = allowedMethodsForCodeTool(options);
|
|
228
|
+
if (!allowedMethods) {
|
|
229
|
+
return undefined;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const allowedSet = new Set(allowedMethods.map((method) => method.fullyQualifiedName));
|
|
233
|
+
|
|
234
|
+
// Return any methods that are not explicitly allowed
|
|
235
|
+
return sdkMethods.filter((method) => !allowedSet.has(method.fullyQualifiedName));
|
|
236
|
+
}
|