public MCP: a browser on the bare host goes to the landing page

This commit is contained in:
CRTkafa 2026-11-08 02:27:53 +07:00
parent b82becf7fb
commit 07052cffd2
3 changed files with 6 additions and 1 deletions

View file

@ -205,6 +205,8 @@ export function startHttp(o: HttpOptions): Promise<{ close: () => void; port: nu
// public: the bare host is the MCP endpoint too (people paste "mcp.example.com" into a connector), and a browser
// opening it gets the connect line instead of a 404
if (pub && path === '/' && req.method === 'GET') {
// a person in a browser goes to the landing page; any other client gets the connect line
if (/text\/html/.test(String(req.headers.accept ?? ''))) { res.writeHead(302, { ...cors, location: 'https://storebound.dev/' }); return res.end(); }
res.writeHead(200, { ...cors, 'content-type': 'text/plain; charset=utf-8' });
return res.end(`storebound MCP server ${pkg.version} (read-only, no key)\nAdd it as a remote MCP server / custom connector with this URL. Claude Code: claude mcp add --transport http storebound <this URL>\n`);
}