FeaturesCMSNotion
PreviousNext

LLMs

Expose content as markdown endpoints for AI tooling.

What It Does

createMarkdownExportHandler generates endpoint handlers that return Notion content as markdown/plain text.

When To Use

  • Building AI assistants over your docs/content.
  • Serving MCP/LLM ingestion endpoints.

Prerequisites

  • Notion config with target content type.

How To Use

app/blog/[slug]/llm.md/route.ts
import { createMarkdownExportHandler } from '@kit/notion/api';
import { notionConfig } from '~/config/cms.config';
 
export const GET = createMarkdownExportHandler(notionConfig, 'posts');

This handler reads slug, fetches content, and returns markdown.

MCP Context

capability: notion_markdown_export
entrypoints:
  - @kit/notion/api#createMarkdownExportHandler
inputs:
  - slug
  - content_type_key
outputs:
  - markdown_response
constraints:
  - content type key must exist in notion config
side_effects:
  - Notion content fetch on each request

Agent Recipe

  1. Add llm.md route per content type.
  2. Wire handler with notionConfig and content key.
  3. Feed endpoint URL to AI assistant components or MCP ingestion.

Troubleshooting

  • 404 usually means unknown slug.
  • 500 usually indicates Notion auth/config problems.

How is this guide?

Last updated on 3/23/2026