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.
/plugin marketplace add jezweb/claude-skills/plugin install jezweb-tooling-skills@jezweb/claude-skillsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
README.mdtemplates/api/base.tstemplates/api/config.tstemplates/api/gemini.tstemplates/api/index.tstemplates/api/public/holidays.tstemplates/api/slack.tstemplates/api/webhook.tstemplates/api/workers-ai.tstemplates/client.tstemplates/config.tstemplates/db/client.tstemplates/db/config.tstemplates/db/index.tstemplates/db/types.tstemplates/errors.tstemplates/index.tsThis 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.
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:
cp -r ~/.claude/skills/ts-agent-sdk/templates/* ./scripts/sdk/
Scan the project for MCP server modules:
src/server/modules/mcp*/server.ts
Each server.ts file contains tool definitions using the pattern:
server.tool(
'tool_name',
'Tool description',
zodInputSchema,
async (params) => { ... }
)
For each tool, extract:
Convert Zod schemas to TypeScript interfaces:
// From: z.object({ name: z.string(), email: z.string().email() })
// To:
export interface CreateEnquiryInput {
name: string;
email: string;
}
Create a client class with methods for each tool:
// 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: ListDocumentsInput): Promise<ListDocumentsOutput> {
return this.mcp.callTool(ENDPOINT, 'list_documents', input);
}
// ... one method per tool
}
export const docs = new DocsClient();
Create runnable examples in scripts/sdk/examples/:
#!/usr/bin/env npx tsx
// scripts/sdk/examples/create-doc.ts
import { docs } from '../';
async function main() {
const result = await docs.createDocument({
spaceId: 'wiki',
title: 'Getting Started',
content: '# Welcome\n\nThis is the intro.',
});
console.log(`Created document: ${result.document.id}`);
}
main().catch(console.error);
Add module exports to scripts/sdk/index.ts:
export { docs } from './docs';
export { enquiries } from './enquiries';
project/
└── scripts/sdk/
├── index.ts # Main exports
├── config.ts # Environment config
├── errors.ts # Error classes
├── client.ts # MCP client
│
├── docs/ # Generated module
│ ├── types.ts # TypeScript interfaces
│ ├── client.ts # Typed methods
│ └── index.ts # Module exports
│
├── enquiries/ # Another module
│ ├── types.ts
│ ├── client.ts
│ └── index.ts
│
└── examples/ # Runnable scripts
├── create-doc.ts
├── list-spaces.ts
└── create-enquiry.ts
The SDK uses these environment variables:
| Variable | Description | Default |
|---|---|---|
SDK_MODE | Execution mode: 'local', 'remote', 'auto' | 'auto' |
SDK_BASE_URL | Target Worker URL | http://localhost:8787 |
SDK_API_TOKEN | Bearer token for auth | (none) |
Run generated scripts with:
SDK_API_TOKEN="your-token" SDK_BASE_URL="https://app.workers.dev" npx tsx scripts/sdk/examples/create-doc.ts
The SDK provides typed errors:
AuthError - 401, invalid tokenValidationError - Invalid inputNotFoundError - Resource not foundRateLimitError - 429, too many requestsMCPError - MCP protocol errorsNetworkError - Connection failuresWhen MCP tools change, regenerate the SDK:
src/server/modules/mcp*/server.tsThis skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.