Skip to content

Commit 65743a6

Browse files
committed
feat(mcp): fix MCP server implementation and add local testing setup
1 parent 070d07d commit 65743a6

4 files changed

Lines changed: 765 additions & 96 deletions

File tree

cloudflare-mcp/README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Flare Developer Hub — MCP Cloudflare Worker
22

3-
Cloudflare Worker that serves the MCP server for the Flare Developer Hub at `dev.flare.network/mcp`.
3+
Cloudflare Worker that serves the MCP server for the Flare Developer Hub.
4+
5+
The worker and the docs site can be hosted separately:
6+
7+
- The Docusaurus build can be served from GitHub Pages or any static host.
8+
- The Cloudflare Worker serves only the MCP endpoint.
9+
- `DOCS_BASE_URL` must point to the public docs origin that agents should fetch.
10+
11+
The worker serves the MCP endpoint at `/mcp`.
12+
The server exposes the Flare Developer Hub documentation tools used by MCP clients, including `docs_search` and `docs_fetch`.
413

514
## Deploy
615

@@ -22,11 +31,34 @@ npx wrangler deploy --config cloudflare-mcp/wrangler.toml
2231
npx wrangler dev --config cloudflare-mcp/wrangler.toml
2332
```
2433

34+
This runs the Worker locally and serves the MCP endpoint at `http://127.0.0.1:8787/mcp`.
35+
36+
## Local MCP testing
37+
38+
There is also a repo-root local test server at `mcp-server.mjs`.
39+
Use it when you want to test the MCP server behavior without running the Cloudflare Worker.
40+
41+
From the repo root:
42+
43+
```bash
44+
npm run build
45+
node mcp-server.mjs
46+
```
47+
48+
This starts a local MCP server at `http://localhost:3456`.
49+
It uses `build/mcp/*` artifacts when available and falls back to `build/search-index.json` plus local or runtime HTML fetching when those MCP artifacts are missing or incomplete.
50+
2551
## Prerequisites
2652

27-
The worker bundles `build/mcp/docs.json` and `build/mcp/search-index.json` generated by the Docusaurus build. Run a full site build before deploying:
53+
Run a full site build before deploying:
2854

2955
```bash
3056
npm run build
3157
npm run deploy:mcp
3258
```
59+
60+
The worker uses the generated build artifacts as follows:
61+
62+
- It prefers valid `build/mcp/*` artifacts from `docusaurus-plugin-mcp-server`.
63+
- If those MCP artifacts are missing or incomplete, it falls back to `build/search-index.json` for `docs_search`.
64+
- In fallback mode, `docs_fetch` retrieves page HTML from `DOCS_BASE_URL` at runtime.

0 commit comments

Comments
 (0)