GeneratorsFree
MCP Client SDK Generator
Get a TypeScript, Python or Go client that reads your manifest and calls your tools.
Input
Client SDK
The client reads your manifest from https://api.example.com/.well-known/mcp.json once, caches it, and calls each tool at its endpoint.
// Generated by Techorizone. WebMCP client for https://api.example.com
// Works in Node.js 18+ and modern browsers (uses fetch).
export interface McpTool {
name: string;
description: string;
endpoint: string;
method?: string;
inputSchema?: Record<string, unknown>;
}
export interface McpManifest {
name: string;
description: string;
version: string;
tools: McpTool[];
}
export class MyWebMCPClient {
private manifest: McpManifest | null = null;
constructor(
private baseUrl: string = "https://api.example.com",
private headers: Record<string, string> = {},
) {}
async getManifest(): Promise<McpManifest> {
if (this.manifest) return this.manifest;
const res = await fetch(`${this.baseUrl}/.well-known/mcp.json`, { headers: this.headers });
if (!res.ok) throw new Error(`Manifest request failed: HTTP ${res.status}`);
this.manifest = (await res.json()) as McpManifest;
return this.manifest;
}
async listTools(): Promise<McpTool[]> {
return (await this.getManifest()).tools;
}
async callTool<T = unknown>(name: string, args: Record<string, unknown> = {}): Promise<T> {
const tool = (await this.listTools()).find((t) => t.name === name);
if (!tool) throw new Error(`Unknown tool: ${name}`);
let url = tool.endpoint.startsWith("http") ? tool.endpoint : `${this.baseUrl}${tool.endpoint}`;
const method = (tool.method ?? "POST").toUpperCase();
const init: RequestInit = { method, headers: { ...this.headers } };
if (method === "GET") {
const qs = new URLSearchParams(Object.entries(args).map(([k, v]) => [k, String(v)]));
const query = qs.toString();
if (query) url += (url.includes("?") ? "&" : "?") + query;
} else {
init.headers = { "Content-Type": "application/json", ...this.headers };
init.body = JSON.stringify(args);
}
const res = await fetch(url, init);
if (!res.ok) throw new Error(`Tool ${name} failed: HTTP ${res.status}`);
return (await res.json()) as T;
}
}
Related Generators tools
About MCP Client SDK Generator
Get a TypeScript, Python or Go client that reads your manifest and calls your tools.
How to use
- Fill in the form.
- Watch the preview update as you type.
- Copy the output or download the file.
Good to know
This tool runs in your browser. What you enter is not sent to our server.