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.
Important
This page describes the standard kit integration path; adapt app-specific paths and config names when your project differs.
How To Use
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 requestAgent Recipe
- Add
llm.mdroute per content type. - Wire handler with
notionConfigand content key. - Feed endpoint URL to AI assistant components or MCP ingestion.
Troubleshooting
- 404 usually means unknown slug.
- 500 usually indicates Notion auth/config problems.
Related
Notion
Configure Notion as a typed content backend.
Search
Add searchable Notion content UI and API routes.
How is this guide?
Last updated on 3/23/2026