SmartLead MCP TypeScript Standards

A set of TypeScript coding rules for the SmartLead MCP Server, a tool that connects AI agents to SmartLead. It covers type safety, input validation, error handling, asynchronous code, and documentation.

In plain words
What is it for?
Use it when adding or reviewing SmartLead MCP Server code, especially API tools, validated inputs, error handling, and public methods.
Why use it?
It helps keep changes consistent with the project's existing TypeScript standards and reduces common coding mistakes.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/leadmagic/smartlead-mcp-server/typescript-standards
Clone the repo
git clone --depth 1 https://github.com/LeadMagic/smartlead-mcp-server

Made for: Cursor.

Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,419 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00016 $0.02419
Opus 5 $0.00008 $0.01210
Sonnet 5 $0.00003 $0.00484
Haiku 4.5 $0.00002 $0.00242

Measured 2d ago against content hash 89c370c41b3d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

SmartLead MCP TypeScript Standards scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/typescript-standards.mdc · 381 lines

How it starts

The opening of the file, as written. The whole thing — 381 lines — stays where its author put it; the contents beside it link to each section on GitHub.

📝 SmartLead TypeScript Standards & Best Practices

Code Quality Guide: Master TypeScript patterns and standards used in the SmartLead MCP Server. Write clean, type-safe, maintainable code that follows our established conventions.

🎯 Quick Reference

🔥 Core Principles

  1. Strict Type Safety → No any types, use proper interfaces
  2. Zod Integration → All inputs validated with Zod schemas
  3. Error Handling → Use SmartLeadError for API errors
  4. Async Patterns → Consistent async/await usage
  5. Documentation → JSDoc for public APIs

⚡ Quick Checklist

  • No any types used
  • Zod schemas for validation
  • Proper error handling
  • JSDoc for public methods
  • Consistent naming conventions

SmartLead MCP Server - TypeScript Standards

🎯 TypeScript Configuration

Compiler Settings (tsconfig.json)

The project uses strict TypeScript configuration defined in tsconfig.json:

  • Target: ES2022 for modern JavaScript features
  • Module: ESNext with bundler resolution for optimal tree-shaking
  • Strict Mode: All strict options enabled for maximum type safety
  • JSX: React JSX for the installer components in src/installer.tsx

Key Compiler Options

{
  "strict": true,
  "noImplicitAny": true,
  "strictNullChecks": true,
  "noImplicitReturns": true,
  "noFallthroughCasesInSwitch": true,
  "noUncheckedIndexedAccess": true,
  "useUnknownInCatchVariables": true
}

📝 Type Definition Patterns

Global Types (src/types.ts)

All shared types and Zod schemas are defined in src/types.ts:

// Zod schema with TypeScript type inference
const CreateCampaignSchema = z.object({
  name: z.string(),
  from_email: z.string().email(),
  // ... other fields
});

// Inferred TypeScript type
type CreateCampaignRequest = z.infer<typeof CreateCampaignSchema>;

Module-Specific Types

Each module can define its own types when needed:

// In src/modules/campaigns/client.ts
interface CampaignResponse {
  id: number;
  name: string;
  status: 'active' | 'paused' | 'completed';
  created_at: string;
}

Read the full file on GitHub · 381 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 381 lines · 16 tokens per session scan A 89c370c41b3d

Subscribe to this mod's changes

SmartLead MCP TypeScript Standards is a cursor rule published in the GitHub repository LeadMagic/smartlead-mcp-server (21 stars, last pushed 1y ago), licensed MIT. It adds 16 tokens to every session and 2,419 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.