Skip to content

Commit 45a1eb1

Browse files
chore: configure new SDK language
1 parent 4f03f3c commit 45a1eb1

44 files changed

Lines changed: 66639 additions & 10 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Dependencies
2+
node_modules/
3+
**/node_modules/
4+
5+
# Build outputs
6+
dist/
7+
**/dist/
8+
9+
# Git
10+
.git/
11+
.gitignore
12+
13+
# CI/CD
14+
.github/
15+
.gitlab-ci.yml
16+
.travis.yml
17+
18+
# IDE
19+
.vscode/
20+
.idea/
21+
*.swp
22+
*.swo
23+
*~
24+
25+
# OS
26+
.DS_Store
27+
Thumbs.db
28+
29+
# Testing
30+
test/
31+
tests/
32+
__tests__/
33+
*.test.js
34+
*.spec.js
35+
coverage/
36+
.nyc_output/
37+
38+
# Logs
39+
*.log
40+
npm-debug.log*
41+
yarn-debug.log*
42+
yarn-error.log*
43+
44+
# Environment
45+
.env
46+
.env.*
47+
48+
# Temporary files
49+
*.tmp
50+
*.temp
51+
.cache/
52+
53+
# Examples and scripts
54+
examples/
55+
bin/
56+
57+
# Other packages (we only need mcp-server)
58+
packages/*/
59+
!packages/mcp-server/

.github/workflows/ci.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Set up Node
2727
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2828
with:
29-
node-version: '20'
29+
node-version: '22'
3030

3131
- name: Bootstrap
3232
run: ./scripts/bootstrap
@@ -48,7 +48,7 @@ jobs:
4848
- name: Set up Node
4949
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
5050
with:
51-
node-version: '20'
51+
node-version: '22'
5252

5353
- name: Bootstrap
5454
run: ./scripts/bootstrap
@@ -74,6 +74,17 @@ jobs:
7474
AUTH: ${{ steps.github-oidc.outputs.github_token }}
7575
SHA: ${{ github.sha }}
7676
run: ./scripts/utils/upload-artifact.sh
77+
78+
- name: Upload MCP Server tarball
79+
if: |-
80+
github.repository == 'stainless-sdks/hubspot-sdk-typescript' &&
81+
!startsWith(github.ref, 'refs/heads/stl/')
82+
env:
83+
URL: https://pkg.stainless.com/s?subpackage=mcp-server
84+
AUTH: ${{ steps.github-oidc.outputs.github_token }}
85+
SHA: ${{ github.sha }}
86+
BASE_PATH: packages/mcp-server
87+
run: ./scripts/utils/upload-artifact.sh
7788
test:
7889
timeout-minutes: 10
7990
name: test
@@ -85,10 +96,13 @@ jobs:
8596
- name: Set up Node
8697
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
8798
with:
88-
node-version: '20'
99+
node-version: '22'
89100

90101
- name: Bootstrap
91102
run: ./scripts/bootstrap
92103

104+
- name: Build
105+
run: ./scripts/build
106+
93107
- name: Run tests
94108
run: ./scripts/test

.github/workflows/publish-npm.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
name: Publish NPM
55
on:
66
workflow_dispatch:
7+
inputs:
8+
path:
9+
description: The path to run the release in, e.g. '.' or 'packages/mcp-server'
10+
required: true
711

812
release:
913
types: [published]
@@ -13,7 +17,7 @@ jobs:
1317
name: publish
1418
runs-on: ubuntu-latest
1519
permissions:
16-
contents: read
20+
contents: write
1721
id-token: write
1822

1923
steps:
@@ -30,4 +34,18 @@ jobs:
3034
3135
- name: Publish to NPM
3236
run: |
33-
bash ./bin/publish-npm
37+
if [ -n "$INPUT_PATH" ]; then
38+
PATHS_RELEASED="[\"$INPUT_PATH\"]"
39+
else
40+
PATHS_RELEASED='[\".\", \"packages/mcp-server\"]'
41+
fi
42+
yarn tsn scripts/publish-packages.ts "{ \"paths_released\": \"$PATHS_RELEASED\" }"
43+
env:
44+
INPUT_PATH: ${{ github.event.inputs.path }}
45+
46+
- name: Upload MCP Server DXT GitHub release asset
47+
run: |
48+
gh release upload ${{ github.event.release.tag_name }} \
49+
packages/mcp-server/hubspot_sdk_api.mcpb
50+
env:
51+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ dist-deno
99
/*.tgz
1010
.idea/
1111
.eslintcache
12+
dist-bundle
13+
*.mcpb
1214
oidc

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ CHANGELOG.md
22
/ecosystem-tests/*/**
33
/node_modules
44
/deno
5+
/packages/mcp-server/manifest.json
56

