Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .eslintcache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"/home/tempuser-jg7ktk/run/codegen-output/img-processing/img-processing-typescript/packages/mcp-server/src/options.ts":"1"},{"size":17015,"mtime":1759198008514,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","suppressedMessages":"6","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"145mtpo","/home/tempuser-jg7ktk/run/codegen-output/img-processing/img-processing-typescript/packages/mcp-server/src/options.ts",[],[]]
2 changes: 1 addition & 1 deletion .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ jobs:
- name: Upload MCP Server DXT GitHub release asset
run: |
gh release upload ${{ github.event.release.tag_name }} \
packages/mcp-server/img_processing_sdk_api.dxt
packages/mcp-server/img_processing_sdk_api.mcpb
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ jobs:
bash ./bin/check-release-environment
env:
NPM_TOKEN: ${{ secrets.IMG_PROCESSING_NPM_TOKEN || secrets.NPM_TOKEN }}

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ dist
dist-deno
/*.tgz
.idea/
.eslintcache
dist-bundle
*.dxt
*.mcpb
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.5.3"
".": "2.6.0"
}
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# Changelog

## 2.6.0 (2025-09-30)

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

### Features

* **mcp:** add docs search tool ([8be76c0](https://github.com/img-processing/node-sdk/commit/8be76c040191266496a71d5b055c6a5a1136a41f))
* **mcp:** add option for including docs tools ([3deacdc](https://github.com/img-processing/node-sdk/commit/3deacdca218bc3effdc0e440b1dc1774717bc914))
* **mcp:** enable experimental docs search tool ([a687bac](https://github.com/img-processing/node-sdk/commit/a687baccbe8ed955de8195f663ebfcde24ab3720))


### Bug Fixes

* **mcp:** fix cli argument parsing logic ([b814bb7](https://github.com/img-processing/node-sdk/commit/b814bb79034688b1c1c605cc04e8cc3bbf73b277))
* **mcp:** resolve a linting issue in server code ([15d421f](https://github.com/img-processing/node-sdk/commit/15d421feef63d56100053517971c5a9a52867796))


### Performance Improvements

* faster formatting ([2dc1660](https://github.com/img-processing/node-sdk/commit/2dc1660653b37ca4146679191482ceded0dc7aba))


### Chores

* **codegen:** internal codegen update ([ecc9e7e](https://github.com/img-processing/node-sdk/commit/ecc9e7e0e102622aefeb3c863dd71bb14784ae8e))
* do not install brew dependencies in ./scripts/bootstrap by default ([5f8b3e0](https://github.com/img-processing/node-sdk/commit/5f8b3e00601c453233e1b4475a6293ab37c8bf55))
* **internal:** codegen related update ([42a6b13](https://github.com/img-processing/node-sdk/commit/42a6b13b0b8caaa20df0752c4e5be08cc2b10a82))
* **internal:** fix incremental formatting in some cases ([49d023b](https://github.com/img-processing/node-sdk/commit/49d023bf5b8562cf88700aeda86ed14eb2a06cfe))
* **internal:** gitignore .mcpb files ([130ad87](https://github.com/img-processing/node-sdk/commit/130ad8701491fa3ed7f68226a51268147dfdcb39))
* **internal:** ignore .eslintcache ([d7f6709](https://github.com/img-processing/node-sdk/commit/d7f670940ebd4547425525a89e18596e52f48094))
* **internal:** remove deprecated `compilerOptions.baseUrl` from tsconfig.json ([8b0e56f](https://github.com/img-processing/node-sdk/commit/8b0e56fa90c68ffcef9e70f70043e08bf24f13f6))
* **mcp:** allow pointing `docs_search` tool at other URLs ([8a21174](https://github.com/img-processing/node-sdk/commit/8a211748b82b0b0726613b7e7f679b93abbff801))
* **mcp:** rename dxt to mcpb ([9db2106](https://github.com/img-processing/node-sdk/commit/9db2106212631a5f60a16455c7141834e22a3016))
* update lockfile ([02bd395](https://github.com/img-processing/node-sdk/commit/02bd3954242cf4ae9b90e01f082dde53debbda98))

## 2.5.3 (2025-09-17)

Full Changelog: [v2.5.2...v2.5.3](https://github.com/img-processing/node-sdk/compare/v2.5.2...v2.5.3)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "img-processing-sdk",
"version": "2.5.3",
"version": "2.6.0",
"description": "The official TypeScript library for the Img Processing API",
"author": "Img Processing <support@img-processing.com>",
"types": "dist/index.d.ts",
Expand Down
6 changes: 3 additions & 3 deletions packages/mcp-server/build
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ chmod +x dist/index.js
DIST_PATH=./dist PKG_IMPORT_PATH=img-processing-mcp/ node ../../scripts/utils/postprocess-files.cjs

# mcp bundle
rm -rf dist-bundle img_processing_sdk_api.dxt; mkdir dist-bundle
rm -rf dist-bundle img_processing_sdk_api.mcpb; mkdir dist-bundle

# copy package.json
PKG_JSON_PATH=../../packages/mcp-server/package.json node ../../scripts/utils/make-dist-package-json.cjs > dist-bundle/package.json
Expand All @@ -48,9 +48,9 @@ cd ..
# pack bundle
cp manifest.json dist-bundle

npx dxt pack dist-bundle img_processing_sdk_api.dxt
npx mcpb pack dist-bundle img_processing_sdk_api.mcpb

npx dxt sign img_processing_sdk_api.dxt --self-signed
npx mcpb sign img_processing_sdk_api.mcpb --self-signed

# clean up
rm -rf dist-bundle
5 changes: 3 additions & 2 deletions packages/mcp-server/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dxt_version": "0.1",
"dxt_version": "0.2",
"name": "img-processing-mcp",
"version": "2.4.0",
"description": "The official MCP Server for the Img Processing API",
Expand All @@ -15,7 +15,7 @@
"documentation": "https://docs.img-processing.com",
"server": {
"type": "node",
"entry_point": "${__dirname}/index.js",
"entry_point": "index.js",
"mcp_config": {
"command": "node",
"args": ["${__dirname}/index.js"],
Expand All @@ -32,6 +32,7 @@
"type": "string"
}
},
"tools": [],
"tools_generated": true,
"compatibility": {
"runtimes": {
Expand Down
4 changes: 2 additions & 2 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.5.3",
"version": "2.6.0",
"description": "The official MCP Server for the Img Processing API",
"author": "Img Processing <support@img-processing.com>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -47,7 +47,7 @@
"mcp-server": "dist/index.js"
},
"devDependencies": {
"@anthropic-ai/dxt": "^0.2.6",
"@anthropic-ai/mcpb": "^1.1.0",
"@types/cors": "^2.8.19",
"@types/express": "^5.0.3",
"@types/jest": "^29.4.0",
Expand Down
48 changes: 48 additions & 0 deletions packages/mcp-server/src/docs-search-tool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { Metadata, asTextContentResult } from './tools/types';

import { Tool } from '@modelcontextprotocol/sdk/types.js';

export const metadata: Metadata = {
resource: 'all',
operation: 'read',
tags: [],
httpMethod: 'get',
};

export const tool: Tool = {
name: 'search_docs',
description:
'Search for documentation for how to use the client to interact with the API.\nThe tool will return an array of Markdown-formatted documentation pages.',
inputSchema: {
type: 'object',
properties: {
query: {
type: 'string',
description: 'The query to search for.',
},
language: {
type: 'string',
description: 'The language for the SDK to search for.',
enum: ['http', 'python', 'go', 'typescript', 'terraform', 'ruby', 'java', 'kotlin'],
},
},
required: ['query', 'language'],
},
annotations: {
readOnlyHint: true,
},
};

const docsSearchURL =
process.env['DOCS_SEARCH_URL'] || 'https://api.stainless.com/api/projects/img-processing/docs/search';

export const handler = async (_: unknown, args: Record<string, unknown> | undefined) => {
const body = args as any;
const query = new URLSearchParams(body).toString();
const result = await fetch(`${docsSearchURL}?${query}`);
return asTextContentResult(await result.json());
};

export default { metadata, tool, handler };
24 changes: 17 additions & 7 deletions packages/mcp-server/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type McpOptions = {
includeDynamicTools?: boolean | undefined;
includeAllTools?: boolean | undefined;
includeCodeTools?: boolean | undefined;
includeDocsTools?: boolean | undefined;
filters?: Filter[] | undefined;
capabilities?: Partial<ClientCapabilities> | undefined;
};
Expand Down Expand Up @@ -55,13 +56,13 @@ export function parseCLIOptions(): CLIOptions {
.option('tools', {
type: 'string',
array: true,
choices: ['dynamic', 'all', 'code'],
choices: ['dynamic', 'all', 'code', 'docs'],
description: 'Use dynamic tools or all tools',
})
.option('no-tools', {
type: 'string',
array: true,
choices: ['dynamic', 'all', 'code'],
choices: ['dynamic', 'all', 'code', 'docs'],
description: 'Do not use any dynamic or all tools',
})
.option('tool', {
Expand Down Expand Up @@ -245,13 +246,15 @@ export function parseCLIOptions(): CLIOptions {
}
}

const shouldIncludeToolType = (toolType: 'dynamic' | 'all' | 'code') =>
explicitTools ? argv.tools?.includes(toolType) && !argv.noTools?.includes(toolType) : undefined;
const shouldIncludeToolType = (toolType: 'dynamic' | 'all' | 'code' | 'docs') =>
argv.noTools?.includes(toolType) ? false
: argv.tools?.includes(toolType) ? true
: undefined;

const explicitTools = Boolean(argv.tools || argv.noTools);
const includeDynamicTools = shouldIncludeToolType('dynamic');
const includeAllTools = shouldIncludeToolType('all');
const includeCodeTools = shouldIncludeToolType('code');
const includeDocsTools = shouldIncludeToolType('docs');

const transport = argv.transport as 'stdio' | 'http';

Expand All @@ -261,6 +264,7 @@ export function parseCLIOptions(): CLIOptions {
includeDynamicTools,
includeAllTools,
includeCodeTools,
includeDocsTools,
filters,
capabilities: clientCapabilities,
list: argv.list || false,
Expand All @@ -280,8 +284,8 @@ const coerceArray = <T extends z.ZodTypeAny>(zodType: T) =>
);

const QueryOptions = z.object({
tools: coerceArray(z.enum(['dynamic', 'all'])).describe('Use dynamic tools or all tools'),
no_tools: coerceArray(z.enum(['dynamic', 'all'])).describe('Do not use dynamic tools or all tools'),
tools: coerceArray(z.enum(['dynamic', 'all', 'docs'])).describe('Use dynamic tools or all tools'),
no_tools: coerceArray(z.enum(['dynamic', 'all', 'docs'])).describe('Do not use dynamic tools or all tools'),
tool: coerceArray(z.string()).describe('Include tools matching the specified names'),
resource: coerceArray(z.string()).describe('Include tools matching the specified resources'),
operation: coerceArray(z.enum(['read', 'write'])).describe(
Expand Down Expand Up @@ -376,11 +380,17 @@ export function parseQueryOptions(defaultOptions: McpOptions, query: unknown): M
: queryOptions.tools?.includes('all') ? true
: defaultOptions.includeAllTools;

let docsTools: boolean | undefined =
queryOptions.no_tools && queryOptions.no_tools?.includes('docs') ? false
: queryOptions.tools?.includes('docs') ? true
: defaultOptions.includeDocsTools;

return {
client: queryOptions.client ?? defaultOptions.client,
includeDynamicTools: dynamicTools,
includeAllTools: allTools,
includeCodeTools: undefined,
includeDocsTools: docsTools,
filters,
capabilities: clientCapabilities,
};
Expand Down
13 changes: 8 additions & 5 deletions packages/mcp-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from './compat';
import { dynamicTools } from './dynamic-tools';
import { codeTool } from './code-tool';
import docsSearchTool from './docs-search-tool';
import { McpOptions } from './options';

export { McpOptions } from './options';
Expand All @@ -33,7 +34,7 @@ export const newMcpServer = () =>
new McpServer(
{
name: 'img_processing_sdk_api',
version: '2.5.3',
version: '2.6.0',
},
{ capabilities: { tools: {}, logging: {} } },
);
Expand Down Expand Up @@ -147,24 +148,26 @@ export function initMcpServer(params: {
export async function selectTools(endpoints: Endpoint[], options?: McpOptions): Promise<Endpoint[]> {
const filteredEndpoints = query(options?.filters ?? [], endpoints);

let includedTools = filteredEndpoints;
let includedTools = filteredEndpoints.slice();

if (includedTools.length > 0) {
if (options?.includeDynamicTools) {
includedTools = dynamicTools(includedTools);
}
} else {
if (options?.includeAllTools) {
includedTools = endpoints;
includedTools = endpoints.slice();
} else if (options?.includeDynamicTools) {
includedTools = dynamicTools(endpoints);
} else if (options?.includeCodeTools) {
includedTools = [await codeTool()];
} else {
includedTools = endpoints;
includedTools = endpoints.slice();
}
}

if (options?.includeDocsTools ?? true) {
includedTools.push(docsSearchTool);
}
const capabilities = { ...defaultClientCapabilities, ...options?.capabilities };
return applyCompatibilityTransformations(includedTools, capabilities);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/mcp-server/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"compilerOptions": {
"rootDir": "./dist/src",
"paths": {
"img-processing-mcp/*": ["dist/src/*"],
"img-processing-mcp": ["dist/src/index.ts"]
"img-processing-mcp/*": ["./dist/src/*"],
"img-processing-mcp": ["./dist/src/index.ts"]
},
"noEmit": false,
"declaration": true,
Expand Down
5 changes: 2 additions & 3 deletions packages/mcp-server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"baseUrl": "./",
"paths": {
"img-processing-mcp/*": ["src/*"],
"img-processing-mcp": ["src/index.ts"]
"img-processing-mcp/*": ["./src/*"],
"img-processing-mcp": ["./src/index.ts"]
},
"noEmit": true,

Expand Down
Loading