Generate typed TypeScript SDKs for AI agents to interact with MCP servers. Converts JSON-RPC curl commands to clean function calls. Auto-generates types, client methods, and example scripts from MCP tool definitions. Use when building MCP-enabled applications, need typed programmatic access to MCP tools, or creating reusable agent automation scripts.
View on GitHubSelect agents to install to:
npx add-skill https://github.com/jezweb/claude-skills/blob/main/skills/ts-agent-sdk/SKILL.md -a claude-code --skill ts-agent-sdkInstallation paths:
.claude/skills/ts-agent-sdk/# ts-agent-sdk
## Overview
This skill generates typed TypeScript SDKs that allow AI agents (primarily Claude Code) to interact with web applications via MCP servers. It replaces verbose JSON-RPC curl commands with clean function calls.
## Template Location
The core SDK template files are bundled with this skill at:
`templates/`
Copy these files to the target project's `scripts/sdk/` directory as a starting point:
```bash
cp -r ~/.claude/skills/ts-agent-sdk/templates/* ./scripts/sdk/
```
## SDK Generation Workflow
### Step 1: Detect MCP Servers
Scan the project for MCP server modules:
```
src/server/modules/mcp*/server.ts
```
Each server.ts file contains tool definitions using the pattern:
```typescript
server.tool(
'tool_name',
'Tool description',
zodInputSchema,
async (params) => { ... }
)
```
### Step 2: Extract Tool Definitions
For each tool, extract:
1. **name**: The tool identifier (e.g., 'create_document')
2. **description**: Tool description for JSDoc
3. **inputSchema**: Zod schema defining input parameters
4. **endpoint**: The MCP endpoint path (e.g., '/api/mcp-docs/message')
### Step 3: Generate TypeScript Interfaces
Convert Zod schemas to TypeScript interfaces:
```typescript
// From: z.object({ name: z.string(), email: z.string().email() })
// To:
export interface CreateEnquiryInput {
name: string;
email: string;
}
```
### Step 4: Generate Module Client
Create a client class with methods for each tool:
```typescript
// scripts/sdk/docs/client.ts
import { MCPClient, defaultClient } from '../client';
import type { CreateDocumentInput, CreateDocumentOutput } from './types';
const ENDPOINT = '/api/mcp-docs/message';
export class DocsClient {
private mcp: MCPClient;
constructor(client?: MCPClient) {
this.mcp = client || defaultClient;
}
async createDocument(input: CreateDocumentInput): Promise<CreateDocumentOutput> {
return this.mcp.callTool(ENDPOINT, 'create_document', input);
}
async listDocuments(input: