# Read and write, but not destructive operations
npx mcp start --scope read --scope write
```

### When to use Speakeasy

Choose Speakeasy if you need full control over generated code and deployment, want type-safe SDKs alongside your MCP server, require extensive customization of the MCP implementation, or prefer self-hosting with complete infrastructure control.

## Gram: Managed MCP platform

[Gram](https://getgram.ai) is a managed platform made by Speakeasy that takes a different approach to MCP server generation. Instead of generating code for you to deploy, Gram builds on Speakeasy's excellent MCP generation to provide a fully hosted platform where you upload your OpenAPI document and get an instantly accessible MCP server.

### How Gram works

Upload your OpenAPI document and the platform parses your API specification. Create toolsets by selecting and organizing relevant operations into use-case-specific groups. Configure environments with API keys and environment variables. Deploy and your MCP server is immediately available at a hosted URL.

### Enterprise-ready features

Gram provides a comprehensive platform built for teams and production deployments:

**Toolset curation**: Not every API operation makes sense as an MCP tool. Gram lets you select specific operations to include or exclude, create multiple toolsets for different use cases (like "read-only" vs "full-access"), add custom prompts and context to individual tools, and combine operations into workflow-based custom tools.

![Gram tools curate](/assets/blog/generate-mcp-from-openapi/gram-tools-curate.png)

**Environment management**: Configure multiple environments (development, staging, production) with different API keys, base URLs, and credentials. Switch between environments without changing your MCP server configuration.

**Built-in authentication**: Gram handles OAuth flows, API key management, and token refresh automatically. Your MCP server can authenticate with APIs that require OAuth without you needing to implement the flow yourself.

![Gram authentication](/assets/blog/generate-mcp-from-openapi/gram-auth.png)

**Team collaboration**: Share toolsets across your organization, manage access controls, and collaborate on tool definitions with your team.

**Managed hosting**: Instant deployment at `app.getgram.ai/mcp/your-server` or use custom domains like `mcp.yourdomain.com`. No infrastructure to manage, no servers to maintain.

**Interactive playground**: Test your tools directly in Gram's playground before deploying to production. Try natural language queries and see exactly how AI agents interact with your API.


### The x-gram extension

Similar to Speakeasy, Gram supports OpenAPI extensions for customization:

```yaml
paths:
  /tasks/{id}:
    get:
      operationId: getTask
      summary: Get task details
      x-gram:
        name: get_task_details
        description: |
          <context>
            Retrieves complete details for a specific task including title,
            description, priority, status, and timestamps.
          </context>
          <prerequisites>
            - You must have a valid task ID. Use list_tasks first if needed.
          </prerequisites>
        responseFilterType: jq
```

The `x-gram` extension lets you provide LLM-optimized descriptions with context, specify prerequisites for using a tool, and configure response filtering to reduce token usage.

### When to use Gram

Choose Gram if you want the fastest path from an OpenAPI document to a hosted MCP server, prefer managed infrastructure over self-hosting, need multiple toolsets for different use cases, require built-in OAuth and API key management, or value ease of use and team collaboration over infrastructure control.

Sign up today at [getgram.ai](https://getgram.ai) to get started.

## FastMCP: Python framework for MCP servers

[FastMCP](https://github.com/jlowin/fastmcp) is a Python framework for building MCP servers. As of [FastMCP version `2.0.0`](https://github.com/jlowin/fastmcp/releases/tag/v2.0.0) it can automatically convert OpenAPI specifications into MCP servers with just a few lines of code. FastMCP also supports converting FastAPI applications directly, making it ideal for Python developers who want to expose existing FastAPI endpoints as MCP tools.

### How FastMCP works

By default, every endpoint in your OpenAPI specification becomes a standard MCP Tool, making all your API's functionality immediately available to LLM clients. You can customize which endpoints to include and how they're exposed using route mapping.

### Getting started with FastMCP

Install FastMCP:

```bash
pip install fastmcp
```

Create an MCP server from OpenAPI:

```python
import httpx
from fastmcp import FastMCP