explaingit

stainlu/stainful

Analysis updated 2026-06-24

78PythonAudience · developerComplexity · 3/5Setup · moderate

TLDR

Open-source Python SDK generator that reads an OpenAPI 3 spec plus a stainless.yml config and emits a hand-written-feeling SDK on httpx and pydantic v2, with optional Mintlify docs and an MCP server.

Mindmap

mindmap
  root((stainful))
    Inputs
      OpenAPI 3 spec
      stainless.yml config
      API metadata
    Outputs
      Python SDK
      Mintlify api.md
      MCP server
    Use Cases
      Replace shuttered Stainless service
      Ship a typed Python SDK
      Expose API as MCP tools
    Tech Stack
      Python
      httpx
      pydantic
      OpenAPI
      MCP
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Generate a typed Python SDK from your OpenAPI 3 spec that reads as if written by hand.

USE CASE 2

Migrate an existing stainless.yml config off the wound-down Stainless service to a self-hosted generator.

USE CASE 3

Emit a Mintlify-compatible api.md documentation file alongside the SDK.

USE CASE 4

Generate a Model Context Protocol server that exposes each HTTP method as a tool for Claude or Cline.

What is it built with?

PythonhttpxpydanticOpenAPIMCP

How does it compare?

stainlu/stainfulkrishnaik06/multiple-linear-regressiontencent-hunyuan/hy-mt2
Stars787776
LanguagePythonPythonPython
Last pushed2019-01-31
MaintenanceDormant
Setup difficultymoderateeasyhard
Complexity3/51/54/5
Audiencedevelopergeneralresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Needs an OpenAPI 3 spec plus a stainless.yml config, the documented gap is that operations with multiple request body content types pick the first match.

In plain English

stainful is an open-source tool that takes an API description in OpenAPI 3 format plus a configuration file called stainless.yml, and uses them to generate a Python SDK. An SDK is a library that other developers can install with pip and use to call your API from their own Python code. The project bills itself as a continuation path for users of Stainless, a commercial SDK generator that Anthropic acquired and is winding down. If you already have a stainless.yml file from that service, stainful is meant to read it without changes. The goal is to produce SDK code that reads as if a person wrote it by hand, rather than the verbose, awkward code that mechanical generators typically emit. The README contrasts these styles directly: a typical generator gives you something like api.agency_agency_id_json_get(id), while a stainful-generated SDK gives you client.agency.retrieve(id). The generated SDKs include typed data models built on pydantic v2, real Python exception classes for errors like rate limits, automatic pagination so you can write a for-loop over results, retries with backoff and jitter, streaming over Server-Sent Events, and both sync and async versions from a single source. Generated SDKs depend only on httpx and pydantic. The tool runs entirely on your machine or in CI, with no hosted service or account required. Beyond the SDK itself, stainful can emit a Mintlify-compatible api.md documentation file and a Model Context Protocol server that exposes each HTTP method as a tool for AI assistants like Claude, Cline, or mcp-cli to call. The internal pipeline parses the OpenAPI spec and stainless.yml into an intermediate representation, resolves things like $ref and allOf, and then a Python emitter renders the SDK over a hand-written vendored runtime. At version 0.4.0, the project is verified against the real Stainless-generated SDKs for OneBusAway and OpenAI: 29 of 29 OneBusAway test files import unchanged against stainful's output, and the public OpenAI spec produces a mypy-clean SDK. The repository reports 118 tests, ruff clean, and CI green on Python 3.10 through 3.12. One documented gap is that operations with multiple request body content types still pick the first match. The stated roadmap is Python first, then MCP server polish, then a second language, then a docs site.

Copy-paste prompts

Prompt 1
Run stainful against my OpenAPI 3 spec and a stainless.yml file, then publish the resulting Python SDK to PyPI.
Prompt 2
Compare the SDK stainful generates for the OpenAI spec with the public openai-python client and show three method-name differences.
Prompt 3
Use stainful to emit an MCP server for my API and register it with Claude Desktop so a chat can call my endpoints.
Prompt 4
Patch stainful so that operations with multiple request body content types pick the JSON body rather than the first match.
Prompt 5
Generate a stainful SDK with retries, pagination, and Server-Sent Events streaming, then write a small example script that uses each feature.

Frequently asked questions

What is stainful?

Open-source Python SDK generator that reads an OpenAPI 3 spec plus a stainless.yml config and emits a hand-written-feeling SDK on httpx and pydantic v2, with optional Mintlify docs and an MCP server.

What language is stainful written in?

Mainly Python. The stack also includes Python, httpx, pydantic.

How hard is stainful to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is stainful for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.