sufetch

sufetch

MCP server that enables AI assistants to explore and generate code for type-safe OpenAPI clients from various cloud APIs like DigitalOcean, Hetzner Cloud, and Ory.

Category
访问服务器

README

SuFetch banner

SuFetch

<p> <a href="https://www.npmjs.com/package/sufetch"><img src="https://img.shields.io/npm/v/sufetch.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Version"></a> <a href="https://www.npmjs.com/package/sufetch"><img src="https://img.shields.io/npm/dm/sufetch.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Downloads"></a> <a href="https://github.com/productdevbook/sufetch/blob/main/LICENSE"><img src="https://img.shields.io/github/license/productdevbook/sufetch.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="License"></a> <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5.7-18181B?style=flat&logo=typescript&colorB=3178C6" alt="TypeScript"></a> <a href="https://github.com/productdevbook/sufetch"><img src="https://img.shields.io/badge/MCP%20Server-18181B?style=flat&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTIgMkw0IDdWMTdMMTIgMjJMMjAgMTdWN0wxMiAyWiIgc3Ryb2tlPSIjRkZGIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=&colorB=28CF8D" alt="MCP Server"></a> </p>

Type-safe OpenAPI clients with MCP server for AI-driven API exploration

Table of Contents


What is SuFetch?

SuFetch combines two powerful tools:

  1. Type-Safe API Clients - Generate fully-typed TypeScript clients from OpenAPI specifications
  2. MCP Server - Let AI assistants (like Claude) explore your APIs and generate code

Built with apiful for type-safe OpenAPI clients.

Features

  • Fully Type-Safe - Autocomplete and type checking for all API calls
  • 🤖 MCP Integration - AI assistants can explore and generate code for your APIs
  • 🔄 Auto-Discovery - Automatic service detection and type generation
  • 🛠️ Modern Stack - TypeScript 5.7, ESNext, strict mode
  • 🧪 Well-Tested - 76+ tests with >60% coverage

Installation

For Using the API Client

# npm
npm install sufetch

# pnpm
pnpm add sufetch

# yarn
yarn add sufetch

For MCP Server (Global)

# Install globally
npm install -g sufetch

# Verify installation
sufetch-mcp --version

For Development

git clone https://github.com/productdevbook/sufetch.git
cd sufetch
pnpm install
pnpm build

Quick Start

Using the Type-Safe API Client

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.

Type Helpers for Advanced Type Safety

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
  })
}

Available properties:

  • ['request'] - Request body type
  • ['response'] - Success response (200/201)
  • ['query'] - Query parameters
  • ['path'] - Path parameters
  • ['responses'][status] - Specific status code response

Works with all APIs: HetznerCloud, DigitalOcean, OryKaratos, OryHydra.

Using with AI Assistants (MCP)

See the MCP Server Setup section below.

Supported APIs

SuFetch currently includes:

API Description Endpoints Import
DigitalOcean Complete cloud platform API 200+ sufetch/digitalocean
Hetzner Cloud Cloud infrastructure management 100+ sufetch/hetzner
Ory Kratos Identity & user management 50+ sufetch/ory
Ory Hydra OAuth 2.0 & OpenID Connect 40+ sufetch/ory

Want to add more? See Adding New APIs.

MCP Server Setup

Quick Setup

1. Install (choose one):

npm install -g sufetch  # Global
npx sufetch-mcp         # No install

2. Configure:

<details> <summary><b>Claude Desktop</b> (click to expand)</summary>

Edit config file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "sufetch": {
      "command": "sufetch-mcp"
    }
  }
}

Restart Claude Desktop. </details>

<details> <summary><b>Claude Code CLI</b> (click to expand)</summary>

claude mcp add --transport stdio --scope project sufetch -- sufetch-mcp

Or create .mcp.json:

{
  "mcpServers": {
    "sufetch": {
      "command": "sufetch-mcp"
    }
  }
}

</details>

3. Test: Ask Claude: "List available APIs using sufetch"

Available MCP Tools

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

Adding New APIs

<details> <summary>Click to see how to add your own OpenAPI specs</summary>

  1. Create directory: mkdir -p openapi-specs/myapi
  2. Add your myapi.json OpenAPI spec
  3. Copy apiful.config.ts and index.ts from openapi-specs/ory/ as template
  4. Run pnpm build

Done! Your API is now available as sufetch/myapi and in the MCP server.

See CLAUDE.md for detailed instructions. </details>

Development

pnpm install  # Install
pnpm build    # Build
pnpm test     # Test
pnpm lint:fix # Lint

See CLAUDE.md for architecture, build pipeline, and contribution guide.

Troubleshooting

<details> <summary>MCP Server not showing?</summary>

# 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)

</details>

<details> <summary>Build issues?</summary>

rm -rf node_modules pnpm-lock.yaml dist
pnpm install && pnpm build

</details>

Still stuck? Open an issue with your Node version and error message.

Contributing

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`

Links

License

MIT © 2025


Built with apiful · MCP

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选