diff --git a/.gitignore b/.gitignore index 4829686..733c54e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +.DS_Store +**/.speakeasy/temp/ +**/.speakeasy/logs/ +.DS_Store /models /models/errors /types diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 00daae1..6d3410a 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -3,10 +3,10 @@ id: f81a812c-4cc0-49fc-86b0-dcfbc85954e3 management: docChecksum: 430e7d604ea696a88d6b34a8e18c9ff8 docVersion: v3 - speakeasyVersion: 1.521.1 - generationVersion: 2.558.5 - releaseVersion: 0.1.0 - configChecksum: ced1f77351976ac9d8b161d9f27f05f8 + speakeasyVersion: 1.543.4 + generationVersion: 2.598.22 + releaseVersion: 0.1.1 + configChecksum: 7c9c7337070bedc7d2afd208a8da2f39 repoURL: https://github.com/speakeasy-api/hubspot-typescript.git installationURL: https://github.com/speakeasy-api/hubspot-typescript published: true @@ -15,7 +15,7 @@ features: acceptHeaders: 2.81.2 additionalDependencies: 0.1.0 constsAndDefaults: 0.1.11 - core: 3.21.4 + core: 3.21.7 defaultEnabledRetries: 0.1.0 devContainers: 2.90.0 enumUnions: 0.1.0 @@ -23,8 +23,8 @@ features: globalSecurity: 2.82.13 globalSecurityCallbacks: 0.1.0 globalSecurityFlattening: 0.1.0 - globalServerURLs: 2.82.4 - mcpServer: 0.9.0 + globalServerURLs: 2.82.5 + mcpServer: 0.9.2 nullables: 0.1.1 responseFormat: 0.2.3 retries: 2.83.0 @@ -207,7 +207,7 @@ examples: objectType: "deals" responses: "200": - application/json: {"key": "", "key1": "", "key2": ""} + application/json: {"key": "", "key1": ""} default: '*/*': "0xDC1CcbAA6F" getCompany: @@ -329,5 +329,5 @@ examples: application/json: {"total": 265805, "paging": {"next": {"link": "?after=NTI1Cg%3D%3D", "after": "NTI1Cg%3D%3D"}}, "results": [{"createdAt": "2019-10-30T03:30:17.883Z", "archived": false, "id": "512", "properties": {"amount": "1500.00", "closedate": "2019-12-07T16:50:06.678Z", "createdate": "2019-10-30T03:30:17.883Z", "dealname": "Custom data integrations", "dealstage": "presentationscheduled", "hs_lastmodifieddate": "2019-12-07T16:50:06.678Z", "hubspot_owner_id": "910901", "pipeline": "default"}, "updatedAt": "2019-12-07T16:50:06.678Z"}]} default: '*/*': "0x943fFbCFA3" -examplesVersion: 1.0.0 +examplesVersion: 1.0.1 generatedTests: {} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 8658bed..aef365a 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -14,11 +14,12 @@ generation: parameterOrderingFeb2024: true requestResponseComponentNamesFeb2024: true securityFeb2025: true + sharedErrorComponentsApr2025: false auth: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: true typescript: - version: 0.1.0 + version: 0.1.1 additionalDependencies: dependencies: {} devDependencies: {} diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index a2da036..2928bbe 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.521.1 +speakeasyVersion: 1.543.4 sources: CRM: sourceNamespace: crm @@ -9,20 +9,20 @@ sources: - v3 HubspotCRM: sourceNamespace: hubspot-crm - sourceRevisionDigest: sha256:068f049648f508cd2c1f0b3f74fdec83a2920b10763541b84a05644ba5fac7f9 + sourceRevisionDigest: sha256:4b920509e176a73262dfd4a386791f13a0bdbd538caf6dee3f680981dbfb657b sourceBlobDigest: sha256:fd3bb26f0d19170b271fae7398ffb1b2dbe48799b6e7c4dee95ec5c58302f332 tags: - latest - - speakeasy-sdk-regen-1742493224 + - speakeasy-sdk-regen-1743711404 - v3 targets: hubspot: source: HubspotCRM sourceNamespace: hubspot-crm - sourceRevisionDigest: sha256:068f049648f508cd2c1f0b3f74fdec83a2920b10763541b84a05644ba5fac7f9 + sourceRevisionDigest: sha256:4b920509e176a73262dfd4a386791f13a0bdbd538caf6dee3f680981dbfb657b sourceBlobDigest: sha256:fd3bb26f0d19170b271fae7398ffb1b2dbe48799b6e7c4dee95ec5c58302f332 codeSamplesNamespace: hubspot-crm-typescript-code-samples - codeSamplesRevisionDigest: sha256:d61859db7b587ca10a3a1abaff25b520db3c9e1e3f8cfde32e27cd069c6e5a2a + codeSamplesRevisionDigest: sha256:89c65122bb56a7fe5ab5ec77b97bc93f5d488e1316026514a0bce1223ce1b679 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/RELEASES.md b/RELEASES.md index 56553b9..a3cb193 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -8,4 +8,14 @@ Based on: ### Generated - [typescript v0.1.0] . ### Releases -- [NPM v0.1.0] https://www.npmjs.com/package/mcp-hubspot/v/0.1.0 - . \ No newline at end of file +- [NPM v0.1.0] https://www.npmjs.com/package/mcp-hubspot/v/0.1.0 - . + +## 2025-05-11 00:18:29 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.543.4 (2.598.22) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v0.1.1] . +### Releases +- [NPM v0.1.1] https://www.npmjs.com/package/mcp-hubspot/v/0.1.1 - . \ No newline at end of file diff --git a/docs/models/components/associationcategory.md b/docs/models/components/associationcategory.md index 456d300..107df11 100644 --- a/docs/models/components/associationcategory.md +++ b/docs/models/components/associationcategory.md @@ -5,7 +5,7 @@ ```typescript import { AssociationCategory } from "mcp-hubspot/models/components"; -let value: AssociationCategory = "USER_DEFINED"; +let value: AssociationCategory = "HUBSPOT_DEFINED"; ``` ## Values diff --git a/docs/models/components/associationspec.md b/docs/models/components/associationspec.md index 3b005ab..faf951e 100644 --- a/docs/models/components/associationspec.md +++ b/docs/models/components/associationspec.md @@ -7,7 +7,7 @@ import { AssociationSpec } from "mcp-hubspot/models/components"; let value: AssociationSpec = { associationCategory: "USER_DEFINED", - associationTypeId: 652103, + associationTypeId: 754129, }; ``` diff --git a/docs/models/components/collectionresponsewithtotalsimplepublicobjectforwardpaging.md b/docs/models/components/collectionresponsewithtotalsimplepublicobjectforwardpaging.md index 5e7f002..706e4ed 100644 --- a/docs/models/components/collectionresponsewithtotalsimplepublicobjectforwardpaging.md +++ b/docs/models/components/collectionresponsewithtotalsimplepublicobjectforwardpaging.md @@ -6,7 +6,7 @@ import { CollectionResponseWithTotalSimplePublicObjectForwardPaging } from "mcp-hubspot/models/components"; let value: CollectionResponseWithTotalSimplePublicObjectForwardPaging = { - total: 431418, + total: 932692, paging: { next: { link: "?after=NTI1Cg%3D%3D", diff --git a/docs/models/components/filter.md b/docs/models/components/filter.md index e4c624f..a2311f8 100644 --- a/docs/models/components/filter.md +++ b/docs/models/components/filter.md @@ -7,7 +7,7 @@ import { Filter } from "mcp-hubspot/models/components"; let value: Filter = { propertyName: "", - operator: "GTE", + operator: "IN", }; ``` diff --git a/docs/models/components/operator.md b/docs/models/components/operator.md index 573c908..c661f05 100644 --- a/docs/models/components/operator.md +++ b/docs/models/components/operator.md @@ -7,7 +7,7 @@ null ```typescript import { Operator } from "mcp-hubspot/models/components"; -let value: Operator = "GT"; +let value: Operator = "BETWEEN"; ``` ## Values diff --git a/docs/models/components/publicassociationsforobject.md b/docs/models/components/publicassociationsforobject.md index 755c099..543d96f 100644 --- a/docs/models/components/publicassociationsforobject.md +++ b/docs/models/components/publicassociationsforobject.md @@ -9,7 +9,7 @@ let value: PublicAssociationsForObject = { types: [ { associationCategory: "USER_DEFINED", - associationTypeId: 590873, + associationTypeId: 321523, }, ], to: { diff --git a/docs/models/components/simplepublicobjectwithassociations.md b/docs/models/components/simplepublicobjectwithassociations.md index 26ba23a..df787de 100644 --- a/docs/models/components/simplepublicobjectwithassociations.md +++ b/docs/models/components/simplepublicobjectwithassociations.md @@ -6,7 +6,7 @@ import { SimplePublicObjectWithAssociations } from "mcp-hubspot/models/components"; let value: SimplePublicObjectWithAssociations = { - createdAt: new Date("2024-04-14T22:19:54.875Z"), + createdAt: new Date("2025-06-21T16:54:22.539Z"), id: "", properties: { "amount": "1500.00", @@ -18,7 +18,7 @@ let value: SimplePublicObjectWithAssociations = { "hubspot_owner_id": "910901", "pipeline": "default", }, - updatedAt: new Date("2023-05-29T11:30:35.227Z"), + updatedAt: new Date("2024-10-01T05:33:36.814Z"), }; ``` diff --git a/docs/models/components/valuewithtimestamp.md b/docs/models/components/valuewithtimestamp.md index c1e60da..e4af599 100644 --- a/docs/models/components/valuewithtimestamp.md +++ b/docs/models/components/valuewithtimestamp.md @@ -8,7 +8,7 @@ import { ValueWithTimestamp } from "mcp-hubspot/models/components"; let value: ValueWithTimestamp = { sourceType: "", value: "", - timestamp: new Date("2023-11-23T22:01:05.887Z"), + timestamp: new Date("2023-03-21T16:01:07.532Z"), }; ``` diff --git a/docs/models/operations/createcontactresponse.md b/docs/models/operations/createcontactresponse.md index d80f09b..c3dd578 100644 --- a/docs/models/operations/createcontactresponse.md +++ b/docs/models/operations/createcontactresponse.md @@ -27,6 +27,6 @@ const value: components.SimplePublicObject = { ### `Uint8Array` ```typescript -const value: Uint8Array = new TextEncoder().encode("0xe5a532e348"); +const value: Uint8Array = new TextEncoder().encode("0xdC7D3f4be0"); ``` diff --git a/docs/models/operations/createdealresponse.md b/docs/models/operations/createdealresponse.md index 8f9213f..50ab258 100644 --- a/docs/models/operations/createdealresponse.md +++ b/docs/models/operations/createdealresponse.md @@ -27,6 +27,6 @@ const value: components.SimplePublicObject = { ### `Uint8Array` ```typescript -const value: Uint8Array = new TextEncoder().encode("0xcE7e2f64c0"); +const value: Uint8Array = new TextEncoder().encode("0xdC7D3f4be0"); ``` diff --git a/docs/models/operations/getcompanyresponse.md b/docs/models/operations/getcompanyresponse.md index af4cd47..53ee8b3 100644 --- a/docs/models/operations/getcompanyresponse.md +++ b/docs/models/operations/getcompanyresponse.md @@ -7,7 +7,7 @@ ```typescript const value: components.SimplePublicObjectWithAssociations = { - createdAt: new Date("2024-09-14T13:50:38.886Z"), + createdAt: new Date("2024-11-28T12:17:43.309Z"), id: "", properties: { "amount": "1500.00", @@ -19,13 +19,13 @@ const value: components.SimplePublicObjectWithAssociations = { "hubspot_owner_id": "910901", "pipeline": "default", }, - updatedAt: new Date("2025-10-11T10:53:38.306Z"), + updatedAt: new Date("2024-05-22T04:57:54.841Z"), }; ``` ### `Uint8Array` ```typescript -const value: Uint8Array = new TextEncoder().encode("0x110CBDFBaB"); +const value: Uint8Array = new TextEncoder().encode("0xdC7D3f4be0"); ``` diff --git a/docs/models/operations/getcontactresponse.md b/docs/models/operations/getcontactresponse.md index 4e8969c..373ef52 100644 --- a/docs/models/operations/getcontactresponse.md +++ b/docs/models/operations/getcontactresponse.md @@ -7,7 +7,7 @@ ```typescript const value: components.SimplePublicObjectWithAssociations = { - createdAt: new Date("2023-01-21T14:14:48.878Z"), + createdAt: new Date("2024-11-28T12:17:43.309Z"), id: "", properties: { "amount": "1500.00", @@ -19,13 +19,13 @@ const value: components.SimplePublicObjectWithAssociations = { "hubspot_owner_id": "910901", "pipeline": "default", }, - updatedAt: new Date("2024-11-07T22:17:02.814Z"), + updatedAt: new Date("2024-05-22T04:57:54.841Z"), }; ``` ### `Uint8Array` ```typescript -const value: Uint8Array = new TextEncoder().encode("0xddEf79f1ee"); +const value: Uint8Array = new TextEncoder().encode("0xdC7D3f4be0"); ``` diff --git a/docs/models/operations/getdealresponse.md b/docs/models/operations/getdealresponse.md index fa6cf21..bf53647 100644 --- a/docs/models/operations/getdealresponse.md +++ b/docs/models/operations/getdealresponse.md @@ -7,7 +7,7 @@ ```typescript const value: components.SimplePublicObjectWithAssociations = { - createdAt: new Date("2025-06-18T19:24:21.305Z"), + createdAt: new Date("2024-11-28T12:17:43.309Z"), id: "", properties: { "amount": "1500.00", @@ -19,13 +19,13 @@ const value: components.SimplePublicObjectWithAssociations = { "hubspot_owner_id": "910901", "pipeline": "default", }, - updatedAt: new Date("2023-04-17T10:09:07.050Z"), + updatedAt: new Date("2024-05-22T04:57:54.841Z"), }; ``` ### `Uint8Array` ```typescript -const value: Uint8Array = new TextEncoder().encode("0xC2FaFdA062"); +const value: Uint8Array = new TextEncoder().encode("0xdC7D3f4be0"); ``` diff --git a/docs/models/operations/getpropertiesrequest.md b/docs/models/operations/getpropertiesrequest.md index 319da33..0c5d37d 100644 --- a/docs/models/operations/getpropertiesrequest.md +++ b/docs/models/operations/getpropertiesrequest.md @@ -6,7 +6,7 @@ import { GetPropertiesRequest } from "mcp-hubspot/models/operations"; let value: GetPropertiesRequest = { - objectType: "deals", + objectType: "contacts", }; ``` diff --git a/docs/models/operations/getpropertiesresponse.md b/docs/models/operations/getpropertiesresponse.md index ec607c2..41fd5b4 100644 --- a/docs/models/operations/getpropertiesresponse.md +++ b/docs/models/operations/getpropertiesresponse.md @@ -14,6 +14,6 @@ const value: { [k: string]: any } = { ### `Uint8Array` ```typescript -const value: Uint8Array = new TextEncoder().encode("0xdb9e9DF8Bb"); +const value: Uint8Array = new TextEncoder().encode("0xdC7D3f4be0"); ``` diff --git a/docs/models/operations/objecttype.md b/docs/models/operations/objecttype.md index f8a012b..436909d 100644 --- a/docs/models/operations/objecttype.md +++ b/docs/models/operations/objecttype.md @@ -7,7 +7,7 @@ The type of the object for which to retrieve properties. ```typescript import { ObjectType } from "mcp-hubspot/models/operations"; -let value: ObjectType = "companies"; +let value: ObjectType = "contacts"; ``` ## Values diff --git a/docs/models/operations/searchcompaniesresponse.md b/docs/models/operations/searchcompaniesresponse.md index 57c93fd..f4b8a83 100644 --- a/docs/models/operations/searchcompaniesresponse.md +++ b/docs/models/operations/searchcompaniesresponse.md @@ -8,7 +8,7 @@ ```typescript const value: components.CollectionResponseWithTotalSimplePublicObjectForwardPaging = { - total: 828940, + total: 371377, paging: { next: { link: "?after=NTI1Cg%3D%3D", @@ -39,6 +39,6 @@ const value: ### `Uint8Array` ```typescript -const value: Uint8Array = new TextEncoder().encode("0x0e5AF5cdc4"); +const value: Uint8Array = new TextEncoder().encode("0xdC7D3f4be0"); ``` diff --git a/docs/models/operations/searchcontactsresponse.md b/docs/models/operations/searchcontactsresponse.md index 1f9b196..b1e5e54 100644 --- a/docs/models/operations/searchcontactsresponse.md +++ b/docs/models/operations/searchcontactsresponse.md @@ -8,7 +8,7 @@ ```typescript const value: components.CollectionResponseWithTotalSimplePublicObjectForwardPaging = { - total: 952749, + total: 371377, paging: { next: { link: "?after=NTI1Cg%3D%3D", @@ -39,6 +39,6 @@ const value: ### `Uint8Array` ```typescript -const value: Uint8Array = new TextEncoder().encode("0x9Cf6B8DcDf"); +const value: Uint8Array = new TextEncoder().encode("0xdC7D3f4be0"); ``` diff --git a/docs/models/operations/searchdealsresponse.md b/docs/models/operations/searchdealsresponse.md index db9454c..e5cb79a 100644 --- a/docs/models/operations/searchdealsresponse.md +++ b/docs/models/operations/searchdealsresponse.md @@ -8,7 +8,7 @@ ```typescript const value: components.CollectionResponseWithTotalSimplePublicObjectForwardPaging = { - total: 725255, + total: 371377, paging: { next: { link: "?after=NTI1Cg%3D%3D", @@ -39,6 +39,6 @@ const value: ### `Uint8Array` ```typescript -const value: Uint8Array = new TextEncoder().encode("0xbFe9d06e6d"); +const value: Uint8Array = new TextEncoder().encode("0xdC7D3f4be0"); ``` diff --git a/docs/models/operations/updatecompanyresponse.md b/docs/models/operations/updatecompanyresponse.md index b952837..95d47a9 100644 --- a/docs/models/operations/updatecompanyresponse.md +++ b/docs/models/operations/updatecompanyresponse.md @@ -27,6 +27,6 @@ const value: components.SimplePublicObject = { ### `Uint8Array` ```typescript -const value: Uint8Array = new TextEncoder().encode("0x2e3Eb95Bac"); +const value: Uint8Array = new TextEncoder().encode("0xdC7D3f4be0"); ``` diff --git a/docs/models/operations/updatecontactresponse.md b/docs/models/operations/updatecontactresponse.md index b64f945..4e54d41 100644 --- a/docs/models/operations/updatecontactresponse.md +++ b/docs/models/operations/updatecontactresponse.md @@ -27,6 +27,6 @@ const value: components.SimplePublicObject = { ### `Uint8Array` ```typescript -const value: Uint8Array = new TextEncoder().encode("0x4268c9F243"); +const value: Uint8Array = new TextEncoder().encode("0xdC7D3f4be0"); ``` diff --git a/docs/models/operations/updatedealresponse.md b/docs/models/operations/updatedealresponse.md index d0d2bdd..2797620 100644 --- a/docs/models/operations/updatedealresponse.md +++ b/docs/models/operations/updatedealresponse.md @@ -27,6 +27,6 @@ const value: components.SimplePublicObject = { ### `Uint8Array` ```typescript -const value: Uint8Array = new TextEncoder().encode("0x62691fc5b2"); +const value: Uint8Array = new TextEncoder().encode("0xdC7D3f4be0"); ``` diff --git a/eslint.config.mjs b/eslint.config.mjs index 3483f71..67bccfe 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -11,6 +11,7 @@ export default [ { rules: { "no-constant-condition": "off", + "no-useless-escape": "off", // Handled by typescript compiler "@typescript-eslint/no-unused-vars": "off", "@typescript-eslint/no-explicit-any": "off", diff --git a/jsr.json b/jsr.json index 69cb3c6..3f4e9f8 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "mcp-hubspot", - "version": "0.1.0", + "version": "0.1.1", "exports": { ".": "./src/index.ts", "./models/errors": "./src/models/errors/index.ts", diff --git a/package-lock.json b/package-lock.json index ed0ca07..2bd7450 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,18 @@ { "name": "mcp-hubspot", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mcp-hubspot", - "version": "0.1.0", + "version": "0.1.1", "bin": { "mcp": "bin/mcp-server.js" }, "devDependencies": { "@eslint/js": "^9.19.0", - "@modelcontextprotocol/sdk": "^1.5.0", + "@modelcontextprotocol/sdk": ">=1.5.0 <1.10.0", "@stricli/core": "^1.1.1", "@types/express": "^4.17.21", "bun": "^1.2.2", @@ -26,7 +26,7 @@ "zod": "^3.23.4" }, "peerDependencies": { - "@modelcontextprotocol/sdk": "^1.5.0", + "@modelcontextprotocol/sdk": ">=1.5.0 <1.10.0", "zod": ">= 3" }, "peerDependenciesMeta": { diff --git a/package.json b/package.json index 8006f37..470696a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mcp-hubspot", - "version": "0.1.0", + "version": "0.1.1", "author": "speakeasyapi", "type": "module", "bin": { @@ -33,7 +33,7 @@ "prepublishOnly": "npm run build" }, "peerDependencies": { - "@modelcontextprotocol/sdk": "^1.5.0", + "@modelcontextprotocol/sdk": ">=1.5.0 <1.10.0", "zod": ">= 3" }, "peerDependenciesMeta": { @@ -43,7 +43,7 @@ }, "devDependencies": { "@eslint/js": "^9.19.0", - "@modelcontextprotocol/sdk": "^1.5.0", + "@modelcontextprotocol/sdk": ">=1.5.0 <1.10.0", "@stricli/core": "^1.1.1", "@types/express": "^4.17.21", "bun": "^1.2.2", diff --git a/src/hooks/types.ts b/src/hooks/types.ts index f34898c..1d56c6f 100644 --- a/src/hooks/types.ts +++ b/src/hooks/types.ts @@ -9,7 +9,7 @@ import { SecurityState } from "../lib/security.js"; export type HookContext = { baseURL: string | URL; operationID: string; - oAuth2Scopes?: string[]; + oAuth2Scopes: string[] | null; securitySource?: any | (() => Promise); retryConfig: RetryConfig; resolvedSecurity: SecurityState | null; diff --git a/src/lib/config.ts b/src/lib/config.ts index a65a933..e6bb2e9 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -54,7 +54,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "v3", - sdkVersion: "0.1.0", - genVersion: "2.558.5", - userAgent: "speakeasy-sdk/typescript 0.1.0 2.558.5 v3 mcp-hubspot", + sdkVersion: "0.1.1", + genVersion: "2.598.22", + userAgent: "speakeasy-sdk/typescript 0.1.1 2.598.22 v3 mcp-hubspot", } as const; diff --git a/src/lib/matchers.ts b/src/lib/matchers.ts index 65858ac..17151be 100644 --- a/src/lib/matchers.ts +++ b/src/lib/matchers.ts @@ -10,6 +10,7 @@ import { isPlainObject } from "./is-plain-object.js"; import { safeParse } from "./schemas.js"; export type Encoding = + | "jsonl" | "json" | "text" | "bytes" @@ -19,6 +20,7 @@ export type Encoding = | "fail"; const DEFAULT_CONTENT_TYPES: Record = { + jsonl: "application/jsonl", json: "application/json", text: "text/plain", bytes: "application/octet-stream", @@ -72,6 +74,21 @@ export function json( return { ...options, enc: "json", codes, schema }; } +export function jsonl( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions, +): ValueMatcher { + return { ...options, enc: "jsonl", codes, schema }; +} + +export function jsonlErr( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions, +): ErrorMatcher { + return { ...options, err: true, enc: "jsonl", codes, schema }; +} export function textErr( codes: StatusCodePredicate, schema: Schema, @@ -204,6 +221,9 @@ export function match( case "json": raw = await response.json(); break; + case "jsonl": + raw = response.body; + break; case "bytes": raw = new Uint8Array(await response.arrayBuffer()); break; diff --git a/src/lib/sdks.ts b/src/lib/sdks.ts index 7812805..ca552dd 100644 --- a/src/lib/sdks.ts +++ b/src/lib/sdks.ts @@ -47,12 +47,14 @@ export type RequestOptions = { */ serverURL?: string | URL; /** + * @deprecated `fetchOptions` has been flattened into `RequestOptions`. + * * Sets various request options on the `fetch` call made by an SDK method. * * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options|Request} */ fetchOptions?: Omit; -}; +} & Omit; type RequestConfig = { method: string; @@ -172,7 +174,9 @@ export class ClientSDK { cookie = cookie.startsWith("; ") ? cookie.slice(2) : cookie; headers.set("cookie", cookie); - const userHeaders = new Headers(options?.fetchOptions?.headers); + const userHeaders = new Headers( + options?.headers ?? options?.fetchOptions?.headers, + ); for (const [k, v] of userHeaders) { headers.set(k, v); } @@ -183,20 +187,16 @@ export class ClientSDK { headers.set(conf.uaHeader ?? "user-agent", SDK_METADATA.userAgent); } - let fetchOptions = options?.fetchOptions; + const fetchOptions: Omit = { + ...options?.fetchOptions, + ...options, + }; if (!fetchOptions?.signal && conf.timeoutMs && conf.timeoutMs > 0) { const timeoutSignal = AbortSignal.timeout(conf.timeoutMs); - if (!fetchOptions) { - fetchOptions = { signal: timeoutSignal }; - } else { - fetchOptions.signal = timeoutSignal; - } + fetchOptions.signal = timeoutSignal; } if (conf.body instanceof ReadableStream) { - if (!fetchOptions) { - fetchOptions = {}; - } Object.assign(fetchOptions, { duplex: "half" }); } @@ -302,7 +302,9 @@ export class ClientSDK { } } -const jsonLikeContentTypeRE = /^application\/(?:.{0,100}\+)?json/; +const jsonLikeContentTypeRE = /(application|text)\/.*?\+*json.*/; +const jsonlLikeContentTypeRE = + /(application|text)\/(.*?\+*\bjsonl\b.*|.*?\+*\bx-ndjson\b.*)/; async function logRequest(logger: Logger | undefined, req: Request) { if (!logger) { return; @@ -368,9 +370,13 @@ async function logResponse( logger.group("Body:"); switch (true) { case matchContentType(res, "application/json") - || jsonLikeContentTypeRE.test(ct): + || jsonLikeContentTypeRE.test(ct) && !jsonlLikeContentTypeRE.test(ct): logger.log(await res.clone().json()); break; + case matchContentType(res, "application/jsonl") + || jsonlLikeContentTypeRE.test(ct): + logger.log(await res.clone().text()); + break; case matchContentType(res, "text/event-stream"): logger.log(`<${contentType}>`); break; diff --git a/src/mcp-server/mcp-server.ts b/src/mcp-server/mcp-server.ts index 549dc47..f87e0d0 100644 --- a/src/mcp-server/mcp-server.ts +++ b/src/mcp-server/mcp-server.ts @@ -19,7 +19,7 @@ const routes = buildRouteMap({ export const app = buildApplication(routes, { name: "mcp", versionInfo: { - currentVersion: "0.1.0", + currentVersion: "0.1.1", }, }); diff --git a/src/mcp-server/prompts.ts b/src/mcp-server/prompts.ts index 48080de..5696e3a 100644 --- a/src/mcp-server/prompts.ts +++ b/src/mcp-server/prompts.ts @@ -74,7 +74,14 @@ export function createRegisterPrompt( prompt: PromptDefinition, ): void => { const scopes = prompt.scopes ?? []; - if (!scopes.every((s: MCPScope) => allowedScopes.has(s))) { + if (allowedScopes.size > 0 && scopes.length === 0) { + return; + } + + if ( + allowedScopes.size > 0 + && !scopes.every((s: MCPScope) => allowedScopes.has(s)) + ) { return; } diff --git a/src/mcp-server/resources.ts b/src/mcp-server/resources.ts index 70ea028..c433843 100644 --- a/src/mcp-server/resources.ts +++ b/src/mcp-server/resources.ts @@ -109,7 +109,14 @@ export function createRegisterResource( ): (resource: ResourceDefinition) => void { return (resource: ResourceDefinition): void => { const scopes = resource.scopes ?? []; - if (!scopes.every((s: MCPScope) => allowedScopes.has(s))) { + if (allowedScopes.size > 0 && scopes.length === 0) { + return; + } + + if ( + allowedScopes.size > 0 + && !scopes.every((s: MCPScope) => allowedScopes.has(s)) + ) { return; } @@ -137,7 +144,14 @@ export function createRegisterResourceTemplate( ): (resource: ResourceTemplateDefinition) => void { return (resource: ResourceTemplateDefinition): void => { const scopes = resource.scopes ?? []; - if (!scopes.every((s: MCPScope) => allowedScopes.has(s))) { + if (allowedScopes.size > 0 && scopes.length === 0) { + return; + } + + if ( + allowedScopes.size > 0 + && !scopes.every((s: MCPScope) => allowedScopes.has(s)) + ) { return; } diff --git a/src/mcp-server/server.ts b/src/mcp-server/server.ts index 0d51f98..7bd3c12 100644 --- a/src/mcp-server/server.ts +++ b/src/mcp-server/server.ts @@ -6,12 +6,14 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { HubspotCore } from "../core.js"; import { SDKOptions } from "../lib/config.js"; import type { ConsoleLogger } from "./console-logger.js"; +import { Register } from "./extensions.js"; import { createRegisterPrompt } from "./prompts.js"; import { createRegisterResource, createRegisterResourceTemplate, } from "./resources.js"; -import { MCPScope, mcpScopes } from "./scopes.js"; +import { MCPScope } from "./scopes.js"; +import { registerMCPExtensions } from "./server.extensions.js"; import { createRegisterTool } from "./tools.js"; import { tool$basicCreateContact } from "./tools/basicCreateContact.js"; import { tool$basicCreateDeal } from "./tools/basicCreateDeal.js"; @@ -36,7 +38,7 @@ export function createMCPServer(deps: { }) { const server = new McpServer({ name: "Hubspot", - version: "0.1.0", + version: "0.1.1", }); const client = new HubspotCore({ @@ -45,7 +47,7 @@ export function createMCPServer(deps: { serverIdx: deps.serverIdx, }); - const scopes = new Set(deps.scopes ?? mcpScopes); + const scopes = new Set(deps.scopes); const allowedTools = deps.allowedTools && new Set(deps.allowedTools); const tool = createRegisterTool( @@ -79,5 +81,7 @@ export function createMCPServer(deps: { tool(tool$searchSearchContacts); tool(tool$searchSearchDeals); + registerMCPExtensions(register satisfies Register); + return server; } diff --git a/src/mcp-server/tools.ts b/src/mcp-server/tools.ts index 690f648..91bcb29 100644 --- a/src/mcp-server/tools.ts +++ b/src/mcp-server/tools.ts @@ -102,12 +102,15 @@ export function createRegisterTool( return; } - const toolScopes = tool.scopes ?? []; - if (allowedScopes.size > 0 && toolScopes.length === 0) { + const scopes = tool.scopes ?? []; + if (allowedScopes.size > 0 && scopes.length === 0) { return; } - if (!toolScopes.every((s) => allowedScopes.has(s))) { + if ( + allowedScopes.size > 0 + && !scopes.every((s: MCPScope) => allowedScopes.has(s)) + ) { return; }