A GitHub-ready, Cloudflare Workers + static frontend chat application for connecting a browser chat UI to a server-side Muse AI endpoint, with optional MCP proxy support.
- Modern responsive ChatGPT-style interface
- Cloudflare Workers backend
- Static assets served by Workers Assets
- Server-side Muse API key; never exposed to the browser
- OpenAI-compatible Muse endpoint support
- Streaming responses (SSE, JSON streaming, and plain text fallback)
- Conversation history in localStorage
- New chat / stop generation
- Markdown rendering with safe HTML escaping
- Copy buttons for assistant code blocks
- Configurable Muse endpoint/model through Cloudflare variables/secrets
- Optional
/api/mcppass-through for an MCP HTTP endpoint - Health endpoint:
/api/health
Create a repository and push this project:
git init
git add .
git commit -m "Initial FlyTripVisa MCP Chat UI"
git branch -M main
git remote add origin https://github.com/YOUR-ACCOUNT/YOUR-REPO.git
git push -u origin mainInstall Wrangler:
npm installLogin:
npx wrangler loginSet the production secret:
npx wrangler secret put MUSE_API_KEYThen deploy:
npm run deployEdit wrangler.jsonc for non-secret variables:
MUSE_API_URLMUSE_MODELMUSE_API_STYLEALLOWED_ORIGIN
Set the API key as a secret:
npx wrangler secret put MUSE_API_KEYFor a Muse endpoint that is OpenAI-compatible:
MUSE_API_STYLE=openai
The Worker sends:
{
"model": "YOUR_MUSE_MODEL",
"messages": [
{"role": "user", "content": "Hello"}
],
"stream": true
}If your Muse API uses a different request/response format, edit only the buildMuseRequest() and extractText() functions in worker/index.ts.
cp .dev.vars.example .dev.vars
# edit .dev.vars
npm run devRequest:
{
"messages": [
{"role": "user", "content": "Hello"}
],
"stream": true
}Response:
text/event-streamwhen Muse streams- JSON/text fallback when it does not
Returns service status and whether Muse is configured.
Optional MCP HTTP proxy. Disabled by default. Set:
MCP_ENABLED=true
MCP_SERVER_URL=https://your-mcp-server.example.com
and, if needed:
npx wrangler secret put MCP_AUTH_TOKENWorkers & Pages → your Worker → Settings → Variables and Secrets.
Variables:
MUSE_API_URLMUSE_MODELMUSE_API_STYLEALLOWED_ORIGINMCP_ENABLEDMCP_SERVER_URL
Secret:
MUSE_API_KEY- optional
MCP_AUTH_TOKEN
Do not put API keys in public/.
Attach your domain in Cloudflare:
Workers & Pages → your Worker → Settings → Domains & Routes → Add Custom Domain.
For example:
chat.flytripvisa.site
If you want the chat directly at the main domain, use a route such as:
flytripvisa.site/chat*
This project does not assume a specific proprietary Muse API schema beyond OpenAI-compatible chat completion semantics. If your exact Muse endpoint has a different payload, send its endpoint documentation/example request and the adapter can be changed without rebuilding the UI.