67
# don't format tsc output, will break source maps
7-
/dist
8+
dist

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 955
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hubspot/hubspot-sdk-8aa2c4935982d3998769d656b2caae13c71151b5f00caaa875357ceb83f6e0a6.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hubspot/hubspot-sdk-d306a9f90ec487d227a47c390018997eebc86a5983ac7fe21f945b82a74868db.yml
33
openapi_spec_hash: 47d20b6496315d47f4f64441d4682f47
4-
config_hash: 9c2a17b9755f3edac92a3ec4b93ac51c
4+
config_hash: f0caff211e137f418213baf5da549f3b

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ The REST API documentation can be found on [developers.hubspot.com](https://deve
88

99
It is generated with [Stainless](https://www.stainless.com/).
1010

11+
## MCP Server
12+
13+
Use the HubSpot MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
14+
15+
[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40hubspot%2Fsdk-mcp&config=eyJjb21tYW5kIjo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guOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40hubspot%2Fsdk-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40hubspot%2Fsdk-mcp%22%5D%2C%22env%22%3A%7B%22HUBSPOT_ACCESS_TOKEN%22%3A%22My%20Access%20Token%22%2C%22HUBSPOT_DEVELOPER_API_KEY%22%3A%22My%20Developer%20API%20Key%22%7D%7D)
17+
18+
> Note: You may need to set environment variables in your MCP client.
19+
1120
## Installation
1221

1322
```sh

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default tseslint.config(
3131
},
3232
},
3333
{
34-
files: ['tests/**', 'examples/**'],
34+
files: ['tests/**', 'examples/**', 'packages/**'],
3535
rules: {
3636
'no-restricted-imports': 'off',
3737
},

packages/mcp-server/Dockerfile

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Dockerfile for HubSpot MCP Server
2+
#
3+
# This Dockerfile builds a Docker image for the MCP Server.
4+
#
5+
# To build the image locally:
6+
# docker build -f packages/mcp-server/Dockerfile -t @hubspot/sdk-mcp:local .
7+
#
8+
# To run the image:
9+
# docker run -i @hubspot/sdk-mcp:local [OPTIONS]
10+
#
11+
# Common options:
12+
# --tool=<name> Include specific tools
13+
# --resource=<name> Include tools for specific resources
14+
# --operation=read|write Filter by operation type
15+
# --client=<type> Set client compatibility (e.g., claude, cursor)
16+
# --transport=<type> Set transport type (stdio or http)
17+
#
18+
# For a full list of options:
19+
# docker run -i @hubspot/sdk-mcp:local --help
20+
#
21+
# Note: The MCP server uses stdio transport by default. Docker's -i flag
22+
# enables interactive mode, allowing the container to communicate over stdin/stdout.
23+
24+
# Build stage
25+
FROM node:24-alpine AS builder
26+
27+
# Install bash for build script
28+
RUN apk add --no-cache bash openssl
29+
30+
# Set working directory
31+
WORKDIR /build
32+
33+
# Copy entire repository
34+
COPY . .
35+
36+
# Install all dependencies and build everything
37+
RUN yarn install --frozen-lockfile && \
38+
yarn build && \
39+
# Remove the symlink to the SDK so it doesn't interfere with the explicit COPY below
40+
rm -Rf packages/mcp-server/node_modules/@hubspot/sdk
41+
42+
FROM denoland/deno:alpine-2.7.1
43+
44+
# Install node and npm
45+
RUN apk add --no-cache nodejs npm
46+
47+
ENV LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
48+
49+
# Add non-root user
50+
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
51+
52+
# Set working directory
53+
WORKDIR /app
54+
55+
# Copy the built mcp-server dist directory
56+
COPY --from=builder /build/packages/mcp-server/dist ./
57+
58+
# Copy node_modules from mcp-server (includes all production deps)
59+
COPY --from=builder /build/packages/mcp-server/node_modules ./node_modules
60+
61+
# Copy the built @hubspot/sdk into node_modules
62+
COPY --from=builder /build/dist ./node_modules/@hubspot/sdk
63+
64+
# Change ownership to nodejs user
65+
RUN chown -R nodejs:nodejs /app
66+
RUN chown -R nodejs:nodejs /deno-dir
67+
68+
# Switch to non-root user
69+
USER nodejs
70+
71+
# The MCP server uses stdio transport by default
72+
# No exposed ports needed for stdio communication
73+
74+
# Set the entrypoint to the MCP server
75+
ENTRYPOINT ["node", "index.js"]
76+
77+
# Allow passing arguments to the MCP server
78+
CMD []

packages/mcp-server/README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# HubSpot TypeScript MCP Server
2+
3+
It is generated with [Stainless](https://www.stainless.com/).
4+
5+
## Installation
6+
7+
### Direct invocation
8+
9+
You can run the MCP Server directly via `npx`:
10+
11+
```sh
12+
export HUBSPOT_ACCESS_TOKEN="My Access Token"
13+
export HUBSPOT_DEVELOPER_API_KEY="My Developer API Key"
14+
npx -y @hubspot/sdk-mcp@latest
15+
```
16+
17+
### Via MCP Client
18+
19+
There is a partial list of existing clients at [modelcontextprotocol.io](https://modelcontextprotocol.io/clients). If you already
20+
have a client, consult their documentation to install the MCP server.
21+
22+
For clients with a configuration JSON, it might look something like this:
23+
24+
```json
25+
{
26+
"mcpServers": {
27+
"hubspot_sdk_api": {
28+
"command": "npx",
29+
"args": ["-y", "@hubspot/sdk-mcp"],
30+
"env": {
31+
"HUBSPOT_ACCESS_TOKEN": "My Access Token",
32+
"HUBSPOT_DEVELOPER_API_KEY": "My Developer API Key"
33+
}
34+
}
35+
}
36+
}
37+
```
38+
39+
### Cursor
40+
41+
If you use Cursor, you can install the MCP server by using the button below. You will need to set your environment variables
42+
in Cursor's `mcp.json`, which can be found in Cursor Settings > Tools & MCP > New MCP Server.
43+
44+
[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40hubspot%2Fsdk-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBodWJzcG90L3Nkay1tY3AiXSwiZW52Ijp7IkhVQlNQT1RfQUNDRVNTX1RPS0VOIjoiTXkgQWNjZXNzIFRva2VuIiwiSFVCU1BPVF9ERVZFTE9QRVJfQVBJX0tFWSI6Ik15IERldmVsb3BlciBBUEkgS2V5In19)
45+
46+
### VS Code
47+
48+
If you use MCP, you can install the MCP server by clicking the link below. You will need to set your environment variables
49+
in VS Code's `mcp.json`, which can be found via Command Palette > MCP: Open User Configuration.
50+
51+
[Open VS Code](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40hubspot%2Fsdk-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40hubspot%2Fsdk-mcp%22%5D%2C%22env%22%3A%7B%22HUBSPOT_ACCESS_TOKEN%22%3A%22My%20Access%20Token%22%2C%22HUBSPOT_DEVELOPER_API_KEY%22%3A%22My%20Developer%20API%20Key%22%7D%7D)
52+
53+
### Claude Code
54+
55+
If you use Claude Code, you can install the MCP server by running the command below in your terminal. You will need to set your
56+
environment variables in Claude Code's `.claude.json`, which can be found in your home directory.
57+
58+
```
59+
claude mcp add hubspot_sdk_mcp_api --env HUBSPOT_ACCESS_TOKEN="My Access Token" HUBSPOT_DEVELOPER_API_KEY="My Developer API Key" -- npx -y @hubspot/sdk-mcp
60+
```
61+
62+
## Code Mode
63+
64+
This MCP server is built on the "Code Mode" tool scheme. In this MCP Server,
65+
your agent will write code against the TypeScript SDK, which will then be executed in an
66+
isolated sandbox. To accomplish this, the server will expose two tools to your agent:
67+
68+
- The first tool is a docs search tool, which can be used to generically query for
69+
documentation about your API/SDK.
70+
71+
- The second tool is a code tool, where the agent can write code against the TypeScript SDK.
72+
The code will be executed in a sandbox environment without web or filesystem access. Then,
73+
anything the code returns or prints will be returned to the agent as the result of the
74+
tool call.
75+
76+
Using this scheme, agents are capable of performing very complex tasks deterministically
77+
and repeatably.
78+
79+
## Running remotely
80+
81+
Launching the client with `--transport=http` launches the server as a remote server using Streamable HTTP transport. The `--port` setting can choose the port it will run on, and the `--socket` setting allows it to run on a Unix socket.
82+
83+
Authorization can be provided via the `Authorization` header using the Bearer scheme.
84+
85+
A configuration JSON for this server might look like this, assuming the server is hosted at `http://localhost:3000`:
86+
87+
```json
88+
{
89+
"mcpServers": {
90+
"hubspot_sdk_api": {
91+
"url": "http://localhost:3000",
92+
"headers": {
93+
"Authorization": "Bearer <auth value>"
94+
}
95+
}
96+
}
97+
}
98+
```

0 commit comments

Comments
 (0)