# Convert specific routes to Resources instead of Tools
route_map.map("/tasks", component_type="resource")

mcp = FastMCP.from_openapi(
    openapi_spec=openapi_spec,
    client=client,
    name="Task Management API",
    route_map=route_map
)
```

### FastMCP Cloud: Managed hosting

FastMCP also offers [FastMCP Cloud](https://fastmcp.cloud), a managed hosting platform similar to Gram. With FastMCP Cloud, you can upload your OpenAPI document or deploy your FastMCP server and get instant hosted access without managing infrastructure.

![FastMCP Cloud](/assets/blog/generate-mcp-from-openapi/fastmcp-cloud.png)


### When to use FastMCP

Choose FastMCP if you work primarily in Python, want minimal boilerplate code, need programmatic control over server configuration, or prefer a lightweight, code-first approach. Use FastMCP Cloud for managed hosting while staying in the Python ecosystem.


FastMCP recommends manually designed MCP servers for complex APIs to achieve better performance. The auto-conversion is best for getting started quickly or for simpler APIs.


## openapi-mcp-generator: Open-source TypeScript tool

[openapi-mcp-generator](https://github.com/harsha-iiiv/openapi-mcp-generator) is an open-source CLI tool that generates standalone TypeScript MCP servers from OpenAPI specifications.

![openapi-mcp-generator](/assets/blog/generate-mcp-from-openapi/mcp-generator.png)

### How it works

The generator creates a complete TypeScript project with automatic Zod validation schemas, multiple transport mode support (stdio, web server with SSE, StreamableHTTP), built-in HTML test clients, environment-based authentication, and fully typed server code.

### Getting started

Install the generator:

```bash
npm install -g openapi-mcp-generator
```

Generate a stdio MCP server (for Claude Desktop):

```bash
openapi-mcp-generator \
  --input path/to/openapi.json \
  --output path/to/output/dir
```

Or generate a web server with Server-Sent Events:

```bash
openapi-mcp-generator \
  --input path/to/openapi.json \
  --output path/to/output/dir \
  --transport=web \
  --port=3000
```

Run the generated server:

```bash
cd path/to/output/dir
npm install
npm start
```

### Transport modes

The generator supports three transport modes:

**stdio**: Standard input/output for desktop applications like Claude Desktop
```json
{
  "mcpServers": {
    "tasks-api": {
      "command": "node",
      "args": ["path/to/generated/server/index.js"],
      "env": {
        "API_KEY": "your-api-key"
      }
    }
  }
}
```

**web**: HTTP server with Server-Sent Events for browser-based clients
```bash
openapi-mcp-generator --input openapi.json --output ./server --transport=web --port=3000
```

**StreamableHTTP**: Streaming HTTP for high-performance scenarios
```bash
openapi-mcp-generator --input openapi.json --output ./server --transport=streamable-http
```

### Authentication

The generator handles authentication via environment variables:

```bash