Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b448966
feat(mcp): remote server with passthru auth
stainless-app[bot] Aug 5, 2025
b03a102
chore(internal): move publish config
stainless-app[bot] Aug 7, 2025
6d1f099
chore(mcp): refactor streamable http transport
stainless-app[bot] Aug 7, 2025
beb9dd4
feat(mcp): add unix socket option for remote MCP
stainless-app[bot] Aug 7, 2025
bf1ff9d
chore: update @stainless-api/prism-cli to v5.15.0
stainless-app[bot] Aug 9, 2025
343c9ab
chore(internal): update comment in script
stainless-app[bot] Aug 9, 2025
235bda2
chore(internal): codegen related update
stainless-app[bot] Aug 12, 2025
64fc7d2
chore(mcp): minor cleanup of types and package.json
stainless-app[bot] Aug 14, 2025
81531a2
chore(mcp): document remote server in README.md
stainless-app[bot] Aug 15, 2025
ad63e7b
chore(deps): update dependency @types/node to v20.17.58
stainless-app[bot] Aug 16, 2025
1d29e14
chore(mcp): update README
stainless-app[bot] Aug 16, 2025
7a289dc
chore(internal): formatting change
stainless-app[bot] Aug 16, 2025
6103b1b
feat(mcp): parse query string as mcp client options in mcp server
stainless-app[bot] Aug 26, 2025
437ad15
chore(internal): refactor array check
stainless-app[bot] Aug 19, 2025
49567de
chore(mcp): add cors to oauth metadata route
stainless-app[bot] Aug 20, 2025
1e6e47f
feat(mcp): add code execution tool
stainless-app[bot] Aug 20, 2025
b493034
chore(internal): make mcp-server publishing public by defaut
stainless-app[bot] Aug 21, 2025
1a28e8d
feat(mcp): add option to infer mcp client
stainless-app[bot] Aug 21, 2025
3e205e0
chore(mcp): update package.json
stainless-app[bot] Aug 22, 2025
966b167
chore(mcp): update types
stainless-app[bot] Aug 22, 2025
b2a1a45
chore: add package to package.json
stainless-app[bot] Aug 22, 2025
195cb9c
chore(internal): codegen related update
stainless-app[bot] Aug 22, 2025
792a72d
chore(client): qualify global Blob
stainless-app[bot] Aug 22, 2025
0afb400
chore: update CI script
stainless-app[bot] Aug 23, 2025
e5baf0e
chore(internal): codegen related update
stainless-app[bot] Aug 24, 2025
e78611f
chore(internal): update global Error reference
stainless-app[bot] Aug 29, 2025
fd97dcd
release: 2.4.0
stainless-app[bot] Aug 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'

- name: Bootstrap
run: ./scripts/bootstrap
Expand All @@ -46,7 +46,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'

- name: Bootstrap
run: ./scripts/bootstrap
Expand All @@ -68,6 +68,15 @@ jobs:
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
run: ./scripts/utils/upload-artifact.sh

- name: Upload MCP Server tarball
if: github.repository == 'stainless-sdks/img-processing-typescript'
env:
URL: https://pkg.stainless.com/s?subpackage=mcp-server
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
BUILD_PATH: packages/mcp-server/dist
run: ./scripts/utils/upload-artifact.sh
test:
timeout-minutes: 10
name: test
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.3.3"
".": "2.4.0"
}
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# Changelog

## 2.4.0 (2025-08-29)

