@zavudev/sdk-mcp 0.14.0
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 +201 -0
- package/README.md +313 -0
- package/code-tool-types.d.mts +16 -0
- package/code-tool-types.d.mts.map +1 -0
- package/code-tool-types.d.ts +16 -0
- package/code-tool-types.d.ts.map +1 -0
- package/code-tool-types.js +4 -0
- package/code-tool-types.js.map +1 -0
- package/code-tool-types.mjs +3 -0
- package/code-tool-types.mjs.map +1 -0
- package/code-tool.d.mts +54 -0
- package/code-tool.d.mts.map +1 -0
- package/code-tool.d.ts +54 -0
- package/code-tool.d.ts.map +1 -0
- package/code-tool.js +49 -0
- package/code-tool.js.map +1 -0
- package/code-tool.mjs +46 -0
- package/code-tool.mjs.map +1 -0
- package/compat.d.mts +58 -0
- package/compat.d.mts.map +1 -0
- package/compat.d.ts +58 -0
- package/compat.d.ts.map +1 -0
- package/compat.js +387 -0
- package/compat.js.map +1 -0
- package/compat.mjs +378 -0
- package/compat.mjs.map +1 -0
- package/docs-search-tool.d.mts +50 -0
- package/docs-search-tool.d.mts.map +1 -0
- package/docs-search-tool.d.ts +50 -0
- package/docs-search-tool.d.ts.map +1 -0
- package/docs-search-tool.js +51 -0
- package/docs-search-tool.js.map +1 -0
- package/docs-search-tool.mjs +47 -0
- package/docs-search-tool.mjs.map +1 -0
- package/dynamic-tools.d.mts +12 -0
- package/dynamic-tools.d.mts.map +1 -0
- package/dynamic-tools.d.ts +12 -0
- package/dynamic-tools.d.ts.map +1 -0
- package/dynamic-tools.js +135 -0
- package/dynamic-tools.js.map +1 -0
- package/dynamic-tools.mjs +132 -0
- package/dynamic-tools.mjs.map +1 -0
- package/filtering.d.mts +3 -0
- package/filtering.d.mts.map +1 -0
- package/filtering.d.ts +3 -0
- package/filtering.d.ts.map +1 -0
- package/filtering.js +24 -0
- package/filtering.js.map +1 -0
- package/filtering.mjs +16 -0
- package/filtering.mjs.map +1 -0
- package/headers.d.mts +4 -0
- package/headers.d.mts.map +1 -0
- package/headers.d.ts +4 -0
- package/headers.d.ts.map +1 -0
- package/headers.js +22 -0
- package/headers.js.map +1 -0
- package/headers.mjs +18 -0
- package/headers.mjs.map +1 -0
- package/http.d.mts +9 -0
- package/http.d.mts.map +1 -0
- package/http.d.ts +9 -0
- package/http.d.ts.map +1 -0
- package/http.js +108 -0
- package/http.js.map +1 -0
- package/http.mjs +100 -0
- package/http.mjs.map +1 -0
- package/index.d.mts +3 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -0
- package/index.js +91 -0
- package/index.js.map +1 -0
- package/index.mjs +89 -0
- package/index.mjs.map +1 -0
- package/options.d.mts +20 -0
- package/options.d.mts.map +1 -0
- package/options.d.ts +20 -0
- package/options.d.ts.map +1 -0
- package/options.js +427 -0
- package/options.js.map +1 -0
- package/options.mjs +420 -0
- package/options.mjs.map +1 -0
- package/package.json +201 -0
- package/server.d.mts +35 -0
- package/server.d.mts.map +1 -0
- package/server.d.ts +35 -0
- package/server.d.ts.map +1 -0
- package/server.js +174 -0
- package/server.js.map +1 -0
- package/server.mjs +160 -0
- package/server.mjs.map +1 -0
- package/src/code-tool-types.ts +18 -0
- package/src/code-tool.ts +59 -0
- package/src/compat.ts +483 -0
- package/src/docs-search-tool.ts +59 -0
- package/src/dynamic-tools.ts +153 -0
- package/src/filtering.ts +18 -0
- package/src/headers.ts +25 -0
- package/src/http.ts +127 -0
- package/src/index.ts +108 -0
- package/src/options.ts +473 -0
- package/src/server.ts +207 -0
- package/src/stdio.ts +13 -0
- package/src/tools/broadcasts/cancel-broadcasts.ts +52 -0
- package/src/tools/broadcasts/contacts/add-broadcasts-contacts.ts +73 -0
- package/src/tools/broadcasts/contacts/list-broadcasts-contacts.ts +71 -0
- package/src/tools/broadcasts/contacts/remove-broadcasts-contacts.ts +43 -0
- package/src/tools/broadcasts/create-broadcasts.ts +134 -0
- package/src/tools/broadcasts/delete-broadcasts.ts +40 -0
- package/src/tools/broadcasts/list-broadcasts.ts +68 -0
- package/src/tools/broadcasts/progress-broadcasts.ts +54 -0
- package/src/tools/broadcasts/retrieve-broadcasts.ts +54 -0
- package/src/tools/broadcasts/send-broadcasts.ts +57 -0
- package/src/tools/broadcasts/update-broadcasts.ts +106 -0
- package/src/tools/contacts/list-contacts.ts +61 -0
- package/src/tools/contacts/retrieve-by-phone-contacts.ts +56 -0
- package/src/tools/contacts/retrieve-contacts.ts +54 -0
- package/src/tools/contacts/update-contacts.ts +61 -0
- package/src/tools/index.ts +143 -0
- package/src/tools/introspect/validate-phone-introspect.ts +52 -0
- package/src/tools/messages/list-messages.ts +78 -0
- package/src/tools/messages/react-messages.ts +59 -0
- package/src/tools/messages/retrieve-messages.ts +54 -0
- package/src/tools/messages/send-messages.ts +233 -0
- package/src/tools/phone-numbers/list-phone-numbers.ts +68 -0
- package/src/tools/phone-numbers/purchase-phone-numbers.ts +57 -0
- package/src/tools/phone-numbers/release-phone-numbers.ts +40 -0
- package/src/tools/phone-numbers/retrieve-phone-numbers.ts +56 -0
- package/src/tools/phone-numbers/search-available-phone-numbers.ts +72 -0
- package/src/tools/phone-numbers/update-phone-numbers.ts +62 -0
- package/src/tools/senders/create-senders.ts +86 -0
- package/src/tools/senders/delete-senders.ts +40 -0
- package/src/tools/senders/list-senders.ts +58 -0
- package/src/tools/senders/regenerate-webhook-secret-senders.ts +54 -0
- package/src/tools/senders/retrieve-senders.ts +54 -0
- package/src/tools/senders/update-senders.ts +90 -0
- package/src/tools/templates/create-templates.ts +74 -0
- package/src/tools/templates/delete-templates.ts +40 -0
- package/src/tools/templates/list-templates.ts +58 -0
- package/src/tools/templates/retrieve-templates.ts +54 -0
- package/src/tools/templates/submit-templates.ts +66 -0
- package/src/tools/types.ts +115 -0
- package/src/tools.ts +1 -0
- package/src/tsconfig.json +11 -0
- package/stdio.d.mts +3 -0
- package/stdio.d.mts.map +1 -0
- package/stdio.d.ts +3 -0
- package/stdio.d.ts.map +1 -0
- package/stdio.js +14 -0
- package/stdio.js.map +1 -0
- package/stdio.mjs +10 -0
- package/stdio.mjs.map +1 -0
- package/tools/broadcasts/cancel-broadcasts.d.mts +51 -0
- package/tools/broadcasts/cancel-broadcasts.d.mts.map +1 -0
- package/tools/broadcasts/cancel-broadcasts.d.ts +51 -0
- package/tools/broadcasts/cancel-broadcasts.d.ts.map +1 -0
- package/tools/broadcasts/cancel-broadcasts.js +52 -0
- package/tools/broadcasts/cancel-broadcasts.js.map +1 -0
- package/tools/broadcasts/cancel-broadcasts.mjs +45 -0
- package/tools/broadcasts/cancel-broadcasts.mjs.map +1 -0
- package/tools/broadcasts/contacts/add-broadcasts-contacts.d.mts +51 -0
- package/tools/broadcasts/contacts/add-broadcasts-contacts.d.mts.map +1 -0
- package/tools/broadcasts/contacts/add-broadcasts-contacts.d.ts +51 -0
- package/tools/broadcasts/contacts/add-broadcasts-contacts.d.ts.map +1 -0
- package/tools/broadcasts/contacts/add-broadcasts-contacts.js +71 -0
- package/tools/broadcasts/contacts/add-broadcasts-contacts.js.map +1 -0
- package/tools/broadcasts/contacts/add-broadcasts-contacts.mjs +64 -0
- package/tools/broadcasts/contacts/add-broadcasts-contacts.mjs.map +1 -0
- package/tools/broadcasts/contacts/list-broadcasts-contacts.d.mts +51 -0
- package/tools/broadcasts/contacts/list-broadcasts-contacts.d.mts.map +1 -0
- package/tools/broadcasts/contacts/list-broadcasts-contacts.d.ts +51 -0
- package/tools/broadcasts/contacts/list-broadcasts-contacts.d.ts.map +1 -0
- package/tools/broadcasts/contacts/list-broadcasts-contacts.js +71 -0
- package/tools/broadcasts/contacts/list-broadcasts-contacts.js.map +1 -0
- package/tools/broadcasts/contacts/list-broadcasts-contacts.mjs +64 -0
- package/tools/broadcasts/contacts/list-broadcasts-contacts.mjs.map +1 -0
- package/tools/broadcasts/contacts/remove-broadcasts-contacts.d.mts +51 -0
- package/tools/broadcasts/contacts/remove-broadcasts-contacts.d.mts.map +1 -0
- package/tools/broadcasts/contacts/remove-broadcasts-contacts.d.ts +51 -0
- package/tools/broadcasts/contacts/remove-broadcasts-contacts.d.ts.map +1 -0
- package/tools/broadcasts/contacts/remove-broadcasts-contacts.js +40 -0
- package/tools/broadcasts/contacts/remove-broadcasts-contacts.js.map +1 -0
- package/tools/broadcasts/contacts/remove-broadcasts-contacts.mjs +36 -0
- package/tools/broadcasts/contacts/remove-broadcasts-contacts.mjs.map +1 -0
- package/tools/broadcasts/create-broadcasts.d.mts +51 -0
- package/tools/broadcasts/create-broadcasts.d.mts.map +1 -0
- package/tools/broadcasts/create-broadcasts.d.ts +51 -0
- package/tools/broadcasts/create-broadcasts.d.ts.map +1 -0
- package/tools/broadcasts/create-broadcasts.js +134 -0
- package/tools/broadcasts/create-broadcasts.js.map +1 -0
- package/tools/broadcasts/create-broadcasts.mjs +127 -0
- package/tools/broadcasts/create-broadcasts.mjs.map +1 -0
- package/tools/broadcasts/delete-broadcasts.d.mts +51 -0
- package/tools/broadcasts/delete-broadcasts.d.mts.map +1 -0
- package/tools/broadcasts/delete-broadcasts.d.ts +51 -0
- package/tools/broadcasts/delete-broadcasts.d.ts.map +1 -0
- package/tools/broadcasts/delete-broadcasts.js +37 -0
- package/tools/broadcasts/delete-broadcasts.js.map +1 -0
- package/tools/broadcasts/delete-broadcasts.mjs +33 -0
- package/tools/broadcasts/delete-broadcasts.mjs.map +1 -0
- package/tools/broadcasts/list-broadcasts.d.mts +51 -0
- package/tools/broadcasts/list-broadcasts.d.mts.map +1 -0
- package/tools/broadcasts/list-broadcasts.d.ts +51 -0
- package/tools/broadcasts/list-broadcasts.d.ts.map +1 -0
- package/tools/broadcasts/list-broadcasts.js +68 -0
- package/tools/broadcasts/list-broadcasts.js.map +1 -0
- package/tools/broadcasts/list-broadcasts.mjs +61 -0
- package/tools/broadcasts/list-broadcasts.mjs.map +1 -0
- package/tools/broadcasts/progress-broadcasts.d.mts +51 -0
- package/tools/broadcasts/progress-broadcasts.d.mts.map +1 -0
- package/tools/broadcasts/progress-broadcasts.d.ts +51 -0
- package/tools/broadcasts/progress-broadcasts.d.ts.map +1 -0
- package/tools/broadcasts/progress-broadcasts.js +54 -0
- package/tools/broadcasts/progress-broadcasts.js.map +1 -0
- package/tools/broadcasts/progress-broadcasts.mjs +47 -0
- package/tools/broadcasts/progress-broadcasts.mjs.map +1 -0
- package/tools/broadcasts/retrieve-broadcasts.d.mts +51 -0
- package/tools/broadcasts/retrieve-broadcasts.d.mts.map +1 -0
- package/tools/broadcasts/retrieve-broadcasts.d.ts +51 -0
- package/tools/broadcasts/retrieve-broadcasts.d.ts.map +1 -0
- package/tools/broadcasts/retrieve-broadcasts.js +54 -0
- package/tools/broadcasts/retrieve-broadcasts.js.map +1 -0
- package/tools/broadcasts/retrieve-broadcasts.mjs +47 -0
- package/tools/broadcasts/retrieve-broadcasts.mjs.map +1 -0
- package/tools/broadcasts/send-broadcasts.d.mts +51 -0
- package/tools/broadcasts/send-broadcasts.d.mts.map +1 -0
- package/tools/broadcasts/send-broadcasts.d.ts +51 -0
- package/tools/broadcasts/send-broadcasts.d.ts.map +1 -0
- package/tools/broadcasts/send-broadcasts.js +57 -0
- package/tools/broadcasts/send-broadcasts.js.map +1 -0
- package/tools/broadcasts/send-broadcasts.mjs +50 -0
- package/tools/broadcasts/send-broadcasts.mjs.map +1 -0
- package/tools/broadcasts/update-broadcasts.d.mts +51 -0
- package/tools/broadcasts/update-broadcasts.d.mts.map +1 -0
- package/tools/broadcasts/update-broadcasts.d.ts +51 -0
- package/tools/broadcasts/update-broadcasts.d.ts.map +1 -0
- package/tools/broadcasts/update-broadcasts.js +104 -0
- package/tools/broadcasts/update-broadcasts.js.map +1 -0
- package/tools/broadcasts/update-broadcasts.mjs +97 -0
- package/tools/broadcasts/update-broadcasts.mjs.map +1 -0
- package/tools/contacts/list-contacts.d.mts +51 -0
- package/tools/contacts/list-contacts.d.mts.map +1 -0
- package/tools/contacts/list-contacts.d.ts +51 -0
- package/tools/contacts/list-contacts.d.ts.map +1 -0
- package/tools/contacts/list-contacts.js +61 -0
- package/tools/contacts/list-contacts.js.map +1 -0
- package/tools/contacts/list-contacts.mjs +54 -0
- package/tools/contacts/list-contacts.mjs.map +1 -0
- package/tools/contacts/retrieve-by-phone-contacts.d.mts +51 -0
- package/tools/contacts/retrieve-by-phone-contacts.d.mts.map +1 -0
- package/tools/contacts/retrieve-by-phone-contacts.d.ts +51 -0
- package/tools/contacts/retrieve-by-phone-contacts.d.ts.map +1 -0
- package/tools/contacts/retrieve-by-phone-contacts.js +54 -0
- package/tools/contacts/retrieve-by-phone-contacts.js.map +1 -0
- package/tools/contacts/retrieve-by-phone-contacts.mjs +47 -0
- package/tools/contacts/retrieve-by-phone-contacts.mjs.map +1 -0
- package/tools/contacts/retrieve-contacts.d.mts +51 -0
- package/tools/contacts/retrieve-contacts.d.mts.map +1 -0
- package/tools/contacts/retrieve-contacts.d.ts +51 -0
- package/tools/contacts/retrieve-contacts.d.ts.map +1 -0
- package/tools/contacts/retrieve-contacts.js +54 -0
- package/tools/contacts/retrieve-contacts.js.map +1 -0
- package/tools/contacts/retrieve-contacts.mjs +47 -0
- package/tools/contacts/retrieve-contacts.mjs.map +1 -0
- package/tools/contacts/update-contacts.d.mts +51 -0
- package/tools/contacts/update-contacts.d.mts.map +1 -0
- package/tools/contacts/update-contacts.d.ts +51 -0
- package/tools/contacts/update-contacts.d.ts.map +1 -0
- package/tools/contacts/update-contacts.js +61 -0
- package/tools/contacts/update-contacts.js.map +1 -0
- package/tools/contacts/update-contacts.mjs +54 -0
- package/tools/contacts/update-contacts.mjs.map +1 -0
- package/tools/index.d.mts +10 -0
- package/tools/index.d.mts.map +1 -0
- package/tools/index.d.ts +10 -0
- package/tools/index.d.ts.map +1 -0
- package/tools/index.js +127 -0
- package/tools/index.js.map +1 -0
- package/tools/index.mjs +120 -0
- package/tools/index.mjs.map +1 -0
- package/tools/introspect/validate-phone-introspect.d.mts +51 -0
- package/tools/introspect/validate-phone-introspect.d.mts.map +1 -0
- package/tools/introspect/validate-phone-introspect.d.ts +51 -0
- package/tools/introspect/validate-phone-introspect.d.ts.map +1 -0
- package/tools/introspect/validate-phone-introspect.js +52 -0
- package/tools/introspect/validate-phone-introspect.js.map +1 -0
- package/tools/introspect/validate-phone-introspect.mjs +45 -0
- package/tools/introspect/validate-phone-introspect.mjs.map +1 -0
- package/tools/messages/list-messages.d.mts +51 -0
- package/tools/messages/list-messages.d.mts.map +1 -0
- package/tools/messages/list-messages.d.ts +51 -0
- package/tools/messages/list-messages.d.ts.map +1 -0
- package/tools/messages/list-messages.js +78 -0
- package/tools/messages/list-messages.js.map +1 -0
- package/tools/messages/list-messages.mjs +71 -0
- package/tools/messages/list-messages.mjs.map +1 -0
- package/tools/messages/react-messages.d.mts +51 -0
- package/tools/messages/react-messages.d.mts.map +1 -0
- package/tools/messages/react-messages.d.ts +51 -0
- package/tools/messages/react-messages.d.ts.map +1 -0
- package/tools/messages/react-messages.js +59 -0
- package/tools/messages/react-messages.js.map +1 -0
- package/tools/messages/react-messages.mjs +52 -0
- package/tools/messages/react-messages.mjs.map +1 -0
- package/tools/messages/retrieve-messages.d.mts +51 -0
- package/tools/messages/retrieve-messages.d.mts.map +1 -0
- package/tools/messages/retrieve-messages.d.ts +51 -0
- package/tools/messages/retrieve-messages.d.ts.map +1 -0
- package/tools/messages/retrieve-messages.js +54 -0
- package/tools/messages/retrieve-messages.js.map +1 -0
- package/tools/messages/retrieve-messages.mjs +47 -0
- package/tools/messages/retrieve-messages.mjs.map +1 -0
- package/tools/messages/send-messages.d.mts +51 -0
- package/tools/messages/send-messages.d.mts.map +1 -0
- package/tools/messages/send-messages.d.ts +51 -0
- package/tools/messages/send-messages.d.ts.map +1 -0
- package/tools/messages/send-messages.js +233 -0
- package/tools/messages/send-messages.js.map +1 -0
- package/tools/messages/send-messages.mjs +226 -0
- package/tools/messages/send-messages.mjs.map +1 -0
- package/tools/phone-numbers/list-phone-numbers.d.mts +51 -0
- package/tools/phone-numbers/list-phone-numbers.d.mts.map +1 -0
- package/tools/phone-numbers/list-phone-numbers.d.ts +51 -0
- package/tools/phone-numbers/list-phone-numbers.d.ts.map +1 -0
- package/tools/phone-numbers/list-phone-numbers.js +68 -0
- package/tools/phone-numbers/list-phone-numbers.js.map +1 -0
- package/tools/phone-numbers/list-phone-numbers.mjs +61 -0
- package/tools/phone-numbers/list-phone-numbers.mjs.map +1 -0
- package/tools/phone-numbers/purchase-phone-numbers.d.mts +51 -0
- package/tools/phone-numbers/purchase-phone-numbers.d.mts.map +1 -0
- package/tools/phone-numbers/purchase-phone-numbers.d.ts +51 -0
- package/tools/phone-numbers/purchase-phone-numbers.d.ts.map +1 -0
- package/tools/phone-numbers/purchase-phone-numbers.js +57 -0
- package/tools/phone-numbers/purchase-phone-numbers.js.map +1 -0
- package/tools/phone-numbers/purchase-phone-numbers.mjs +50 -0
- package/tools/phone-numbers/purchase-phone-numbers.mjs.map +1 -0
- package/tools/phone-numbers/release-phone-numbers.d.mts +51 -0
- package/tools/phone-numbers/release-phone-numbers.d.mts.map +1 -0
- package/tools/phone-numbers/release-phone-numbers.d.ts +51 -0
- package/tools/phone-numbers/release-phone-numbers.d.ts.map +1 -0
- package/tools/phone-numbers/release-phone-numbers.js +37 -0
- package/tools/phone-numbers/release-phone-numbers.js.map +1 -0
- package/tools/phone-numbers/release-phone-numbers.mjs +33 -0
- package/tools/phone-numbers/release-phone-numbers.mjs.map +1 -0
- package/tools/phone-numbers/retrieve-phone-numbers.d.mts +51 -0
- package/tools/phone-numbers/retrieve-phone-numbers.d.mts.map +1 -0
- package/tools/phone-numbers/retrieve-phone-numbers.d.ts +51 -0
- package/tools/phone-numbers/retrieve-phone-numbers.d.ts.map +1 -0
- package/tools/phone-numbers/retrieve-phone-numbers.js +54 -0
- package/tools/phone-numbers/retrieve-phone-numbers.js.map +1 -0
- package/tools/phone-numbers/retrieve-phone-numbers.mjs +47 -0
- package/tools/phone-numbers/retrieve-phone-numbers.mjs.map +1 -0
- package/tools/phone-numbers/search-available-phone-numbers.d.mts +51 -0
- package/tools/phone-numbers/search-available-phone-numbers.d.mts.map +1 -0
- package/tools/phone-numbers/search-available-phone-numbers.d.ts +51 -0
- package/tools/phone-numbers/search-available-phone-numbers.d.ts.map +1 -0
- package/tools/phone-numbers/search-available-phone-numbers.js +72 -0
- package/tools/phone-numbers/search-available-phone-numbers.js.map +1 -0
- package/tools/phone-numbers/search-available-phone-numbers.mjs +65 -0
- package/tools/phone-numbers/search-available-phone-numbers.mjs.map +1 -0
- package/tools/phone-numbers/update-phone-numbers.d.mts +51 -0
- package/tools/phone-numbers/update-phone-numbers.d.mts.map +1 -0
- package/tools/phone-numbers/update-phone-numbers.d.ts +51 -0
- package/tools/phone-numbers/update-phone-numbers.d.ts.map +1 -0
- package/tools/phone-numbers/update-phone-numbers.js +60 -0
- package/tools/phone-numbers/update-phone-numbers.js.map +1 -0
- package/tools/phone-numbers/update-phone-numbers.mjs +53 -0
- package/tools/phone-numbers/update-phone-numbers.mjs.map +1 -0
- package/tools/senders/create-senders.d.mts +51 -0
- package/tools/senders/create-senders.d.mts.map +1 -0
- package/tools/senders/create-senders.d.ts +51 -0
- package/tools/senders/create-senders.d.ts.map +1 -0
- package/tools/senders/create-senders.js +85 -0
- package/tools/senders/create-senders.js.map +1 -0
- package/tools/senders/create-senders.mjs +78 -0
- package/tools/senders/create-senders.mjs.map +1 -0
- package/tools/senders/delete-senders.d.mts +51 -0
- package/tools/senders/delete-senders.d.mts.map +1 -0
- package/tools/senders/delete-senders.d.ts +51 -0
- package/tools/senders/delete-senders.d.ts.map +1 -0
- package/tools/senders/delete-senders.js +37 -0
- package/tools/senders/delete-senders.js.map +1 -0
- package/tools/senders/delete-senders.mjs +33 -0
- package/tools/senders/delete-senders.mjs.map +1 -0
- package/tools/senders/list-senders.d.mts +51 -0
- package/tools/senders/list-senders.d.mts.map +1 -0
- package/tools/senders/list-senders.d.ts +51 -0
- package/tools/senders/list-senders.d.ts.map +1 -0
- package/tools/senders/list-senders.js +58 -0
- package/tools/senders/list-senders.js.map +1 -0
- package/tools/senders/list-senders.mjs +51 -0
- package/tools/senders/list-senders.mjs.map +1 -0
- package/tools/senders/regenerate-webhook-secret-senders.d.mts +51 -0
- package/tools/senders/regenerate-webhook-secret-senders.d.mts.map +1 -0
- package/tools/senders/regenerate-webhook-secret-senders.d.ts +51 -0
- package/tools/senders/regenerate-webhook-secret-senders.d.ts.map +1 -0
- package/tools/senders/regenerate-webhook-secret-senders.js +52 -0
- package/tools/senders/regenerate-webhook-secret-senders.js.map +1 -0
- package/tools/senders/regenerate-webhook-secret-senders.mjs +45 -0
- package/tools/senders/regenerate-webhook-secret-senders.mjs.map +1 -0
- package/tools/senders/retrieve-senders.d.mts +51 -0
- package/tools/senders/retrieve-senders.d.mts.map +1 -0
- package/tools/senders/retrieve-senders.d.ts +51 -0
- package/tools/senders/retrieve-senders.d.ts.map +1 -0
- package/tools/senders/retrieve-senders.js +54 -0
- package/tools/senders/retrieve-senders.js.map +1 -0
- package/tools/senders/retrieve-senders.mjs +47 -0
- package/tools/senders/retrieve-senders.mjs.map +1 -0
- package/tools/senders/update-senders.d.mts +51 -0
- package/tools/senders/update-senders.d.mts.map +1 -0
- package/tools/senders/update-senders.d.ts +51 -0
- package/tools/senders/update-senders.d.ts.map +1 -0
- package/tools/senders/update-senders.js +89 -0
- package/tools/senders/update-senders.js.map +1 -0
- package/tools/senders/update-senders.mjs +82 -0
- package/tools/senders/update-senders.mjs.map +1 -0
- package/tools/templates/create-templates.d.mts +51 -0
- package/tools/templates/create-templates.d.mts.map +1 -0
- package/tools/templates/create-templates.d.ts +51 -0
- package/tools/templates/create-templates.d.ts.map +1 -0
- package/tools/templates/create-templates.js +74 -0
- package/tools/templates/create-templates.js.map +1 -0
- package/tools/templates/create-templates.mjs +67 -0
- package/tools/templates/create-templates.mjs.map +1 -0
- package/tools/templates/delete-templates.d.mts +51 -0
- package/tools/templates/delete-templates.d.mts.map +1 -0
- package/tools/templates/delete-templates.d.ts +51 -0
- package/tools/templates/delete-templates.d.ts.map +1 -0
- package/tools/templates/delete-templates.js +37 -0
- package/tools/templates/delete-templates.js.map +1 -0
- package/tools/templates/delete-templates.mjs +33 -0
- package/tools/templates/delete-templates.mjs.map +1 -0
- package/tools/templates/list-templates.d.mts +51 -0
- package/tools/templates/list-templates.d.mts.map +1 -0
- package/tools/templates/list-templates.d.ts +51 -0
- package/tools/templates/list-templates.d.ts.map +1 -0
- package/tools/templates/list-templates.js +58 -0
- package/tools/templates/list-templates.js.map +1 -0
- package/tools/templates/list-templates.mjs +51 -0
- package/tools/templates/list-templates.mjs.map +1 -0
- package/tools/templates/retrieve-templates.d.mts +51 -0
- package/tools/templates/retrieve-templates.d.mts.map +1 -0
- package/tools/templates/retrieve-templates.d.ts +51 -0
- package/tools/templates/retrieve-templates.d.ts.map +1 -0
- package/tools/templates/retrieve-templates.js +54 -0
- package/tools/templates/retrieve-templates.js.map +1 -0
- package/tools/templates/retrieve-templates.mjs +47 -0
- package/tools/templates/retrieve-templates.mjs.map +1 -0
- package/tools/templates/submit-templates.d.mts +51 -0
- package/tools/templates/submit-templates.d.mts.map +1 -0
- package/tools/templates/submit-templates.d.ts +51 -0
- package/tools/templates/submit-templates.d.ts.map +1 -0
- package/tools/templates/submit-templates.js +66 -0
- package/tools/templates/submit-templates.js.map +1 -0
- package/tools/templates/submit-templates.mjs +59 -0
- package/tools/templates/submit-templates.mjs.map +1 -0
- package/tools/types.d.mts +52 -0
- package/tools/types.d.mts.map +1 -0
- package/tools/types.d.ts +52 -0
- package/tools/types.d.ts.map +1 -0
- package/tools/types.js +58 -0
- package/tools/types.js.map +1 -0
- package/tools/types.mjs +53 -0
- package/tools/types.mjs.map +1 -0
- package/tools.d.mts +2 -0
- package/tools.d.mts.map +1 -0
- package/tools.d.ts +2 -0
- package/tools.d.ts.map +1 -0
- package/tools.js +18 -0
- package/tools.js.map +1 -0
- package/tools.mjs +2 -0
- package/tools.mjs.map +1 -0
package/server.d.mts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { Endpoint, HandlerFunction } from "./tools.mjs";
|
|
4
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import { ClientOptions } from '@zavudev/sdk';
|
|
6
|
+
import Zavudev from '@zavudev/sdk';
|
|
7
|
+
import { ClientCapabilities } from "./compat.mjs";
|
|
8
|
+
import { McpOptions } from "./options.mjs";
|
|
9
|
+
export { McpOptions } from "./options.mjs";
|
|
10
|
+
export { ClientType } from "./compat.mjs";
|
|
11
|
+
export { Filter } from "./tools.mjs";
|
|
12
|
+
export { ClientOptions } from '@zavudev/sdk';
|
|
13
|
+
export { endpoints } from "./tools.mjs";
|
|
14
|
+
export declare const newMcpServer: () => McpServer;
|
|
15
|
+
export declare const server: McpServer;
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the provided MCP Server with the given tools and handlers.
|
|
18
|
+
* If not provided, the default client, tools and handlers will be used.
|
|
19
|
+
*/
|
|
20
|
+
export declare function initMcpServer(params: {
|
|
21
|
+
server: Server | McpServer;
|
|
22
|
+
clientOptions?: ClientOptions;
|
|
23
|
+
mcpOptions?: McpOptions;
|
|
24
|
+
}): void;
|
|
25
|
+
/**
|
|
26
|
+
* Selects the tools to include in the MCP Server based on the provided options.
|
|
27
|
+
*/
|
|
28
|
+
export declare function selectTools(endpoints: Endpoint[], options?: McpOptions): Promise<Endpoint[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Runs the provided handler with the given client and arguments.
|
|
31
|
+
*/
|
|
32
|
+
export declare function executeHandler(tool: Tool, handler: HandlerFunction, client: Zavudev, args: Record<string, unknown> | undefined, compatibilityOptions?: Partial<ClientCapabilities>): Promise<import("./tools/types").ToolCallResult>;
|
|
33
|
+
export declare const readEnv: (env: string) => string | undefined;
|
|
34
|
+
export declare const readEnvOrError: (env: string) => string;
|
|
35
|
+
//# sourceMappingURL=server.d.mts.map
|
package/server.d.mts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.mts","sourceRoot":"","sources":["src/server.ts"],"names":[],"mappings":"OAEO,EAAE,MAAM,EAAE,MAAM,2CAA2C;OAC3D,EAAE,SAAS,EAAE,MAAM,yCAAyC;OAC5D,EAAE,QAAQ,EAAa,eAAe,EAAS;OAC/C,EAKL,IAAI,EACL,MAAM,oCAAoC;OACpC,EAAE,aAAa,EAAE,MAAM,cAAc;OACrC,OAAO,MAAM,cAAc;OAC3B,EAEL,kBAAkB,EAInB;OAIM,EAAE,UAAU,EAAE;OAEd,EAAE,UAAU,EAAE;OACd,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE;OACV,EAAE,aAAa,EAAE,MAAM,cAAc;OACrC,EAAE,SAAS,EAAE;AAEpB,eAAO,MAAM,YAAY,iBAOtB,CAAC;AAGJ,eAAO,MAAM,MAAM,WAAiB,CAAC;AAErC;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE;IACpC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,QA0FA;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAyBlG;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACzC,oBAAoB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,mDAOnD;AAED,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,SAO9C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,MAM5C,CAAC"}
|
package/server.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { Endpoint, HandlerFunction } from "./tools.js";
|
|
4
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import { ClientOptions } from '@zavudev/sdk';
|
|
6
|
+
import Zavudev from '@zavudev/sdk';
|
|
7
|
+
import { ClientCapabilities } from "./compat.js";
|
|
8
|
+
import { McpOptions } from "./options.js";
|
|
9
|
+
export { McpOptions } from "./options.js";
|
|
10
|
+
export { ClientType } from "./compat.js";
|
|
11
|
+
export { Filter } from "./tools.js";
|
|
12
|
+
export { ClientOptions } from '@zavudev/sdk';
|
|
13
|
+
export { endpoints } from "./tools.js";
|
|
14
|
+
export declare const newMcpServer: () => McpServer;
|
|
15
|
+
export declare const server: McpServer;
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the provided MCP Server with the given tools and handlers.
|
|
18
|
+
* If not provided, the default client, tools and handlers will be used.
|
|
19
|
+
*/
|
|
20
|
+
export declare function initMcpServer(params: {
|
|
21
|
+
server: Server | McpServer;
|
|
22
|
+
clientOptions?: ClientOptions;
|
|
23
|
+
mcpOptions?: McpOptions;
|
|
24
|
+
}): void;
|
|
25
|
+
/**
|
|
26
|
+
* Selects the tools to include in the MCP Server based on the provided options.
|
|
27
|
+
*/
|
|
28
|
+
export declare function selectTools(endpoints: Endpoint[], options?: McpOptions): Promise<Endpoint[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Runs the provided handler with the given client and arguments.
|
|
31
|
+
*/
|
|
32
|
+
export declare function executeHandler(tool: Tool, handler: HandlerFunction, client: Zavudev, args: Record<string, unknown> | undefined, compatibilityOptions?: Partial<ClientCapabilities>): Promise<import("./tools/types").ToolCallResult>;
|
|
33
|
+
export declare const readEnv: (env: string) => string | undefined;
|
|
34
|
+
export declare const readEnvOrError: (env: string) => string;
|
|
35
|
+
//# sourceMappingURL=server.d.ts.map
|
package/server.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["src/server.ts"],"names":[],"mappings":"OAEO,EAAE,MAAM,EAAE,MAAM,2CAA2C;OAC3D,EAAE,SAAS,EAAE,MAAM,yCAAyC;OAC5D,EAAE,QAAQ,EAAa,eAAe,EAAS;OAC/C,EAKL,IAAI,EACL,MAAM,oCAAoC;OACpC,EAAE,aAAa,EAAE,MAAM,cAAc;OACrC,OAAO,MAAM,cAAc;OAC3B,EAEL,kBAAkB,EAInB;OAIM,EAAE,UAAU,EAAE;OAEd,EAAE,UAAU,EAAE;OACd,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE;OACV,EAAE,aAAa,EAAE,MAAM,cAAc;OACrC,EAAE,SAAS,EAAE;AAEpB,eAAO,MAAM,YAAY,iBAOtB,CAAC;AAGJ,eAAO,MAAM,MAAM,WAAiB,CAAC;AAErC;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE;IACpC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,QA0FA;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAyBlG;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACzC,oBAAoB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,mDAOnD;AAED,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,SAO9C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,MAM5C,CAAC"}
|
package/server.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.readEnvOrError = exports.readEnv = exports.server = exports.newMcpServer = exports.endpoints = exports.ClientType = void 0;
|
|
8
|
+
exports.initMcpServer = initMcpServer;
|
|
9
|
+
exports.selectTools = selectTools;
|
|
10
|
+
exports.executeHandler = executeHandler;
|
|
11
|
+
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
12
|
+
const tools_1 = require("./tools.js");
|
|
13
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
14
|
+
const sdk_1 = __importDefault(require("@zavudev/sdk"));
|
|
15
|
+
const compat_1 = require("./compat.js");
|
|
16
|
+
const dynamic_tools_1 = require("./dynamic-tools.js");
|
|
17
|
+
const code_tool_1 = require("./code-tool.js");
|
|
18
|
+
const docs_search_tool_1 = __importDefault(require("./docs-search-tool.js"));
|
|
19
|
+
var compat_2 = require("./compat.js");
|
|
20
|
+
Object.defineProperty(exports, "ClientType", { enumerable: true, get: function () { return compat_2.ClientType; } });
|
|
21
|
+
var tools_2 = require("./tools.js");
|
|
22
|
+
Object.defineProperty(exports, "endpoints", { enumerable: true, get: function () { return tools_2.endpoints; } });
|
|
23
|
+
const newMcpServer = () => new mcp_js_1.McpServer({
|
|
24
|
+
name: 'zavudev_sdk_api',
|
|
25
|
+
version: '0.14.0',
|
|
26
|
+
}, { capabilities: { tools: {}, logging: {} } });
|
|
27
|
+
exports.newMcpServer = newMcpServer;
|
|
28
|
+
// Create server instance
|
|
29
|
+
exports.server = (0, exports.newMcpServer)();
|
|
30
|
+
/**
|
|
31
|
+
* Initializes the provided MCP Server with the given tools and handlers.
|
|
32
|
+
* If not provided, the default client, tools and handlers will be used.
|
|
33
|
+
*/
|
|
34
|
+
function initMcpServer(params) {
|
|
35
|
+
const server = params.server instanceof mcp_js_1.McpServer ? params.server.server : params.server;
|
|
36
|
+
const mcpOptions = params.mcpOptions ?? {};
|
|
37
|
+
let providedEndpoints = null;
|
|
38
|
+
let endpointMap = null;
|
|
39
|
+
const initTools = async (implementation) => {
|
|
40
|
+
if (implementation && (!mcpOptions.client || mcpOptions.client === 'infer')) {
|
|
41
|
+
mcpOptions.client =
|
|
42
|
+
implementation.name.toLowerCase().includes('claude') ? 'claude'
|
|
43
|
+
: implementation.name.toLowerCase().includes('cursor') ? 'cursor'
|
|
44
|
+
: undefined;
|
|
45
|
+
mcpOptions.capabilities = {
|
|
46
|
+
...(mcpOptions.client && compat_1.knownClients[mcpOptions.client]),
|
|
47
|
+
...mcpOptions.capabilities,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
providedEndpoints ?? (providedEndpoints = await selectTools(tools_1.endpoints, mcpOptions));
|
|
51
|
+
endpointMap ?? (endpointMap = Object.fromEntries(providedEndpoints.map((endpoint) => [endpoint.tool.name, endpoint])));
|
|
52
|
+
};
|
|
53
|
+
const logAtLevel = (level) => (message, ...rest) => {
|
|
54
|
+
void server.sendLoggingMessage({
|
|
55
|
+
level,
|
|
56
|
+
data: { message, rest },
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
const logger = {
|
|
60
|
+
debug: logAtLevel('debug'),
|
|
61
|
+
info: logAtLevel('info'),
|
|
62
|
+
warn: logAtLevel('warning'),
|
|
63
|
+
error: logAtLevel('error'),
|
|
64
|
+
};
|
|
65
|
+
let client = new sdk_1.default({
|
|
66
|
+
logger,
|
|
67
|
+
...params.clientOptions,
|
|
68
|
+
defaultHeaders: {
|
|
69
|
+
...params.clientOptions?.defaultHeaders,
|
|
70
|
+
'X-Stainless-MCP': 'true',
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
|
|
74
|
+
if (providedEndpoints === null) {
|
|
75
|
+
await initTools(server.getClientVersion());
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
tools: providedEndpoints.map((endpoint) => endpoint.tool),
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
82
|
+
if (endpointMap === null) {
|
|
83
|
+
await initTools(server.getClientVersion());
|
|
84
|
+
}
|
|
85
|
+
const { name, arguments: args } = request.params;
|
|
86
|
+
const endpoint = endpointMap[name];
|
|
87
|
+
if (!endpoint) {
|
|
88
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
89
|
+
}
|
|
90
|
+
return executeHandler(endpoint.tool, endpoint.handler, client, args, mcpOptions.capabilities);
|
|
91
|
+
});
|
|
92
|
+
server.setRequestHandler(types_js_1.SetLevelRequestSchema, async (request) => {
|
|
93
|
+
const { level } = request.params;
|
|
94
|
+
switch (level) {
|
|
95
|
+
case 'debug':
|
|
96
|
+
client = client.withOptions({ logLevel: 'debug' });
|
|
97
|
+
break;
|
|
98
|
+
case 'info':
|
|
99
|
+
client = client.withOptions({ logLevel: 'info' });
|
|
100
|
+
break;
|
|
101
|
+
case 'notice':
|
|
102
|
+
case 'warning':
|
|
103
|
+
client = client.withOptions({ logLevel: 'warn' });
|
|
104
|
+
break;
|
|
105
|
+
case 'error':
|
|
106
|
+
client = client.withOptions({ logLevel: 'error' });
|
|
107
|
+
break;
|
|
108
|
+
default:
|
|
109
|
+
client = client.withOptions({ logLevel: 'off' });
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
return {};
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Selects the tools to include in the MCP Server based on the provided options.
|
|
117
|
+
*/
|
|
118
|
+
async function selectTools(endpoints, options) {
|
|
119
|
+
const filteredEndpoints = (0, tools_1.query)(options?.filters ?? [], endpoints);
|
|
120
|
+
let includedTools = filteredEndpoints.slice();
|
|
121
|
+
if (includedTools.length > 0) {
|
|
122
|
+
if (options?.includeDynamicTools) {
|
|
123
|
+
includedTools = (0, dynamic_tools_1.dynamicTools)(includedTools);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
if (options?.includeAllTools) {
|
|
128
|
+
includedTools = endpoints.slice();
|
|
129
|
+
}
|
|
130
|
+
else if (options?.includeDynamicTools) {
|
|
131
|
+
includedTools = (0, dynamic_tools_1.dynamicTools)(endpoints);
|
|
132
|
+
}
|
|
133
|
+
else if (options?.includeCodeTools) {
|
|
134
|
+
includedTools = [await (0, code_tool_1.codeTool)()];
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
includedTools = endpoints.slice();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (options?.includeDocsTools ?? true) {
|
|
141
|
+
includedTools.push(docs_search_tool_1.default);
|
|
142
|
+
}
|
|
143
|
+
const capabilities = { ...compat_1.defaultClientCapabilities, ...options?.capabilities };
|
|
144
|
+
return (0, compat_1.applyCompatibilityTransformations)(includedTools, capabilities);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Runs the provided handler with the given client and arguments.
|
|
148
|
+
*/
|
|
149
|
+
async function executeHandler(tool, handler, client, args, compatibilityOptions) {
|
|
150
|
+
const options = { ...compat_1.defaultClientCapabilities, ...compatibilityOptions };
|
|
151
|
+
if (!options.validJson && args) {
|
|
152
|
+
args = (0, compat_1.parseEmbeddedJSON)(args, tool.inputSchema);
|
|
153
|
+
}
|
|
154
|
+
return await handler(client, args || {});
|
|
155
|
+
}
|
|
156
|
+
const readEnv = (env) => {
|
|
157
|
+
if (typeof globalThis.process !== 'undefined') {
|
|
158
|
+
return globalThis.process.env?.[env]?.trim();
|
|
159
|
+
}
|
|
160
|
+
else if (typeof globalThis.Deno !== 'undefined') {
|
|
161
|
+
return globalThis.Deno.env?.get?.(env)?.trim();
|
|
162
|
+
}
|
|
163
|
+
return;
|
|
164
|
+
};
|
|
165
|
+
exports.readEnv = readEnv;
|
|
166
|
+
const readEnvOrError = (env) => {
|
|
167
|
+
let envValue = (0, exports.readEnv)(env);
|
|
168
|
+
if (envValue === undefined) {
|
|
169
|
+
throw new Error(`Environment variable ${env} is not set`);
|
|
170
|
+
}
|
|
171
|
+
return envValue;
|
|
172
|
+
};
|
|
173
|
+
exports.readEnvOrError = readEnvOrError;
|
|
174
|
+
//# sourceMappingURL=server.js.map
|
package/server.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["src/server.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;AAgDtF,sCA8FC;AAKD,kCAyBC;AAKD,wCAYC;AA1LD,oEAAoE;AACpE,sCAAsE;AACtE,iEAM4C;AAE5C,uDAAmC;AACnC,wCAMkB;AAClB,sDAA+C;AAC/C,8CAAuC;AACvC,6EAAgD;AAIhD,sCAAsC;AAA7B,oGAAA,UAAU,OAAA;AAGnB,oCAAoC;AAA3B,kGAAA,SAAS,OAAA;AAEX,MAAM,YAAY,GAAG,GAAG,EAAE,CAC/B,IAAI,kBAAS,CACX;IACE,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,QAAQ;CAClB,EACD,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,CAC7C,CAAC;AAPS,QAAA,YAAY,gBAOrB;AAEJ,yBAAyB;AACZ,QAAA,MAAM,GAAG,IAAA,oBAAY,GAAE,CAAC;AAErC;;;GAGG;AACH,SAAgB,aAAa,CAAC,MAI7B;IACC,M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A,0BAAiB,EAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,MAAM,OAAO,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;AAC3C,CAAC;AAEM,MAAM,OAAO,GAAG,CAAC,GAAW,EAAsB,EAAE;IACzD,IAAI,OAAQ,UAAkB,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QACvD,OAAQ,UAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IACxD,CAAC;SAAM,IAAI,OAAQ,UAAkB,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC3D,OAAQ,UAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IAC1D,CAAC;IACD,OAAO;AACT,CAAC,CAAC;AAPW,QAAA,OAAO,WAOlB;AAEK,MAAM,cAAc,GAAG,CAAC,GAAW,EAAU,EAAE;IACpD,IAAI,QAAQ,GAAG,IAAA,eAAO,EAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,aAAa,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB"}
|
package/server.mjs
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { endpoints, query } from "./tools.mjs";
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, SetLevelRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import Zavudev from '@zavudev/sdk';
|
|
6
|
+
import { applyCompatibilityTransformations, defaultClientCapabilities, knownClients, parseEmbeddedJSON, } from "./compat.mjs";
|
|
7
|
+
import { dynamicTools } from "./dynamic-tools.mjs";
|
|
8
|
+
import { codeTool } from "./code-tool.mjs";
|
|
9
|
+
import docsSearchTool from "./docs-search-tool.mjs";
|
|
10
|
+
export { ClientType } from "./compat.mjs";
|
|
11
|
+
export { endpoints } from "./tools.mjs";
|
|
12
|
+
export const newMcpServer = () => new McpServer({
|
|
13
|
+
name: 'zavudev_sdk_api',
|
|
14
|
+
version: '0.14.0',
|
|
15
|
+
}, { capabilities: { tools: {}, logging: {} } });
|
|
16
|
+
// Create server instance
|
|
17
|
+
export const server = newMcpServer();
|
|
18
|
+
/**
|
|
19
|
+
* Initializes the provided MCP Server with the given tools and handlers.
|
|
20
|
+
* If not provided, the default client, tools and handlers will be used.
|
|
21
|
+
*/
|
|
22
|
+
export function initMcpServer(params) {
|
|
23
|
+
const server = params.server instanceof McpServer ? params.server.server : params.server;
|
|
24
|
+
const mcpOptions = params.mcpOptions ?? {};
|
|
25
|
+
let providedEndpoints = null;
|
|
26
|
+
let endpointMap = null;
|
|
27
|
+
const initTools = async (implementation) => {
|
|
28
|
+
if (implementation && (!mcpOptions.client || mcpOptions.client === 'infer')) {
|
|
29
|
+
mcpOptions.client =
|
|
30
|
+
implementation.name.toLowerCase().includes('claude') ? 'claude'
|
|
31
|
+
: implementation.name.toLowerCase().includes('cursor') ? 'cursor'
|
|
32
|
+
: undefined;
|
|
33
|
+
mcpOptions.capabilities = {
|
|
34
|
+
...(mcpOptions.client && knownClients[mcpOptions.client]),
|
|
35
|
+
...mcpOptions.capabilities,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
providedEndpoints ?? (providedEndpoints = await selectTools(endpoints, mcpOptions));
|
|
39
|
+
endpointMap ?? (endpointMap = Object.fromEntries(providedEndpoints.map((endpoint) => [endpoint.tool.name, endpoint])));
|
|
40
|
+
};
|
|
41
|
+
const logAtLevel = (level) => (message, ...rest) => {
|
|
42
|
+
void server.sendLoggingMessage({
|
|
43
|
+
level,
|
|
44
|
+
data: { message, rest },
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const logger = {
|
|
48
|
+
debug: logAtLevel('debug'),
|
|
49
|
+
info: logAtLevel('info'),
|
|
50
|
+
warn: logAtLevel('warning'),
|
|
51
|
+
error: logAtLevel('error'),
|
|
52
|
+
};
|
|
53
|
+
let client = new Zavudev({
|
|
54
|
+
logger,
|
|
55
|
+
...params.clientOptions,
|
|
56
|
+
defaultHeaders: {
|
|
57
|
+
...params.clientOptions?.defaultHeaders,
|
|
58
|
+
'X-Stainless-MCP': 'true',
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
62
|
+
if (providedEndpoints === null) {
|
|
63
|
+
await initTools(server.getClientVersion());
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
tools: providedEndpoints.map((endpoint) => endpoint.tool),
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
70
|
+
if (endpointMap === null) {
|
|
71
|
+
await initTools(server.getClientVersion());
|
|
72
|
+
}
|
|
73
|
+
const { name, arguments: args } = request.params;
|
|
74
|
+
const endpoint = endpointMap[name];
|
|
75
|
+
if (!endpoint) {
|
|
76
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
77
|
+
}
|
|
78
|
+
return executeHandler(endpoint.tool, endpoint.handler, client, args, mcpOptions.capabilities);
|
|
79
|
+
});
|
|
80
|
+
server.setRequestHandler(SetLevelRequestSchema, async (request) => {
|
|
81
|
+
const { level } = request.params;
|
|
82
|
+
switch (level) {
|
|
83
|
+
case 'debug':
|
|
84
|
+
client = client.withOptions({ logLevel: 'debug' });
|
|
85
|
+
break;
|
|
86
|
+
case 'info':
|
|
87
|
+
client = client.withOptions({ logLevel: 'info' });
|
|
88
|
+
break;
|
|
89
|
+
case 'notice':
|
|
90
|
+
case 'warning':
|
|
91
|
+
client = client.withOptions({ logLevel: 'warn' });
|
|
92
|
+
break;
|
|
93
|
+
case 'error':
|
|
94
|
+
client = client.withOptions({ logLevel: 'error' });
|
|
95
|
+
break;
|
|
96
|
+
default:
|
|
97
|
+
client = client.withOptions({ logLevel: 'off' });
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
return {};
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Selects the tools to include in the MCP Server based on the provided options.
|
|
105
|
+
*/
|
|
106
|
+
export async function selectTools(endpoints, options) {
|
|
107
|
+
const filteredEndpoints = query(options?.filters ?? [], endpoints);
|
|
108
|
+
let includedTools = filteredEndpoints.slice();
|
|
109
|
+
if (includedTools.length > 0) {
|
|
110
|
+
if (options?.includeDynamicTools) {
|
|
111
|
+
includedTools = dynamicTools(includedTools);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
if (options?.includeAllTools) {
|
|
116
|
+
includedTools = endpoints.slice();
|
|
117
|
+
}
|
|
118
|
+
else if (options?.includeDynamicTools) {
|
|
119
|
+
includedTools = dynamicTools(endpoints);
|
|
120
|
+
}
|
|
121
|
+
else if (options?.includeCodeTools) {
|
|
122
|
+
includedTools = [await codeTool()];
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
includedTools = endpoints.slice();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (options?.includeDocsTools ?? true) {
|
|
129
|
+
includedTools.push(docsSearchTool);
|
|
130
|
+
}
|
|
131
|
+
const capabilities = { ...defaultClientCapabilities, ...options?.capabilities };
|
|
132
|
+
return applyCompatibilityTransformations(includedTools, capabilities);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Runs the provided handler with the given client and arguments.
|
|
136
|
+
*/
|
|
137
|
+
export async function executeHandler(tool, handler, client, args, compatibilityOptions) {
|
|
138
|
+
const options = { ...defaultClientCapabilities, ...compatibilityOptions };
|
|
139
|
+
if (!options.validJson && args) {
|
|
140
|
+
args = parseEmbeddedJSON(args, tool.inputSchema);
|
|
141
|
+
}
|
|
142
|
+
return await handler(client, args || {});
|
|
143
|
+
}
|
|
144
|
+
export const readEnv = (env) => {
|
|
145
|
+
if (typeof globalThis.process !== 'undefined') {
|
|
146
|
+
return globalThis.process.env?.[env]?.trim();
|
|
147
|
+
}
|
|
148
|
+
else if (typeof globalThis.Deno !== 'undefined') {
|
|
149
|
+
return globalThis.Deno.env?.get?.(env)?.trim();
|
|
150
|
+
}
|
|
151
|
+
return;
|
|
152
|
+
};
|
|
153
|
+
export const readEnvOrError = (env) => {
|
|
154
|
+
let envValue = readEnv(env);
|
|
155
|
+
if (envValue === undefined) {
|
|
156
|
+
throw new Error(`Environment variable ${env} is not set`);
|
|
157
|
+
}
|
|
158
|
+
return envValue;
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=server.mjs.map
|
package/server.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.mjs","sourceRoot":"","sources":["src/server.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,SAAS,EAAE,MAAM,yCAAyC;OAC5D,EAAY,SAAS,EAAmB,KAAK,EAAE;OAC/C,EACL,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,GAGtB,MAAM,oCAAoC;OAEpC,OAAO,MAAM,cAAc;OAC3B,EACL,iCAAiC,EAEjC,yBAAyB,EACzB,YAAY,EACZ,iBAAiB,GAClB;OACM,EAAE,YAAY,EAAE;OAChB,EAAE,QAAQ,EAAE;OACZ,cAAc;OAId,EAAE,UAAU,EAAE;OAGd,EAAE,SAAS,EAAE;AAEpB,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAC/B,IAAI,SAAS,CACX;IACE,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,QAAQ;CAClB,EACD,EAAE,YAAY,EAAE,EAAE,KAAK,EA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,oBAAkD;IAElD,MAAM,OAAO,GAAG,EAAE,GAAG,yBAAyB,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC1E,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,IAAI,GAAG,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,MAAM,OAAO,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAsB,EAAE;IACzD,IAAI,OAAQ,UAAkB,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QACvD,OAAQ,UAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IACxD,CAAC;SAAM,IAAI,OAAQ,UAAkB,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC3D,OAAQ,UAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IAC1D,CAAC;IACD,OAAO;AACT,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAW,EAAU,EAAE;IACpD,IAAI,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,aAAa,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { ClientOptions } from '@zavudev/sdk';
|
|
4
|
+
|
|
5
|
+
export type WorkerInput = {
|
|
6
|
+
opts: ClientOptions;
|
|
7
|
+
code: string;
|
|
8
|
+
};
|
|
9
|
+
export type WorkerSuccess = {
|
|
10
|
+
result: unknown | null;
|
|
11
|
+
logLines: string[];
|
|
12
|
+
errLines: string[];
|
|
13
|
+
};
|
|
14
|
+
export type WorkerError = {
|
|
15
|
+
message: string | undefined;
|
|
16
|
+
logLines: string[];
|
|
17
|
+
errLines: string[];
|
|
18
|
+
};
|
package/src/code-tool.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { Metadata, ToolCallResult, asTextContentResult } from './tools/types';
|
|
4
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import { readEnv } from './server';
|
|
6
|
+
import { WorkerSuccess } from './code-tool-types';
|
|
7
|
+
/**
|
|
8
|
+
* A tool that runs code against a copy of the SDK.
|
|
9
|
+
*
|
|
10
|
+
* Instead of exposing every endpoint as its own tool, which uses up too many tokens for LLMs to use at once,
|
|
11
|
+
* we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
|
|
12
|
+
* a generic endpoint that can be used to invoke any endpoint with the provided arguments.
|
|
13
|
+
*
|
|
14
|
+
* @param endpoints - The endpoints to include in the list.
|
|
15
|
+
*/
|
|
16
|
+
export async function codeTool() {
|
|
17
|
+
const metadata: Metadata = { resource: 'all', operation: 'write', tags: [] };
|
|
18
|
+
const tool: Tool = {
|
|
19
|
+
name: 'execute',
|
|
20
|
+
description:
|
|
21
|
+
'Runs JavaScript code to interact with the API.\n\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized SDK client and it will be run.\nWrite code within this template:\n\n```\nasync function run(client) {\n // Fill this out\n}\n```\n\nYou will be returned anything that your function returns, plus the results of any console.log statements.\nIf any code triggers an error, the tool will return an error response, so you do not need to add error handling unless you want to output something more helpful than the raw error.\nIt is not necessary to add comments to code, unless by adding those comments you believe that you can generate better code.\nThis code will run in a container, and you will not be able to use fetch or otherwise interact with the network calls other than through the client you are given.\nAny variables you define won\'t live between successive uses of this call, so make sure to return or log any data you might need later.',
|
|
22
|
+
inputSchema: { type: 'object', properties: { code: { type: 'string' } } },
|
|
23
|
+
};
|
|
24
|
+
const handler = async (_: unknown, args: any): Promise<ToolCallResult> => {
|
|
25
|
+
const code = args.code as string;
|
|
26
|
+
|
|
27
|
+
// this is not required, but passing a Stainless API key for the matching project_name
|
|
28
|
+
// will allow you to run code-mode queries against non-published versions of your SDK.
|
|
29
|
+
const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
|
|
30
|
+
const codeModeEndpoint =
|
|
31
|
+
readEnv('CODE_MODE_ENDPOINT_URL') ?? 'https://api.stainless.com/api/ai/code-tool';
|
|
32
|
+
|
|
33
|
+
const res = await fetch(codeModeEndpoint, {
|
|
34
|
+
method: 'POST',
|
|
35
|
+
headers: {
|
|
36
|
+
...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
|
|
37
|
+
'Content-Type': 'application/json',
|
|
38
|
+
client_envs: JSON.stringify({ ZAVUDEV_API_KEY: readEnv('ZAVUDEV_API_KEY') }),
|
|
39
|
+
},
|
|
40
|
+
body: JSON.stringify({
|
|
41
|
+
project_name: 'zavudev',
|
|
42
|
+
client_opts: {},
|
|
43
|
+
code,
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
if (!res.ok) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
`${res.status}: ${
|
|
50
|
+
res.statusText
|
|
51
|
+
} error when trying to contact Code Tool server. Details: ${await res.text()}`,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return asTextContentResult((await res.json()) as WorkerSuccess);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return { metadata, tool, handler };
|
|
59
|
+
}
|