Compare commits

..

1 Commits

Author SHA1 Message Date
technical-writer a303a3ecf1 docs(mcp): document HTTP/SSE transport mode + add missing env vars
Secret scan / secret-scan (pull_request) Successful in 29s
CI / build (pull_request) Successful in 2m18s
Gap-fill: the MCP server supports HTTP/SSE transport (controlled by
MCP_SERVER_PORT) but this was only mentioned in the server's internal
README, not in the public docs. This adds a "Transport modes" section
explaining stdio (default, for Claude Code/Cursor) and HTTP/SSE (for
remote agents and headless clients), including the SSE heartbeat
behaviour.

Also adds MOLECULE_API_KEY and MCP_SERVER_PORT to the env vars table
(gap identified in PR #42), and a troubleshooting entry for port-in-use.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 09:56:05 +00:00
2 changed files with 29 additions and 24 deletions
+29
View File
@@ -152,6 +152,34 @@ The MCP server exposes tools across these categories:
| Variable | Default | Description |
|---|---|---|
| `MOLECULE_URL` | `http://localhost:8080` | Platform API URL |
| `MOLECULE_API_KEY` | — | Bearer token for platform authentication |
| `MCP_SERVER_PORT` | `3000` | TCP port for HTTP/SSE transport |
## Transport modes
The MCP server supports two transport modes:
### stdio (default, for local AI clients)
Claude Code, Cursor, and similar local AI clients use stdio transport. The client spawns the MCP server as a child process and communicates via JSON-RPC over stdin/stdout. Configure in your AI client's `mcp.json` as shown in Quick start above.
### HTTP/SSE (for remote agents and headless clients)
For agents running on remote servers or in environments where stdio is not available, the MCP server exposes an HTTP endpoint with Server-Sent Events (SSE) for streaming responses. The agent card and tool responses are available at:
```
http://localhost:3000/agent/card # MCP server info + tool manifest
http://localhost:3000/ # SSE stream for responses
```
Start the server in HTTP/SSE mode:
```bash
MCP_SERVER_PORT=3000 npm start
# Server starts on http://localhost:3000
```
Configure your MCP client to connect over HTTP. The server emits `data: null` heartbeats every 30 seconds on idle connections to keep proxies and load balancers from closing the SSE stream.
## Troubleshooting
@@ -159,4 +187,5 @@ The MCP server exposes tools across these categories:
|---|---|
| Connection refused | Check `MOLECULE_URL` points to running platform |
| 401 Unauthorized | Token expired or revoked — create a new one |
| Port already in use | Set `MCP_SERVER_PORT` to an available port if 3000 is taken |
| Tools not showing | Run `npx @molecule-ai/mcp-server@1.0.0` standalone to check errors |
-24
View File
@@ -2,33 +2,9 @@ import { createMDX } from 'fumadocs-mdx/next';
const withMDX = createMDX();
// HTML pages: short edge cache + long stale-while-revalidate. Lets Vercel Edge
// serve repeat navigations from cache (~5 min fresh, 24 h stale-while-revalidate
// in the background) while keeping the browser revalidating on every nav. The
// negative lookahead leaves Next.js's own _next/static (immutable, hash-named)
// and _next/image cache headers untouched.
const HTML_CACHE_CONTROL =
'public, max-age=0, s-maxage=300, stale-while-revalidate=86400';
/** @type {import('next').NextConfig} */
const config = {
reactStrictMode: true,
async headers() {
return [
{
// Match every path except Next.js internals and API routes — those
// already have correct cache headers (immutable for hashed assets,
// app-controlled for /api).
source: '/((?!_next/static|_next/image|api/).*)',
headers: [
{
key: 'Cache-Control',
value: HTML_CACHE_CONTROL,
},
],
},
];
},
};
export default withMDX(config);