Skip to content

feat: dual-mode root — markdown for agents, HTML for browsers#455

Merged
itskai-dev merged 1 commit into
mainfrom
link/dual-mode-root
Feb 21, 2026
Merged

feat: dual-mode root — markdown for agents, HTML for browsers#455
itskai-dev merged 1 commit into
mainfrom
link/dual-mode-root

Conversation

@itskai-dev
Copy link
Copy Markdown
Collaborator

Summary

Content negotiation at / so agents get markdown and browsers get HTML.

What changed

  • Middleware (moved from root to src/middleware.ts for Next.js 16 src/ compat)

    • Detects agents via: Accept header, User-Agent (curl, wget, httpie, python-requests, AI bots), ?format=md param, x-agent header
    • Rewrites / to /api/index.md for agent requests
    • Browsers (Accept: text/html) get the normal HTML landing page
  • New /api/index.md route — rich markdown summary with:

    • Live stats from data layer (skills, MCP servers, agents, ACP agents, llms.txt count)
    • Full API endpoint table (all .md and .json routes)
    • Top 6 skills and MCP servers with install commands
    • Registration and submission API docs
    • Content negotiation documentation

Testing

Request Result
curl forAgents.dev ✅ Markdown (text/markdown)
curl -H 'Accept: text/html' forAgents.dev ✅ HTML landing page
curl 'forAgents.dev/?format=md' ✅ Markdown
python -c 'import requests; r=requests.get(...)' ✅ Markdown
Browser ✅ HTML landing page

Closes

task-1771437023881-nc1um0a7a

Content negotiation at / via middleware:
- curl, wget, httpie, python-requests → markdown
- Accept: text/markdown → markdown
- ?format=md query param → markdown
- Known AI agent UAs (GPTBot, OpenClaw, etc.) → markdown
- Browsers (Accept: text/html) → HTML landing page

New /api/index.md route serves rich markdown summary with:
- Live stats (skills, MCP servers, agents count)
- Full API endpoint table
- Top skills and MCP servers
- Registration/submission docs
- Content negotiation docs

Middleware moved from project root to src/middleware.ts (required
for src/ directory structure in Next.js 16).

Closes task-1771437023881-nc1um0a7a
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-hub Ready Ready Preview, Comment Feb 21, 2026 5:51pm

Request Review

@supabase
Copy link
Copy Markdown

supabase Bot commented Feb 21, 2026

This pull request has been ignored for the connected project oldbapagtyvkplbqllwa because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@itskai-dev itskai-dev merged commit 4c58445 into main Feb 21, 2026
4 checks passed
@itskai-dev itskai-dev deleted the link/dual-mode-root branch February 21, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant