General
ts-agent-sdk - Claude MCP Skill
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.
SEO Guide: Enhance your AI agent with the ts-agent-sdk tool. This Model Context Protocol (MCP) server allows Claude Desktop and other LLMs to generate typed typescript sdks for ai agents to interact with mcp servers. converts json-rpc curl co... Download and configure this skill to unlock new capabilities for your AI workflow.
Documentation
SKILL.md# 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: ListDocumentsInput): Promise<ListDocumentsOutput> {
return this.mcp.callTool(ENDPOINT, 'list_documents', input);
}
// ... one method per tool
}
export const docs = new DocsClient();
```
### Step 5: Generate Example Scripts
Create runnable examples in `scripts/sdk/examples/`:
```typescript
#!/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);
```
### Step 6: Update Index Exports
Add module exports to `scripts/sdk/index.ts`:
```typescript
export { docs } from './docs';
export { enquiries } from './enquiries';
```
## Output Structure
```
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
```
## Environment Variables
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) |
## Execution
Run generated scripts with:
```bash
SDK_API_TOKEN="your-token" SDK_BASE_URL="https://app.workers.dev" npx tsx scripts/sdk/examples/create-doc.ts
```
## Naming Conventions
- **Module names**: Lowercase, from MCP server name (e.g., 'mcp-docs' ā 'docs')
- **Method names**: camelCase from tool name (e.g., 'create_document' ā 'createDocument')
- **Type names**: PascalCase (e.g., 'CreateDocumentInput', 'CreateDocumentOutput')
## Error Handling
The SDK provides typed errors:
- `AuthError` - 401, invalid token
- `ValidationError` - Invalid input
- `NotFoundError` - Resource not found
- `RateLimitError` - 429, too many requests
- `MCPError` - MCP protocol errors
- `NetworkError` - Connection failures
## Regeneration
When MCP tools change, regenerate the SDK:
1. Re-scan `src/server/modules/mcp*/server.ts`
2. Update types.ts with new/changed schemas
3. Update client.ts with new/changed methods
4. Preserve any custom code in examples/Signals
Information
- Repository
- jezweb/claude-skills
- Author
- jezweb
- Last Sync
- 2/18/2026
- Repo Updated
- 2/17/2026
- Created
- 1/16/2026
Reviews (0)
No reviews yet. Be the first to review this skill!
Related Skills
cursorrules
CrewAI Development Rules
firecrawl-build-onboarding
Get Firecrawl credentials and SDK setup into a project. Use when an application needs `FIRECRAWL_API_KEY`, when an agent should add Firecrawl to `.env`, when the user wants to authenticate Firecrawl for app code, or when choosing the first SDK and docs for a new Firecrawl integration. This skill includes its own browser auth flow, so it does not depend on the website onboarding skill.
firecrawl-build-scrape
Integrate Firecrawl `/scrape` into product code for single-page extraction. Use when an app already has a URL and needs markdown, HTML, links, screenshots, metadata, or structured page output. Prefer this skill over broader crawl patterns when the feature is page-level.
firecrawl-build-search
Integrate Firecrawl `/search` into product code and agent workflows. Use when an app needs discovery before extraction, when the feature starts with a query instead of a URL, or when the system should search the web and optionally hydrate result content.
Related Guides
Bear Notes Claude Skill: Your AI-Powered Note-Taking Assistant
Learn how to use the bear-notes Claude skill. Complete guide with installation instructions and examples.
OpenAI Whisper API Claude Skill: Complete Guide to AI-Powered Audio Transcription
Learn how to use the openai-whisper-api Claude skill. Complete guide with installation instructions and examples.
Mastering the Oracle CLI: A Complete Guide to the Claude Skill for Database Professionals
Learn how to use the oracle Claude skill. Complete guide with installation instructions and examples.