tyzrex/Api-Response-Types-MCP-Server
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.
query_api
Query an API endpoint and generate TypeScript types from the response.
generate_types_from_json
Generate TypeScript types from a JSON object.
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
- Clone the project:
git clone https://github.com/tyzrex/Api-Response-Types-MCP-Server api-types-mcp-server
cd api-types-mcp-server
- Install dependencies:
pnpm install
- Build the project:
pnpm run build
Setup
- 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"
}
}
}
- 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 URLmethod
(optional): HTTP method (default: GET)headers
(optional): Request headersbody
(optional): Request body for POST/PUT/PATCHinterfaceName
(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 frominterfaceName
(optional): Custom interface name
3. validate_api_response
Validate an API response structure and compare with expected format.
Parameters:
url
(required): API endpoint URLexpectedStructure
(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[];
}