MDX.org.ai
Executable Codemdxai

Integrations

AI platform integrations for mdxai

Integrations

Connect mdxai to various AI platforms and frameworks.

Available Integrations

IntegrationPackageDescription
Claude@mdxai/claudeAnthropic Claude for content generation
Mastra@mdxai/mastraAI workflow automation
Vapi@mdxai/vapiVoice AI assistants

Choosing an Integration

Content Generation

For generating and transforming MDX content, use @mdxai/claude:

import { generateMDX } from '@mdxai/claude'
 
const doc = await generateMDX({
  prompt: 'Write documentation for the Button component',
})

Agent Workflows

For complex multi-step processes, use the autonomous-agents primitive (the former @mdxai/agentkit package was removed as a duplicate of it):

import { createAgent } from 'autonomous-agents'
 
const agent = createAgent({
  name: 'documentation-writer',
  tools: [analyzeCode, generateDocs, reviewContent],
})

Workflow Automation

For integrating with existing AI workflows, use @mdxai/mastra:

import { createWorkflow } from '@mdxai/mastra'
 
const workflow = createWorkflow({
  trigger: 'code-change',
  steps: [
    { action: 'analyze', model: 'claude' },
    { action: 'generate', template: 'api-docs' },
    { action: 'review', criteria: 'accuracy' },
  ],
})

Voice Interfaces

For voice-enabled documentation, use @mdxai/vapi:

import { createVoiceAgent } from '@mdxai/vapi'
 
const agent = createVoiceAgent({
  documents: docs,
  voice: 'alloy',
})

Common Patterns

Schema-Driven Generation

All integrations support MDXLD schemas:

const schema = {
  $type: 'APIReference',
  endpoint: 'string',
  method: 'GET | POST | PUT | DELETE',
  parameters: [{
    name: 'string',
    type: 'string',
    required: 'boolean',
  }],
}
 
// Works with any integration
const result = await generateMDX({
  prompt: 'Document the /users endpoint',
  schema,
})

Streaming Responses

All integrations support streaming:

const stream = await streamMDX({
  prompt: 'Write a comprehensive guide',
})
 
for await (const chunk of stream) {
  // Process incrementally
}

Error Handling

Consistent error handling across integrations:

import { AIError } from 'mdxai'
 
try {
  await generateMDX({ prompt })
} catch (error) {
  if (error instanceof AIError) {
    // Handle AI-specific errors
  }
}

On this page