# Customjs — how to use (mcp.ai)

Connect your Customjs account and use 5 tools for developer tools straight from your AI agent. Connect with your own API key. CustomJS is a code-first automation platform that enables seamless integration of custom JavaScript logic into various systems and technologies, allowing users to extend applications by writing functions for tasks like sending emails, generating PDFs, or updating CRM data fields.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_customjs?ms=1787295720000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `customjs_authenticate_api_key`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/customjs`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/customjs/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/customjs/authenticate/api/key` — Authenticate and validate a CustomJS API key. Returns workspace details, request limits, and decoded JWT token information including user email. Use this to verify an API key is valid before making ot
  - body: { api_key: string }
- `POST https://api.mcp.ai/api/customjs/convert/html/to/pdf` — Convert HTML content to a PDF document. Use this tool to generate PDF files from raw HTML markup. Supports: - Complete HTML documents or fragments - Inline CSS styling (colors, fonts, tables, borders,
  - body: { code?: string, input: string, returnBinary?: string }
- `POST https://api.mcp.ai/api/customjs/convert/html/to/png` — Tool to convert HTML string to PNG image. Use when you need a PNG from HTML after preparing your markup.
  - body: { html: string }
- `POST https://api.mcp.ai/api/customjs/merge/pdfs` — Merge multiple PDF files from URLs into a single PDF document. Use this tool when you need to combine two or more PDF documents into one. The PDFs are merged in the order provided. All input URLs must
  - body: { pdf_urls: string[] }
- `POST https://api.mcp.ai/api/customjs/run/puppeteer/script` — Execute a Puppeteer script in a headless browser and capture a screenshot. Use this tool for browser automation tasks such as navigating to URLs, interacting with page elements, extracting data, or ca
  - body: { code?: string, input: string, returnBinary?: boolean }

## Example prompts
- "What can I do in Customjs?"
- "Show me a summary of my Customjs account"

## More
- Page: https://mcp.ai/customjs
- Agent spec (llms.txt): https://mcp.ai/customjs/llms.txt
- Postman collection: https://mcp.ai/customjs/postman.json
