Mojo documentation mcp server, using Max for embeddings

# Introducing MCP Documentation Servers: Real-time Mojo Docs for Your AI Models

Hey Mojo community! Longtime lurker, first-time poster.

I’ve been working on something that I think solves a real pain point, especially for those of us using AI models (like Claude in VS Code) alongside a rapidly evolving language like Mojo.

## The Problem

Mojo is changing fast. New features, updated syntax, better APIs—it’s exciting, but it creates a challenge: **how do models stay current?** By the time documentation makes it into training data, it’s already outdated. And copying snippets from docs into prompts? Tedious and error-prone.

## The Solution

I built a framework for creating **searchable MCP servers** that expose documentation with **hybrid search** (vector + keyword matching). The practical result: your AI models get instant access to up-to-date, relevant documentation through [Model Context Protocol](https://modelcontextprotocol.io/).

Think of it as giving Claude or your model a live, searchable knowledge base that’s always in sync with the actual language and doesn’t overwhelm the context window.

## How It Works

1. **Process documentation** (MDX/Markdown) → extract and chunk it intelligently
2. **Generate embeddings** using MAX’s `sentence-transformers` model
3. **Index with DuckDB** (HNSW for vectors, BM25 for keywords)
4. **Expose via MCP** so models can search and retrieve context

The server is self-contained—once built, it runs anywhere with just Pixi or Python. Perfect for distributing across different documentation sources.

I use the mojo manual, directly from the Modular repo, as the source documentation. I plan to update the database, any time there is a change in the docs.

## Why This Matters for Mojo

Mojo is new and evolving rapidly. By the time you ask a model “How does ownership work in Mojo?” you want the *current* answer, not something from 2024. This approach ensures models always have access to the latest manual.

Plus, hybrid search means better results—semantic understanding *and* exact keyword matching.

## Visit the Repo

Head over to **[github.com/jpotter80/mcp](https://github.com/jpotter80/mcp)** for the full framework and a working Mojo Manual MCP server.

The framework is there for creating new servers, from other docs. However, the mojo-manual-mcp is ready to use right now, no build pipeline necessary.

Setup is straightforward (Pixi recommended):
```bash
git clone https://github.com/jpotter80/mcp
cd path/to/mcp/servers/mojo-manual-mcp
pixi install
```

Then, copy the json config into the VS Code mcp.json file, and hit start server button. You may have to restart VS Code for the config to take effect.

{
“servers”: {
“mojo-manual”: {
“type”: “stdio”,
“command”: “pixi”,
“args”: [“run”, “serve”],
“cwd”: “/absolute/path/to/mojo-manual-mcp”
}
}
}

Since I use VS Code, I have not tested this on Cursor, Claude Desktop, etc. I understand that the json config is slightly different, depending on client. I will be testing those clients, in the future.

James Potter

4 Likes

James, apologies, the server held your message up for some weird reason.

Very slick implementation.

1 Like

No worries, Darin! Thank you for the kind words.