Skip to content

ScribblesByKK/docfx-mcp-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DocFX MCP Server

An MCP (Model Context Protocol) server that exposes your DocFX documentation site — whether hosted on Cloudflare Pages, GitHub Pages, or any other static host — as a set of AI-usable tools.

Use it with GitHub Copilot in Visual Studio, VS Code, or any MCP-compatible client to let the AI search, browse, and read your docs without leaving the editor.


Features

Tool Description
list_articles Lists all articles from the site TOC
search_docs Keyword/phrase search across the documentation
fetch_article Fetches the full text of any documentation page
  • Multi-site support — configure one server for multiple DocFX sites
  • Docker Compose — one command to run locally or on a server
  • Pre-built image on GHCRghcr.io/scribblesbykk/docfx-mcp-server:latest
  • stdio transport — works directly with VS / VS Code Copilot without a network server
  • HTTP transport — for Docker or remote deployments (Streamable HTTP, MCP spec §5.2)

Quick Start

stdio (recommended for local Copilot use)

# Single site
DOCFX_SITE_URL=https://scribblesbykk.github.io/Cyclotron \
DOCFX_SITE_NAME=Cyclotron \
node src/index.js

Docker – pre-built image (fastest)

Pull and run the published image directly from GitHub Container Registry — no cloning required:

docker run -d \
  --name docfx-mcp-server \
  -p 3000:3000 \
  -e MCP_TRANSPORT=http \
  -e DOCFX_SITE_URL=https://scribblesbykk.github.io/Cyclotron \
  -e DOCFX_SITE_NAME=Cyclotron \
  ghcr.io/scribblesbykk/docfx-mcp-server:latest

The MCP endpoint is available at http://localhost:3000/mcp.

Docker Compose

  1. Edit docker-compose.yml and set your site URL(s) under DOCFX_SITES.
  2. Run:
docker compose up -d

The docker-compose.yml pulls ghcr.io/scribblesbykk/docfx-mcp-server:latest by default.
To build the image locally instead (e.g. after editing source), switch the image: line for the commented-out build: . line in the file.

The MCP endpoint is available at http://localhost:3000/mcp.


Configuration

Environment Variables

Variable Required Description
DOCFX_SITE_URL Yes (single-site) Base URL of your DocFX site
DOCFX_SITE_NAME No Display name for the site (default: docs)
DOCFX_SITES Yes (multi-site) JSON array of {name, url} objects
MCP_TRANSPORT No stdio (default) or http
PORT No HTTP server port (default: 3000)

Multi-site example (DOCFX_SITES)

[
  { "name": "Cyclotron", "url": "https://scribblesbykk.github.io/Cyclotron" },
  { "name": "AnotherLib", "url": "https://another-lib.pages.dev" }
]

When multiple sites are configured, all tools accept an optional site argument (the name value above).


Connecting to GitHub Copilot

Visual Studio 2022 (17.13+)

Add an MCP server entry in your solution's .github/copilot-mcp.json:

{
  "servers": {
    "docfx": {
      "command": "node",
      "args": ["${workspaceFolder}/path/to/docfx-mcp-server/src/index.js"],
      "env": {
        "DOCFX_SITE_URL": "https://scribblesbykk.github.io/Cyclotron",
        "DOCFX_SITE_NAME": "Cyclotron"
      }
    }
  }
}

Or, for Docker Compose HTTP transport, use a URL-based entry:

{
  "servers": {
    "docfx": {
      "type": "http",
      "url": "http://localhost:3000/mcp"
    }
  }
}

VS Code (GitHub Copilot extension)

Add to .vscode/mcp.json in your workspace:

{
  "servers": {
    "docfx": {
      "command": "node",
      "args": ["${workspaceFolder}/path/to/docfx-mcp-server/src/index.js"],
      "env": {
        "DOCFX_SITE_URL": "https://scribblesbykk.github.io/Cyclotron"
      }
    }
  }
}

Global config (all workspaces)

In VS Code settings.json:

{
  "github.copilot.chat.mcp.servers": {
    "docfx": {
      "command": "node",
      "args": ["/absolute/path/to/docfx-mcp-server/src/index.js"],
      "env": {
        "DOCFX_SITE_URL": "https://scribblesbykk.github.io/Cyclotron"
      }
    }
  }
}

Using with Docker Compose (HTTP transport)

Start the server:

docker compose up -d

Then in .vscode/mcp.json or .github/copilot-mcp.json:

{
  "servers": {
    "docfx": {
      "type": "http",
      "url": "http://localhost:3000/mcp"
    }
  }
}

Using the Tools in Copilot Chat

Once configured, you can ask Copilot:

@docfx list all articles
@docfx search for "dependency injection"
@docfx fetch https://scribblesbykk.github.io/Cyclotron/api/Cyclotron.html

Or naturally in chat:

"What does the Cyclotron FileSystemAdapter do? Check the docs."


How It Works

DocFX generates a set of well-known files on the static site:

File Used by
/toc.json list_articles — root table of contents
/api/toc.json list_articles — API reference TOC
/index.json search_docs — full-text search index (modern theme)
/{page}.html fetch_article — individual page content

The server fetches these files directly from the hosted site — no local build required.


Development

npm install

# Run locally (stdio)
DOCFX_SITE_URL=https://scribblesbykk.github.io/Cyclotron node src/index.js

# Run locally (HTTP)
MCP_TRANSPORT=http DOCFX_SITE_URL=https://scribblesbykk.github.io/Cyclotron node src/index.js

# Test
DOCFX_SITE_URL=https://scribblesbykk.github.io/Cyclotron npm test

Reusing Across Multiple Repos

This server is designed to be repo-agnostic. Each DocFX site is just a base URL. To use it with a new docs site, simply add an entry to DOCFX_SITES — no code changes needed.

You can run a single Docker Compose instance and point multiple project repos' Copilot configs at http://localhost:3000/mcp.


License

MIT

About

MCP server for DocFX documentation sites (Cloudflare Pages, GitHub Pages, any static host)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors