Socket
Book a DemoInstallSign in
Socket

sufetch

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sufetch

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

latest
Source
npmnpm
Version
0.4.0
Version published
Weekly downloads
3
-25%
Maintainers
1
Weekly downloads
 
Created
Source

SuFetch banner

SuFetch

Version Downloads License TypeScript MCP Server

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

Table of Contents

What is SuFetch?

SuFetch combines two powerful tools:

  • Type-Safe API Clients - Generate fully-typed TypeScript clients from OpenAPI specifications
  • 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:

APIDescriptionEndpointsImport
DigitalOceanComplete cloud platform API200+sufetch/digitalocean
Hetzner CloudCloud infrastructure management100+sufetch/hetzner
Ory KratosIdentity & user management50+sufetch/ory
Ory HydraOAuth 2.0 & OpenID Connect40+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:

Claude Desktop (click to expand)

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.

Claude Code CLI (click to expand)
claude mcp add --transport stdio --scope project sufetch -- sufetch-mcp

Or create .mcp.json:

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

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

Available MCP Tools

ToolDescription
list_apisList all available APIs
get_api_infoGet API metadata
search_endpointsSearch by path/method/description
get_endpoint_detailsGet full endpoint specs
get_schema_detailsGet data schemas
generate_code_exampleGenerate TypeScript code
get_quickstartGet API quickstart guide

Adding New APIs

Click to see how to add your own OpenAPI specs
  • Create directory: mkdir -p openapi-specs/myapi
  • Add your myapi.json OpenAPI spec
  • Copy apiful.config.ts and index.ts from openapi-specs/ory/ as template
  • Run pnpm build

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

See CLAUDE.md for detailed instructions.

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

MCP Server not showing?
# 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)
Build issues?
rm -rf node_modules pnpm-lock.yaml dist
pnpm install && pnpm build

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`

License

MIT © 2025

Built with apiful · MCP

Keywords

openapi

FAQs

Package last updated on 03 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts