Public Docs
OpenAPI Source of Truth
MCP Streamable HTTP
CLI for Consumers
TSFM.ai developer documentation.
Multiple pages, one contract. API, MCP, and CLI are aligned on the same schema so teams can move from manual calls to production automation with zero drift.
MCP
Stateless Streamable HTTP MCP endpoint
MCP is a separate process from core API and should stay stateless. It translates tool calls directly into OpenAPI operations so agent integrations remain schema-grounded.
Runtime guarantees
- Transport is Streamable HTTP with stateless request handling.
- Every OpenAPI operationId is exposed as an MCP tool at startup.
list_api_operationsprovides discoverability with required path/query metadata.- Tool execution uses the same request builder/validator as CLI and schema runtime.
- No sticky sessions are required because MCP server does not persist session state.
MCP server configuration
| Field | Type | Required | Description |
|---|---|---|---|
| MCP_HOST | string | No | Bind host for MCP server (default 127.0.0.1). |
| MCP_PORT | number | No | Bind port for MCP server (default 8090). |
| MCP_PATH | string | No | HTTP path for MCP requests (default /mcp). |
| TSFM_API_BASE_URL | string (url) | No | Default API target for schema-driven tool execution. |
| TSFM_API_SCHEMA | string (path) | No | Optional path override for schema used to build tool set. |
Connect and call a tool
mcp-client.ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
const client = new Client({ name: "my-app", version: "1.0.0" });
const transport = new StreamableHTTPClientTransport(new URL("https://api.tsfm.ai/mcp"));
await client.connect(transport);
const result = await client.callTool({
name: "forecast",
arguments: {
base_url: "https://api.tsfm.ai",
api_key: process.env.TSFM_API_KEY,
body: {
model: "amazon/chronos-2",
inputs: [{ item_id: "series_1", target: [1, 2, 3, 4, 5, 6] }],
parameters: { prediction_length: 6, freq: "D" }
}
}
});Enumerate available operations
mcp-list-ops.ts
const ops = await client.callTool({
name: "list_api_operations",
arguments: { include_schema_path: true }
});
console.log(ops.structuredContent.operations.map((op) => op.operationId));Protocol notes
POST /mcpis the primary transport endpoint (configurable viaMCP_PATH).GET /healthzreturns MCP-specific liveness with protocol metadata.- Tool names equal OpenAPI
operationIdvalues for zero-guess routing. - Tool input accepts
base_url, auth credentials, path/query maps, body, headers, and timeout. - Tool errors are structured with stable codes such as
unknown_operation_idandmissing_path_parameter.
Deployment checklist
- Expose
/healthzon MCP service and include protocol/mode in health payload. - Terminate TLS at edge proxy and forward only POST requests to MCP path.
- Restrict ingress to trusted clients if MCP is internal-only.
- Roll schema and MCP deploys together to keep tool list aligned with API changes.