HomeMCP Documentation

MCP Server

Model Context Protocol — Connect AI agents directly to InfinixUI

What is MCP?

The Model Context Protocol (MCP) is an open standard for connecting AI agents to external tools. Instead of your agent figuring out complex API calls via prompt engineering, MCP provides a structured interface where the agent knows exactly what tools are available and how to call them.

Zero Token Waste

No need for elaborate system prompts explaining the API. The agent discovers tools automatically.

Plug & Play

Add InfinixUI to any MCP-compatible client: Claude, Cursor, Windsurf, or your own agent.

Type-Safe

All tool inputs are validated with Zod schemas. The agent always sends correct data.

Installation

The InfinixUI MCP server is included in the package. Build it once, then point your MCP client to the compiled server.

1. Clone & Install

git clone https://github.com/guewol/infinixui.git
cd infinixui
npm install

2. Build the MCP server

npm run mcp:build

3. Test it locally

# Start InfinixUI first
npm run dev -- -p 3002

# In another terminal, test the MCP server
INFINIXUI_URL=http://localhost:3002 INFINIXUI_API_KEY=mcp_live_... npm run mcp:start

Configuration

The MCP server uses two environment variables:

VariableDefaultDescription
INFINIXUI_URLhttp://localhost:3002Base URL of your InfinixUI instance
INFINIXUI_API_KEY(none)MCP access token (mcp_live_...)

Generate an MCP token via POST /api/keys with "keyType": "mcp". See API docs.

Claude Desktop

Add InfinixUI to your claude_desktop_config.json:

{
  "mcpServers": {
    "infinixui": {
      "command": "node",
      "args": ["C:/path/to/infinixui/mcp/dist/index.js"],
      "env": {
        "INFINIXUI_URL": "https://infinixui.dev",
        "INFINIXUI_API_KEY": "mcp_live_your_key_here"
      }
    }
  }
}

Restart Claude Desktop after editing the config. The tools will appear in Claude's tool list.

Cursor / Windsurf

Add to your .cursor/mcp.json or .windsurf/mcp.json:

{
  "mcpServers": {
    "infinixui": {
      "command": "node",
      "args": ["./mcp/dist/index.js"],
      "env": {
        "INFINIXUI_URL": "http://localhost:3002",
        "INFINIXUI_API_KEY": "mcp_live_your_key_here"
      }
    }
  }
}

Custom Agent (Node.js)

Connect programmatically from your own agent using the MCP SDK:

import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';

const transport = new StdioClientTransport({
  command: 'node',
  args: ['./mcp/dist/index.js'],
  env: {
    INFINIXUI_URL: 'http://localhost:3002',
    INFINIXUI_API_KEY: 'mcp_live_...',
  },
});

const client = new Client({ name: 'my-agent', version: '1.0.0' });
await client.connect(transport);

// List available tools
const tools = await client.listTools();
console.log(tools);

// Generate an ebook
const result = await client.callTool('generate_ebook', {
  title: 'My AI Guide',
  theme: 'github',
  chapters: [
    {
      title: 'Chapter 1',
      sections: [{ title: 'Intro', content: ['Hello world...'] }],
    },
  ],
});
console.log(result);

Tools Reference

list_config

List all available templates, themes, formats, and designs. Call this first to discover options before generating.

Parameters

None

Example

// Agent calls list_config with no arguments
// Returns all templates, themes, formats, designs for both carousel and ebook modes
generate_ebook

Generate a full ebook layout with cover, chapters, and back cover. Returns a studio URL for editing and PDF export.

Parameters

{
  template?: string    // e.g. "guide-pratique" (default)
  theme?: string       // e.g. "stripe", "github", "midnight"
  title: string        // Book title
  subtitle?: string
  author?: string
  chapters: [          // Array of chapters
    {
      title: string,
      hook?: string,
      sections: [{ title: string, content: string[] }],
      summary?: string[],
      tip?: string
    }
  ]
  introduction?: { body: string }
  conclusion?: { body: string, summary?: string }
}

Example

{
  "template": "guide-pratique",
  "theme": "stripe",
  "title": "The Complete Guide to AI",
  "chapters": [
    {
      "title": "What is AI?",
      "sections": [
        { "title": "Definition", "content": ["AI is..."] }
      ]
    }
  ]
}
list_files

List all generated files (carousels and ebooks) stored in InfinixUI.

Parameters

None

Example

// Returns array of all generated records with id, mode, title, createdAt

Typical Agent Workflow

Here's how an AI agent typically interacts with InfinixUI via MCP:

1

Discover

Agent calls list_config to discover available templates & themes

2

Generate

Agent calls generate_ebook or generate_carousel with structured content

3

Get Result

Tool returns studioUrl for the user to preview/edit, or pdfUrl for direct download

4

Export (optional)

Agent calls export_carousel_pdf to get a downloadable PDF