Skip to content

Commit ef51acc

Browse files
chore: configure new SDK language
1 parent d3907b7 commit ef51acc

File tree

82 files changed

+12205
-6
lines changed

Some content is hidden

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

82 files changed

+12205
-6
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Set up Node
2525
uses: actions/setup-node@v4
2626
with:
27-
node-version: '20'
27+
node-version: '22'
2828

2929
- name: Bootstrap
3030
run: ./scripts/bootstrap
@@ -46,7 +46,7 @@ jobs:
4646
- name: Set up Node
4747
uses: actions/setup-node@v4
4848
with:
49-
node-version: '20'
49+
node-version: '22'
5050

5151
- name: Bootstrap
5252
run: ./scripts/bootstrap
@@ -68,6 +68,15 @@ jobs:
6868
AUTH: ${{ steps.github-oidc.outputs.github_token }}
6969
SHA: ${{ github.sha }}
7070
run: ./scripts/utils/upload-artifact.sh
71+
72+
- name: Upload MCP Server tarball
73+
if: github.repository == 'stainless-sdks/imagekit-typescript'
74+
env:
75+
URL: https://pkg.stainless.com/s?subpackage=mcp-server
76+
AUTH: ${{ steps.github-oidc.outputs.github_token }}
77+
SHA: ${{ github.sha }}
78+
BUILD_PATH: packages/mcp-server/dist
79+
run: ./scripts/utils/upload-artifact.sh
7180
test:
7281
timeout-minutes: 10
7382
name: test
@@ -79,10 +88,13 @@ jobs:
7988
- name: Set up Node
8089
uses: actions/setup-node@v4
8190
with:
82-
node-version: '20'
91+
node-version: '22'
8392

8493
- name: Bootstrap
8594
run: ./scripts/bootstrap
8695

96+
- name: Build
97+
run: ./scripts/build
98+
8799
- name: Run tests
88100
run: ./scripts/test

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ CHANGELOG.md
44
/deno
55

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

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 42
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-e798e75f763868cfd2babe250a0d880a651b19f9e1b9a3b567d629eea9893147.yml
33
openapi_spec_hash: 45341845beb1363b7dcb4050934b9cf0
4-
config_hash: 90f5a16140d721a24bffafbc30abaf35
4+
config_hash: d1c62fed14fedf6774ac70983dc71d68

eslint.config.mjs

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

packages/mcp-server/README.md

Lines changed: 372 additions & 0 deletions
Large diffs are not rendered by default.

packages/mcp-server/build

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
set -exuo pipefail
3+
4+
rm -rf dist; mkdir dist
5+
6+
# Copy src to dist/src and build from dist/src into dist, so that
7+
# the source map for index.js.map will refer to ./src/index.ts etc
8+
cp -rp src README.md dist
9+
10+
for file in LICENSE; do
11+
if [ -e "../../${file}" ]; then cp "../../${file}" dist; fi
12+
done
13+
14+
for file in CHANGELOG.md; do
15+
if [ -e "${file}" ]; then cp "${file}" dist; fi
16+
done
17+
18+
# this converts the export map paths for the dist directory
19+
# and does a few other minor things
20+
PKG_JSON_PATH=../../packages/mcp-server/package.json node ../../scripts/utils/make-dist-package-json.cjs > dist/package.json
21+
22+
# updates the `@imagekit/nodejs` dependency to point to NPM
23+
node scripts/postprocess-dist-package-json.cjs
24+
25+
# build to .js/.mjs/.d.ts files
26+
./node_modules/.bin/tsc-multi
27+
28+
cp tsconfig.dist-src.json dist/src/tsconfig.json
29+
30+
chmod +x dist/index.js
31+
32+
DIST_PATH=./dist PKG_IMPORT_PATH=@imagekit/nodejs-mcp/ node ../../scripts/utils/postprocess-files.cjs

packages/mcp-server/jest.config.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { JestConfigWithTsJest } from 'ts-jest';
2+
3+
const config: JestConfigWithTsJest = {
4+
preset: 'ts-jest/presets/default-esm',
5+
testEnvironment: 'node',
6+
transform: {
7+
'^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
8+
},
9+
moduleNameMapper: {
10+
'^@imagekit/nodejs-mcp$': '<rootDir>/src/index.ts',
11+
'^@imagekit/nodejs-mcp/(.*)$': '<rootDir>/src/$1',
12+
},
13+
modulePathIgnorePatterns: ['<rootDir>/dist/'],
14+
testPathIgnorePatterns: ['scripts'],
15+
};
16+
17+
export default config;

packages/mcp-server/package.json

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"name": "@imagekit/nodejs-mcp",
3+
"version": "0.0.1-alpha.0",
4+
"description": "The official MCP Server for the Image Kit API",
5+
"author": "Image Kit <[email protected]>",
6+
"types": "dist/index.d.ts",
7+
"main": "dist/index.js",
8+
"type": "commonjs",
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/stainless-sdks/imagekit-typescript.git",
12+
"directory": "packages/mcp-server"
13+
},
14+
"homepage": "https://github.com/stainless-sdks/imagekit-typescript/tree/main/packages/mcp-server#readme",
15+
"license": "Apache-2.0",
16+
"packageManager": "[email protected]",
17+
"private": false,
18+
"publishConfig": {
19+
"access": "public"
20+
},
21+
"scripts": {
22+
"test": "jest",
23+
"build": "bash ./build",
24+
"prepack": "echo 'to pack, run yarn build && (cd dist; yarn pack)' && exit 1",
25+
"prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1",
26+
"format": "prettier --write --cache --cache-strategy metadata . !dist",
27+
"prepare": "npm run build",
28+
"tsn": "ts-node -r tsconfig-paths/register",
29+
"lint": "eslint --ext ts,js .",
30+
"fix": "eslint --fix --ext ts,js ."
31+
},
32+
"dependencies": {
33+
"@imagekit/nodejs": "file:../../dist/",
34+
"@cloudflare/cabidela": "^0.2.4",
35+
"@modelcontextprotocol/sdk": "^1.11.5",
36+
"@valtown/deno-http-worker": "^0.0.21",
37+
"cors": "^2.8.5",
38+
"express": "^5.1.0",
39+
"jq-web": "https://github.com/stainless-api/jq-web/releases/download/v0.8.6/jq-web.tar.gz",
40+
"qs": "^6.14.0",
41+
"yargs": "^17.7.2",
42+
"zod": "^3.25.20",
43+
"zod-to-json-schema": "^3.24.5",
44+
"zod-validation-error": "^4.0.1"
45+
},
46+
"bin": {
47+
"mcp-server": "dist/index.js"
48+
},
49+
"devDependencies": {
50+
"@types/cors": "^2.8.19",
51+
"@types/express": "^5.0.3",
52+
"@types/jest": "^29.4.0",
53+
"@types/qs": "^6.14.0",
54+
"@types/yargs": "^17.0.8",
55+
"@typescript-eslint/eslint-plugin": "8.31.1",
56+
"@typescript-eslint/parser": "8.31.1",
57+
"eslint": "^8.49.0",
58+
"eslint-plugin-prettier": "^5.0.1",
59+
"eslint-plugin-unused-imports": "^3.0.0",
60+
"jest": "^29.4.0",
61+
"prettier": "^3.0.0",
62+
"ts-jest": "^29.1.0",
63+
"ts-morph": "^19.0.0",
64+
"ts-node": "^10.5.0",
65+
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.9/tsc-multi.tgz",
66+
"tsconfig-paths": "^4.0.0",
67+
"typescript": "5.8.3"
68+
},
69+
"imports": {
70+
"@imagekit/nodejs-mcp": ".",
71+
"@imagekit/nodejs-mcp/*": "./src/*"
72+
},
73+
"exports": {
74+
".": {
75+
"require": "./dist/index.js",
76+
"default": "./dist/index.mjs"
77+
},
78+
"./*.mjs": "./dist/*.mjs",
79+
"./*.js": "./dist/*.js",
80+
"./*": {
81+
"require": "./dist/*.js",
82+
"default": "./dist/*.mjs"
83+
}
84+
}
85+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const fs = require('fs');
2+
const pkgJson = require('../dist/package.json');
3+
const parentPkgJson = require('../../../package.json');
4+
5+
for (const dep in pkgJson.dependencies) {
6+
// ensure we point to NPM instead of a local directory
7+
if (dep === '@imagekit/nodejs') {
8+
pkgJson.dependencies[dep] = '^' + parentPkgJson.version;
9+
}
10+
}
11+
12+
fs.writeFileSync('dist/package.json', JSON.stringify(pkgJson, null, 2));
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
export const workerPath = require.resolve('./code-tool-worker.mjs');

0 commit comments

Comments
 (0)