@devries-cameron20 / composio Mirror · read-only / commits / 78a8af600
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 14:30 UTC

feat(docs): add .mdx endpoint for AI agents

Add route handler and rewrite to serve markdown content at /docs/:path*.mdx for AI agents to fetch page content directly. - Add app/llms.mdx/docs/[[...slug]]/route.ts route handler - Add rewrite rule in next.config.mjs - Update getLLMText to include page URL in title Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Sushmithamallesh committed Jan 19, 2026 at 02:21 UTC 78a8af6001d0495070d60823f6b65deb908e2bc0
3 files changed +32 -1
docs/app/llms.mdx/docs/[[...slug]]/route.ts new
+23
@@ -0,0 +1,23 @@
1 +import { getLLMText, source } from '@/lib/source';
2 +import { notFound } from 'next/navigation';
3 +
4 +export const revalidate = false;
5 +
6 +export async function GET(
7 + _req: Request,
8 + { params }: { params: Promise<{ slug?: string[] }> }
9 +) {
10 + const { slug } = await params;
11 + const page = source.getPage(slug);
12 + if (!page) notFound();
13 +
14 + return new Response(await getLLMText(page), {
15 + headers: {
16 + 'Content-Type': 'text/markdown; charset=utf-8',
17 + },
18 + });
19 +}
20 +
21 +export function generateStaticParams() {
22 + return source.generateParams();
23 +}
docs/lib/source.ts
+1 -1
@@ -58,7 +58,7 @@ export function getPageImage(page: InferPageType<typeof source>) {
58 export async function getLLMText(page: InferPageType<typeof source>) {
59 const processed = await page.data.getText('processed');
60
61 - return `# ${page.data.title}
61 + return `# ${page.data.title} (${page.url})
62
63 ${processed}`;
64 }
docs/next.config.mjs
+8
@@ -11,6 +11,14 @@ const config = {
11 turbopack: {
12 root: __dirname,
13 },
14 + async rewrites() {
15 + return [
16 + {
17 + source: '/docs/:path*.mdx',
18 + destination: '/llms.mdx/docs/:path*',
19 + },
20 + ];
21 + },
22 async redirects() {
23 return [
24 {