available← /blog
01/ Apr 12, 2025·8 min read·AI
──────────────────────────────────────────────────────────────────────

Building AI-Powered APIs with MCP Integration

How I built docmcp.natnael.me and what I learned about connecting AI models to live documentation through the Model Context Protocol — and why it matters for the next wave of tooling.

Last year I built docmcp.natnael.me — a tool that connects AI models directly to live documentation through the Model Context Protocol. What started as a weekend experiment turned into one of the most technically interesting projects I've shipped.

What is MCP?

The Model Context Protocol is Anthropic's open standard for connecting AI assistants to external data sources and tools. Instead of copy-pasting docs into a prompt, MCP lets the model query your documentation server in real time — the model knows what to ask for, and your server knows how to respond.

Think of it as a REST API, but the client is an LLM and the contract is semantic rather than structural. The model doesn't need to know your exact endpoint schema — it understands intent and the server surfaces the right information.

The Architecture

DocMCP has three layers: a crawler that indexes documentation sites into a vector store, an MCP server that exposes semantic search as a tool, and a thin Next.js frontend for configuration and testing.

The crawler uses a BFS strategy with Playwright for JS-rendered sites. Chunks are embedded with text-embedding-3-small and stored in a pgvector table on Supabase. The MCP server then wraps this into a simple search_docs tool that any compatible AI client can call.

What I Learned

The hardest part wasn't the AI integration — it was chunking strategy. Naive paragraph-level chunking destroys context. Code blocks that reference variables defined three paragraphs earlier become useless fragments. I ended up building a tree-aware chunker that preserves heading hierarchy and keeps code examples with their surrounding prose.

MCP also forces you to think carefully about tool design in a way that REST APIs don't. A human reading an API spec can infer intent from naming conventions and examples. An LLM reads your tool description cold, every single time. Vague tool descriptions lead to hallucinated parameters. Precision matters more than brevity.

Why It Matters

The next wave of developer tooling won't be AI that reads your code — it'll be AI that reads your entire stack in real time. MCP is the infrastructure layer that makes this possible. Building with it now feels like building on HTTP in 1995: rough edges, but you can see exactly where it's going.

If you're building dev tools, AI assistants, or anything that touches documentation — MCP is worth your time today.

// tags:AIAPIsMCPNext.js