MCP server for the Magicline APIs (OpenAPI, Connect API, Device API, Webhooks). The server loads the official OpenAPI specs and registers each operation as an MCP tool.
This server exposes Magicline endpoints to MCP-compatible clients via stdio. Each operation in the official OpenAPI specs becomes a tool with a stable, namespaced name.
Included APIs:
- OpenAPI (core Magicline API)
- Connect API
- Device API
- Webhooks API
Tool prefixes:
magicline_(OpenAPI)magicline_connect_(Connect API)magicline_device_(Device API)magicline_webhooks_(Webhooks)
Generic fallback tools:
magicline_request(JSON or raw body)magicline_request_multipart(multipart/form-data)
- Node.js 18+ (uses built-in
fetch) - Magicline credentials and base URLs
- Install dependencies:
npm install- Fetch the latest specs (optional but recommended):
npm run update-openapi- Build:
npm run build- Run (stdio transport):
MAGICLINE_BASE_URL="https://..." \
MAGICLINE_API_KEY="..." \
node build/index.jsMAGICLINE_BASE_URLMAGICLINE_API_KEYMAGICLINE_API_KEY_HEADER(optional, defaultX-API-KEY)
MAGICLINE_CONNECT_BASE_URLMAGICLINE_CONNECT_API_KEY(optional)MAGICLINE_CONNECT_API_KEY_HEADER(optional, defaultX-API-KEY)
MAGICLINE_DEVICE_BASE_URLMAGICLINE_DEVICE_API_TOKENMAGICLINE_DEVICE_AUTH_HEADER(optional, defaultAuthorization)MAGICLINE_DEVICE_AUTH_PREFIX(optional, defaultBearer)
MAGICLINE_WEBHOOKS_BASE_URLMAGICLINE_WEBHOOKS_API_KEYMAGICLINE_WEBHOOKS_API_KEY_HEADER(optional, defaultX-API-KEY)
You can override the spec URLs used by the update script and runtime loader:
MAGICLINE_OPENAPI_URLMAGICLINE_CONNECT_OPENAPI_URLMAGICLINE_DEVICE_OPENAPI_URLMAGICLINE_WEBHOOKS_OPENAPI_URL
All tools are derived from the OpenAPI specs in:
src/openapi.jsonsrc/connectapi.jsonsrc/deviceapi.jsonsrc/webhooks.json
On startup, the server loads these specs (falling back to the remote URLs if local files are missing)
and registers tools from each operationId.
Each tool name is constructed as:
<prefix><operationId>
Example:
magicline_searchCustomersmagicline_device_activateDevice
Tool name sanitation rules:
- Non-alphanumeric characters are replaced with
_. - Names starting with a digit are prefixed with
op_. - If a collision occurs,
_2,_3, ... is appended.
Spec-generated tools accept a single JSON object with these optional fields (depends on the endpoint):
pathParams: Path parameters for{param}segmentsquery: Query parametersheaderParams: Header parameters defined by the specheaders: Additional headersbody: JSON bodyrawBody: Raw body stringrawBodyBase64: Raw body as base64multipart: Multipart form-data parts
Rules enforced:
- Only one of
body,rawBody,rawBodyBase64,multipartmay be set. - If the spec marks the body as required, the tool will enforce it.
- Multipart is only allowed when the spec declares
multipart/form-data.
When multipart is supported, each part is one of:
{ "kind": "json", "name": "...", "data": { ... } }{ "kind": "text", "name": "...", "data": "...", "contentType": "..." }{ "kind": "binary", "name": "...", "dataBase64": "...", "filename": "...", "contentType": "..." }
For ad-hoc calls to the OpenAPI base URL.
Input:
method:GET | POST | PUT | DELETE | HEADpath: relative path like/v1/customersquery,headers,body,rawBody,rawBodyBase64
For ad-hoc multipart calls to the OpenAPI base URL.
Input:
method:POST | PUTpath: relative path like/v1/customers/{id}/documentsquery,headers,parts
All tools return a text response:
- JSON responses are pretty-printed as text.
- Non-JSON responses return
{ contentType, body }as JSON text.
Errors return a text message like:
Request failed: <error message>
The server logs to stderr only (stdio requirement).
npm run update-openapi: downloads and stores all four specs intosrc/npm run build: compiles tobuild/and copies specs intobuild/
src/index.ts: server implementationsrc/*.json: OpenAPI specsbuild/index.js: compiled serverbuild/*.json: copied specs for runtimescripts/fetch-openapi.mjs: spec downloader
Dieses MCP läuft lokal über stdio. Jeder Client, der einen lokalen Prozess starten kann, funktioniert.
Codex (CLI & IDE Extension)
Codex unterstützt STDIO-Server und teilt die MCP-Konfiguration zwischen CLI und IDE.
Du kannst per CLI oder via config.toml konfigurieren.
CLI (stdio):
codex mcp add magicline \
--env MAGICLINE_BASE_URL=https://... \
--env MAGICLINE_API_KEY=... \
-- node /absolute/path/to/magicline-mcp-server/build/index.jsconfig.toml (global oder projektbezogen):
[mcp_servers.magicline]
command = "node"
args = ["/absolute/path/to/magicline-mcp-server/build/index.js"]
[mcp_servers.magicline.env]
MAGICLINE_BASE_URL = "https://..."
MAGICLINE_API_KEY = "..."Claude Code (CLI)
Claude Code kann lokale stdio-Server hinzufügen. Wichtig: Alle Optionen kommen vor dem Servernamen,
und -- trennt die Claude-Optionen von deinem Server-Command.
claude mcp add --transport stdio \
--env MAGICLINE_BASE_URL=https://... \
--env MAGICLINE_API_KEY=... \
magicline -- node /absolute/path/to/magicline-mcp-server/build/index.jsClaude Desktop
Claude Desktop kann MCP-Server über claude_desktop_config.json laden. Füge dort einen Eintrag unter
mcpServers hinzu und starte Claude Desktop neu.
{
"mcpServers": {
"magicline": {
"command": "node",
"args": ["/absolute/path/to/magicline-mcp-server/build/index.js"],
"env": {
"MAGICLINE_BASE_URL": "https://...",
"MAGICLINE_API_KEY": "..."
}
}
}
}Weitere MCP-Clients (HTTP)
Einige Clients wie VS Code (Copilot Agent Mode) und Cursor konfigurieren MCP-Server über JSON-Dateien
mit type: "http" und url. Das ist für HTTP-basierte MCP-Server gedacht. Wenn du dieses Projekt
später als HTTP-Server betreibst, kannst du dich an deren HTTP-Format orientieren.
Missing MAGICLINE_BASE_URLorMissing MAGICLINE_API_KEY:- Set the env vars in your MCP client config (not just your shell).
Path must be relative:- Use
/v1/...style paths (no full URLs) when calling generic tools.
- Use
This endpoint does not accept JSON bodies:- Use
multipartif the spec requiresmultipart/form-data.
- Use
Request body is required:- Provide exactly one of
body,rawBody,rawBodyBase64, ormultipart.
- Provide exactly one of
- Do not commit secrets. Use env vars or a local
.envfile. - Keep base URLs without a trailing slash.
- TypeScript source is in
src/. - The server expects specs in
src/*.jsonat runtime. - You can regenerate specs anytime with
npm run update-openapi. npm testis currently a placeholder.