AST MCPast-mcp
Guides

Streamable HTTP

Run the MCP server over a loopback-first HTTP transport.

Stdio is the trusted installer and runtime default. Select Streamable HTTP when a host needs a URL connection:

ast-mcp install --transport http --host 127.0.0.1 --port 3768 --target all
ast-mcp mcp --transport http

The server resolves bind values as CLI flags, environment overrides, project TOML, global TOML, then built-in defaults. The built-in port is now 3768 instead of the former development default 3000; an explicit http.port or PORT keeps an existing deployment unchanged. The remaining defaults are loopback host 127.0.0.1, a 30-minute idle timeout, and a one-minute sweep. Existing HTTP environment variables and PORT remain compatible. 0.0.0.0 and :: bind broadly but generate loopback client URLs; any other non-loopback host is an explicit network exposure.

Installer and services

Codex receives a TOML url; Claude Code, Copilot, and VS Code receive their native type: "http" entries. Explicit installer --host and --port values are persisted into the selected project or global ast-mcp.toml without removing unrelated settings. Omitting those flags uses the layered configuration.

Add --service to install a per-user macOS LaunchAgent or Linux systemd unit. Local services require an explicit --port; global services may use the layered/default port. --no-service stops and removes the managed unit, while uninstall removes it after the last HTTP host entry is removed. Windows uses manual startup because managed services are not supported.

Sessions and responses

The endpoint is /mcp. MCP session IDs correlate requests; they are not authentication. Sessions have bounded idle cleanup and are closed during graceful shutdown.

JSON-RPC batches may mix requests and notifications:

  • stdio emits one framed response per request
  • HTTP emits one SSE event per request by default
  • notifications never receive responses
  • JSON-array HTTP responses require enableJsonResponse

Shutdown

SIGTERM, SIGINT, and SIGHUP initiate graceful cleanup. The HTTP process stops accepting requests, closes active sessions, and then closes remaining connections. A second signal forces termination while cleanup is pending.

On this page