Full Changelog: [v2.3.3...v2.4.0](https://github.com/img-processing/node-sdk/compare/v2.3.3...v2.4.0)

### Features

* **mcp:** add code execution tool ([1e6e47f](https://github.com/img-processing/node-sdk/commit/1e6e47fc112ed1f4fa4aea3ee9e169f431a22bf1))
* **mcp:** add option to infer mcp client ([1a28e8d](https://github.com/img-processing/node-sdk/commit/1a28e8d295b20d9fc36ab300b7c8ea6dff1950e6))
* **mcp:** add unix socket option for remote MCP ([beb9dd4](https://github.com/img-processing/node-sdk/commit/beb9dd48f980afb651e8046d666a0dbf4be92e6b))
* **mcp:** parse query string as mcp client options in mcp server ([6103b1b](https://github.com/img-processing/node-sdk/commit/6103b1b9d4fc2381717803cdcbfb77957f8859c9))
* **mcp:** remote server with passthru auth ([b448966](https://github.com/img-processing/node-sdk/commit/b4489666ad7cd444ec4b2bbe28775a6ccd402bc4))


### Chores

* add package to package.json ([b2a1a45](https://github.com/img-processing/node-sdk/commit/b2a1a45fd1316f254c976a9493a39b0d313c868a))
* **client:** qualify global Blob ([792a72d](https://github.com/img-processing/node-sdk/commit/792a72daac7498fdbac113f863b4e8f0b6edc62c))
* **deps:** update dependency @types/node to v20.17.58 ([ad63e7b](https://github.com/img-processing/node-sdk/commit/ad63e7b9bcc1660e8f755d5b263c9d6cf7613ab5))
* **internal:** codegen related update ([e5baf0e](https://github.com/img-processing/node-sdk/commit/e5baf0e86fe7f855f27379b0e80103df289a307f))
* **internal:** codegen related update ([195cb9c](https://github.com/img-processing/node-sdk/commit/195cb9c3218de2d995f6e7c5662fd0551751067e))
* **internal:** codegen related update ([235bda2](https://github.com/img-processing/node-sdk/commit/235bda2cc08877691f5c3e1f6f31da6db2a42537))
* **internal:** formatting change ([7a289dc](https://github.com/img-processing/node-sdk/commit/7a289dc0129a6db46b90b7abe806713a076cc24b))
* **internal:** make mcp-server publishing public by defaut ([b493034](https://github.com/img-processing/node-sdk/commit/b4930345e7268166a1a9f8cff5ed68b6ffa8a101))
* **internal:** move publish config ([b03a102](https://github.com/img-processing/node-sdk/commit/b03a102678859ed5c2d0a49c762a4297f82a5e8e))
* **internal:** refactor array check ([437ad15](https://github.com/img-processing/node-sdk/commit/437ad156ec381cae1858a627a6d07bfbe2456221))
* **internal:** update comment in script ([343c9ab](https://github.com/img-processing/node-sdk/commit/343c9ab3c7fe13e06cafc9fa4db0700f59c5ab05))
* **internal:** update global Error reference ([e78611f](https://github.com/img-processing/node-sdk/commit/e78611f130006a3ca8482de1f2ff747bbb35d051))
* **mcp:** add cors to oauth metadata route ([49567de](https://github.com/img-processing/node-sdk/commit/49567de051340ae276b1cc11912e298a36a0cb1c))
* **mcp:** document remote server in README.md ([81531a2](https://github.com/img-processing/node-sdk/commit/81531a2158ed50b1c098846b3114950f219ce779))
* **mcp:** minor cleanup of types and package.json ([64fc7d2](https://github.com/img-processing/node-sdk/commit/64fc7d2f2b8990bafa2cb9928aece64f8044c368))
* **mcp:** refactor streamable http transport ([6d1f099](https://github.com/img-processing/node-sdk/commit/6d1f099f3740a952409a11fe29412115aaa5aad0))
* **mcp:** update package.json ([3e205e0](https://github.com/img-processing/node-sdk/commit/3e205e09432c5eb5488f52d8572bd2305f761714))
* **mcp:** update README ([1d29e14](https://github.com/img-processing/node-sdk/commit/1d29e1483a17241d30d2f18d2242282aa826ce6f))
* **mcp:** update types ([966b167](https://github.com/img-processing/node-sdk/commit/966b167ad9badb70b3e32dfdbf4d5bc494ae23aa))
* update @stainless-api/prism-cli to v5.15.0 ([bf1ff9d](https://github.com/img-processing/node-sdk/commit/bf1ff9d7508d52d1455ce5bb7770476a1192513b))
* update CI script ([0afb400](https://github.com/img-processing/node-sdk/commit/0afb400dbda3935f8c7dad1da6f87ab019665efc))

## 2.3.3 (2025-08-02)

Full Changelog: [v2.3.2...v2.3.3](https://github.com/img-processing/node-sdk/compare/v2.3.2...v2.3.3)
Expand Down
2 changes: 1 addition & 1 deletion bin/publish-npm
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ else
fi

# Publish with the appropriate tag
yarn publish --access public --tag "$TAG"
yarn publish --tag "$TAG"
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "img-processing-sdk",
"version": "2.3.3",
"version": "2.4.0",
"description": "The official TypeScript library for the Img Processing API",
"author": "Img Processing <[email protected]>",
"types": "dist/index.d.ts",
Expand All @@ -13,6 +13,9 @@
"**/*"
],
"private": false,
"publishConfig": {
"access": "public"
},
"scripts": {
"test": "./scripts/test",
"build": "./scripts/build",
Expand Down Expand Up @@ -41,8 +44,9 @@
"publint": "^0.2.12",
"ts-jest": "^29.1.0",
"ts-node": "^10.5.0",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.9/tsc-multi.tgz",
"tsconfig-paths": "^4.0.0",
"tslib": "^2.8.1",
"typescript": "5.8.3",
"typescript-eslint": "8.31.1"
},
Expand Down
37 changes: 37 additions & 0 deletions packages/mcp-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,43 @@ over time, you can manually enable or disable certain capabilities:
--resource=cards,accounts --operation=read --tag=kyc --no-tool=create_cards
```

## Running remotely

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.

Authorization can be provided via the following headers:
| Header | Equivalent client option | Security scheme |
| ----------- | ------------------------ | --------------- |
| `x-api-key` | `apiKey` | ApiKeyAuth |

A configuration JSON for this server might look like this, assuming the server is hosted at `http://localhost:3000`:

```json
{
"mcpServers": {
"img_processing_sdk_api": {
"url": "http://localhost:3000",
"headers": {
"x-api-key": "My API Key"
}
}
}
}
```

The command-line arguments for filtering tools and specifying clients can also be used as query parameters in the URL.
For example, to exclude specific tools while including others, use the URL:

```
http://localhost:3000?resource=cards&resource=accounts&no_tool=create_cards
```

Or, to configure for the Cursor client, with a custom max tool name length, use the URL:

```
http://localhost:3000?client=cursor&capability=tool-name-length%3D40
```

## Importing the tools and server individually

```js
Expand Down
22 changes: 17 additions & 5 deletions packages/mcp-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "img-processing-mcp",
"version": "2.3.3",
"version": "2.4.0",
"description": "The official MCP Server for the Img Processing API",
"author": "Img Processing <[email protected]>",
"types": "dist/index.d.ts",
Expand All @@ -15,6 +15,9 @@
"license": "Apache-2.0",
"packageManager": "[email protected]",
"private": false,
"publishConfig": {
"access": "public"
},
"scripts": {
"test": "jest",
"build": "bash ./build",
Expand All @@ -28,18 +31,27 @@
},
"dependencies": {
"img-processing-sdk": "file:../../dist/",
"@cloudflare/cabidela": "^0.2.4",
"@modelcontextprotocol/sdk": "^1.11.5",
"jq-web": "https://github.com/stainless-api/jq-web/releases/download/v0.8.2/jq-web.tar.gz",
"@valtown/deno-http-worker": "^0.0.21",
"cors": "^2.8.5",
"express": "^5.1.0",
"jq-web": "https://github.com/stainless-api/jq-web/releases/download/v0.8.6/jq-web.tar.gz",
"qs": "^6.14.0",
"yargs": "^17.7.2",
"@cloudflare/cabidela": "^0.2.4",
"zod": "^3.25.20",
"zod-to-json-schema": "^3.24.5"
"zod-to-json-schema": "^3.24.5",
"zod-validation-error": "^4.0.1"
},
"bin": {
"mcp-server": "dist/index.js"
},
"devDependencies": {
"@types/cors": "^2.8.19",
"@types/express": "^5.0.3",
"@types/jest": "^29.4.0",
"@types/qs": "^6.14.0",
"@types/yargs": "^17.0.8",
"@typescript-eslint/eslint-plugin": "8.31.1",
"@typescript-eslint/parser": "8.31.1",
"eslint": "^8.49.0",
Expand All @@ -50,7 +62,7 @@
"ts-jest": "^29.1.0",
"ts-morph": "^19.0.0",
"ts-node": "^10.5.0",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.9/tsc-multi.tgz",
"tsconfig-paths": "^4.0.0",
"typescript": "5.8.3"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/mcp-server/src/code-tool-paths.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export const workerPath = require.resolve('./code-tool-worker.mjs');
14 changes: 14 additions & 0 deletions packages/mcp-server/src/code-tool-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { ClientOptions } from 'img-processing-sdk';

export type WorkerInput = {
opts: ClientOptions;
code: string;
};
export type WorkerSuccess = {
result: unknown | null;
logLines: string[];
errLines: string[];
};
export type WorkerError = { message: string | undefined };
46 changes: 46 additions & 0 deletions packages/mcp-server/src/code-tool-worker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import util from 'node:util';
import { WorkerInput, WorkerSuccess, WorkerError } from './code-tool-types';
import { ImgProcessing } from 'img-processing-sdk';

const fetch = async (req: Request): Promise<Response> => {
const { opts, code } = (await req.json()) as WorkerInput;
const client = new ImgProcessing({
...opts,
});

const logLines: string[] = [];
const errLines: string[] = [];
const console = {
log: (...args: unknown[]) => {
logLines.push(util.format(...args));
},
error: (...args: unknown[]) => {
errLines.push(util.format(...args));
},
};
try {
let run_ = async (client: any) => {};
eval(`
${code}
run_ = run;
`);
const result = await run_(client);
return Response.json({
result,
logLines,
errLines,
} satisfies WorkerSuccess);
} catch (e) {
const message = e instanceof Error ? e.message : undefined;
return Response.json(
{
message,
} satisfies WorkerError,
{ status: 400, statusText: 'Code execution error' },
);
}
};

export default { fetch };
Loading