Type-safe OpenAPI clients with MCP server for AI-driven API exploration
Type-safe OpenAPI clients with MCP server for AI-driven API exploration
SuFetch combines two powerful tools:
Built with apiful for type-safe OpenAPI clients.
# npm
npm install sufetch
# pnpm
pnpm add sufetch
# yarn
yarn add sufetch
# Install globally
npm install -g sufetch
# Verify installation
sufetch-mcp --version
git clone https://github.com/productdevbook/sufetch.git
cd sufetch
pnpm install
pnpm build
import { createClient, cloud } from 'sufetch/hetzner'
// Create a typed client
const client = createClient({
baseURL: 'https://api.hetzner.cloud/v1',
headers: {
'Authorization': 'Bearer your-api-token'
}
}).with(cloud)
// Fully typed requests and responses
const servers = await client('/servers', {
method: 'GET' // ✅ Type-checked
})
// TypeScript knows the response type
console.log(servers.servers) // ✅ Autocomplete works
See Supported APIs for all available services.
Extract specific types from endpoints for maximum type safety:
import type { HetznerCloud } from 'sufetch/hetzner'
// Extract request body type
type CreateServerBody = HetznerCloud<'/servers', 'post'>['request']
// Extract response type
type GetServerResponse = HetznerCloud<'/servers/{id}', 'get'>['response']
// Extract query parameters
type ListServersQuery = HetznerCloud<'/servers', 'get'>['query']
// Extract path parameters
type ServerPathParams = HetznerCloud<'/servers/{id}', 'get'>['path']
// Use in functions for type safety
function processServer(server: GetServerResponse) {
console.log(server.server.id) // ✅ Full autocomplete
console.log(server.server.name) // ✅ Type-checked
}
function createServer(body: CreateServerBody) {
// TypeScript enforces correct structure
return client('/servers', {
method: 'POST',
body // ✅ Type-safe
})
}
undefinedAvailable properties:undefined
['request'] - Request body type['response'] - Success response (200/201)['query'] - Query parameters['path'] - Path parameters['responses'][status] - Specific status code responseWorks with all APIs: HetznerCloud, DigitalOcean, OryKaratos, OryHydra.
See the MCP Server Setup section below.
SuFetch currently includes:
| API | Description | Endpoints | Import |
|---|---|---|---|
| undefinedDigitalOceanundefined | Complete cloud platform API | 200+ | sufetch/digitalocean |
| undefinedHetzner Cloudundefined | Cloud infrastructure management | 100+ | sufetch/hetzner |
| undefinedOry Kratosundefined | Identity & user management | 50+ | sufetch/ory |
| undefinedOry Hydraundefined | OAuth 2.0 & OpenID Connect | 40+ | sufetch/ory |
undefinedWant to add more? See Adding New APIs.
undefined1. Install (choose one):undefined
npm install -g sufetch # Global
npx sufetch-mcp # No install
undefined2. Configure:undefined
Edit config file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json{
"mcpServers": {
"sufetch": {
"command": "sufetch-mcp"
}
}
}
Restart Claude Desktop.
claude mcp add --transport stdio --scope project sufetch -- sufetch-mcp
Or create .mcp.json:
{
"mcpServers": {
"sufetch": {
"command": "sufetch-mcp"
}
}
}
undefined3. Test:undefined
Ask Claude: “List available APIs using sufetch”
| Tool | Description |
|---|---|
list_apis |
List all available APIs |
get_api_info |
Get API metadata |
search_endpoints |
Search by path/method/description |
get_endpoint_details |
Get full endpoint specs |
get_schema_details |
Get data schemas |
generate_code_example |
Generate TypeScript code |
get_quickstart |
Get API quickstart guide |
mkdir -p openapi-specs/myapimyapi.json OpenAPI specapiful.config.ts and index.ts from openapi-specs/ory/ as templatepnpm buildDone! Your API is now available as sufetch/myapi and in the MCP server.
See CLAUDE.md for detailed instructions.
pnpm install # Install
pnpm build # Build
pnpm test # Test
pnpm lint:fix # Lint
See CLAUDE.md for architecture, build pipeline, and contribution guide.
# Test server works
sufetch-mcp # Should output: "SuFetch MCP server running on stdio"
# Check config
claude mcp list # For Claude Code
cat .mcp.json # Check file exists
# Restart Claude Desktop (if using Desktop)
rm -rf node_modules pnpm-lock.yaml dist
pnpm install && pnpm build
undefinedStill stuck? Open an issue with your Node version and error message.
Contributions welcome! See CONTRIBUTING.md.
git clone https://github.com/productdevbook/sufetch.git
cd sufetch
pnpm install && pnpm build
# Make changes, run `pnpm test && pnpm lint:fix`
MIT © 2025
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.