Api-Response-Types-MCP-Server

tyzrex/Api-Response-Types-MCP-Server

3.2

If you are the rightful owner of Api-Response-Types-MCP-Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A Model Context Protocol (MCP) server that queries APIs and automatically generates TypeScript types from responses.

Tools
  1. query_api

    Query an API endpoint and generate TypeScript types from the response.

  2. generate_types_from_json

    Generate TypeScript types from a JSON object.

  3. validate_api_response

    Validate an API response structure and compare with expected format.

API Types MCP Server

A Model Context Protocol (MCP) server that queries APIs and automatically generates TypeScript types from responses. Perfect for frontend developers who want to quickly get type definitions for external APIs.

Features

  • 🚀 Query any REST API endpoint
  • 🎯 Automatically generate TypeScript interfaces from JSON responses
  • 🔍 Support for all HTTP methods (GET, POST, PUT, DELETE, PATCH)
  • 🛡️ Request validation and error handling
  • 📊 API response structure analysis
  • 🔧 Custom interface naming
  • ✅ Response validation against expected structures

Installation

  1. Clone the project:
git clone https://github.com/tyzrex/Api-Response-Types-MCP-Server api-types-mcp-server
cd api-types-mcp-server
  1. Install dependencies:
pnpm install
  1. Build the project:
pnpm run build

Setup

  1. Add the server to your MCP configuration file (usually in Claude Desktop settings):
{
  "mcpServers": {
    "api-types": {
      "command": "node",
      "args": ["./dist/server.js"],
      "cwd": "/absolute/path/to/api-types-mcp-server"
    }
  }
}
  1. Restart Claude Desktop to load the server.

Available Tools

1. query_api

Query an API endpoint and generate TypeScript types from the response.

Parameters:

  • url (required): API endpoint URL
  • method (optional): HTTP method (default: GET)
  • headers (optional): Request headers
  • body (optional): Request body for POST/PUT/PATCH
  • interfaceName (optional): Custom interface name

Example usage:

Query the JSONPlaceholder API: https://jsonplaceholder.typicode.com/posts/1

2. generate_types_from_json

Generate TypeScript types from a JSON object.

Parameters:

  • json (required): JSON object to generate types from
  • interfaceName (optional): Custom interface name

3. validate_api_response

Validate an API response structure and compare with expected format.

Parameters:

  • url (required): API endpoint URL
  • expectedStructure (optional): Expected response structure

Usage Examples

Basic API Query

Use the query_api tool to get types for: https://api.github.com/users/octocat

Custom Headers

Query https://api.example.com/data with Authorization header: Bearer your-token

POST Request with Body

Make a POST request to https://api.example.com/users with body:
{
  "name": "John Doe",
  "email": "john@example.com"
}

Generate Types from JSON

Generate TypeScript types for this JSON:
{
  "id": 1,
  "name": "Product",
  "price": 29.99,
  "inStock": true,
  "tags": ["electronics", "gadget"]
}

Generated Output

The server generates clean TypeScript interfaces like:

interface UserResponse {
  id: number;
  name: string;
  email: string;
  address: {
    street: string;
    city: string;
    zipcode: string;
  };
  posts: Post[];
}