Introduction

Model Context Protocol (MCP) is an open protocol to standardize how applications provide context to LLMs. IMG Processing provides an MCP server to enable AI agents to send and manage images using the IMG Processing API.

This page describes the tools available in IMG Processing’s MCP server, which allows AI agents to interact with the IMG Processing platform.

Currently available tools

Tools are individual operations exposed by the IMG Processing MCP server. Each tool corresponds to a specific API capability, such as uploading an image, resizing it, or removing its background. These tools are grouped by resource type and can be invoked by LLM agents through the MCP protocol.

ToolOperationMaps to
retrieve_imagesreadGet image
list_imagesreadList images
delete_imageswriteDelete image
add_watermark_imageswriteAdd watermarks
blur_imageswriteBlur image
classify_imageswriteClassify image
convert_imageswriteConvert image
create_from_url_imageswriteCreate from URL
crop_imageswriteCrop image
download_imagesreadDownload image
extract_formatted_text_imageswriteExtract formatted text
imagine_imageswriteImagine image
mirror_imageswriteMirror image
modulate_imageswriteModulate image
publish_imageswritePublish image
remove_background_imageswriteRemove background
resize_imageswriteResize image
rotate_imageswriteRotate image
unpublish_imageswriteUnpublish image
upload_imageswriteUpload image
visualize_imageswriteVisualize image

Installation

Direct invocation

You can run the MCP Server directly via npx:

export IMG_PROCESSING_API_KEY="My API Key"
npx -y img-processing-sdk-mcp@latest

Via MCP Client

There is a partial list of existing clients at modelcontextprotocol.io. If you already have a client, consult their documentation to install the MCP server.

For clients with a configuration JSON, it might look something like this:

{
  "mcpServers": {
    "img_processing_sdk_api": {
      "command": "npx",
      "args": ["-y", "img-processing-sdk-mcp", "--client=claude", "--tools=dynamic"],
      "env": {
        "IMG_PROCESSING_API_KEY": "My API Key"
      }
    }
  }
}

Exposing endpoints to your MCP Client

There are two ways to expose endpoints as tools in the MCP server:

  1. Exposing one tool per endpoint, and filtering as necessary
  2. Exposing a set of tools to dynamically discover and invoke endpoints from the API

Filtering endpoints and tools

You can run the package on the command line to discover and filter the set of tools that are exposed by the MCP Server. This can be helpful for large APIs where including all endpoints at once is too much for your AI’s context window.

You can filter by multiple aspects:

  • --tool includes a specific tool by name
  • --resource includes all tools under a specific resource, and can have wildcards, e.g. my.resource*
  • --operation includes just read (get/list) or just write operations

Dynamic tools

If you specify --tools=dynamic to the MCP server, instead of exposing one tool per endpoint in the API, it will expose the following tools:

  1. list_api_endpoints - Discovers available endpoints, with optional filtering by search query
  2. get_api_endpoint_schema - Gets detailed schema information for a specific endpoint
  3. invoke_api_endpoint - Executes any endpoint with the appropriate parameters

This allows you to have the full set of API endpoints available to your MCP Client, while not requiring that all of their schemas be loaded into context at once. Instead, the LLM will automatically use these tools together to search for, look up, and invoke endpoints dynamically. However, due to the indirect nature of the schemas, it can struggle to provide the correct properties a bit more than when tools are imported explicitly. Therefore, you can opt-in to explicit tools, the dynamic tools, or both.

See more information with --help.

All of these command-line options can be repeated, combined together, and have corresponding exclusion versions (e.g. --no-tool).

Use --list to see the list of available tools, or see below.

Specifying the MCP Client

Different clients have varying abilities to handle arbitrary tools and schemas.

You can specify the client you are using with the --client argument, and the MCP server will automatically serve tools and schemas that are more compatible with that client.

  • --client=<type>: Set all capabilities based on a known MCP client

  • Valid values: openai-agents, claude, claude-code, cursor

  • Example: --client=cursor

Additionally, if you have a client not on the above list, or the client has gotten better over time, you can manually enable or disable certain capabilities:

  • --capability=<name>: Specify individual client capabilities
  • Available capabilities:
  • top-level-unions: Enable support for top-level unions in tool schemas
  • valid-json: Enable JSON string parsing for arguments
  • refs: Enable support for $ref pointers in schemas
  • unions: Enable support for union types (anyOf) in schemas
  • formats: Enable support for format validations in schemas (e.g. date-time, email)
  • tool-name-length=N: Set maximum tool name length to N characters
  • Example: --capability=top-level-unions --capability=tool-name-length=40
  • Example: --capability=top-level-unions,tool-name-length=40

Examples

  1. Filter for read operations on cards:
--resource=cards --operation=read
  1. Exclude specific tools while including others:
--resource=cards --no-tool=create_cards
  1. Configure for Cursor client with custom max tool name length:
--client=cursor --capability=tool-name-length=40
  1. Complex filtering with multiple criteria:
--resource=cards,accounts --operation=read --tag=kyc --no-tool=create_cards

Importing the tools and server individually

// Import the server, generated endpoints, or the init function
import { server, endpoints, init } from "img-processing-sdk-mcp/server";

// import a specific tool
import retrieveImages from "img-processing-sdk-mcp/tools/images/retrieve-images";

// initialize the server and all endpoints
init({ server, endpoints });

// manually start server
const transport = new StdioServerTransport();
await server.connect(transport);

// or initialize your own server with specific tools
const myServer = new McpServer(...);

// define your own endpoint
const myCustomEndpoint = {
  tool: {
    name: 'my_custom_tool',
    description: 'My custom tool',
    inputSchema: zodToJsonSchema(z.object({ a_property: z.string() })),
  },
  handler: async (client: client, args: any) => {
    return { myResponse: 'Hello world!' };
  })
};

// initialize the server with your custom endpoints
init({ server: myServer, endpoints: [retrieveImages, myCustomEndpoint] });