关于 tinysend
tinysend 是 tinysend API 的官方 TypeScript SDK,适用于需要处理邮件和新闻简报数据的应用与 Agent。它基于 fetch、无依赖,并覆盖完整 API。
主要功能
- 01管理邮件列表
- 02创建和读取列表
- 03通过 fetch 调用 API
- 04零运行时依赖
- 05支持自定义基础 URL 和 fetch
适用场景
- 01在 TypeScript 代码中调用 tinysend API
- 02通过 SDK 管理列表
- 03配置自定义 fetch 实现
配置
远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。
服务地址
https://mcp.tinysend.com一键复制安装命令
Claude CodeTerminal
claude mcp add --transport http tinysend-node https://mcp.tinysend.comCursor.cursor/mcp.json
{"mcpServers":{"tinysend-node":{"type":"http","url":"https://mcp.tinysend.com"}}}在 Cursor 中打开VS Code.vscode/mcp.json
{"servers":{"tinysend-node":{"type":"http","url":"https://mcp.tinysend.com"}}}在 VS Code 中打开Claude Desktopclaude_desktop_config.json
{"mcpServers":{"tinysend-node":{"type":"http","url":"https://mcp.tinysend.com"}}}Windsurf~/.codeium/windsurf/mcp_config.json
{"mcpServers":{"tinysend-node":{"serverUrl":"https://mcp.tinysend.com"}}}命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。
工具
详细介绍
tinysend
适用于 tinysend API 的官方 TypeScript SDK。零依赖,基于 fetch — 可在 Node.js、Bun、Deno、Cloudflare Workers 和浏览器中使用。
- 网站:tinysend.com
- 文档:tinysend.com/docs
- Agents:tinysend.com/agents
安装
npm install tinysend
获取令牌
每次调用都需要一个 bearer 令牌(sk_...)。
- 人类用户:在 tinysend.com 的账户设置中创建
- Agents:自行注册 — 无需人类介入。协议见 tinysend.com/auth.md(向 id.tinysend.com/agent/auth 发送 POST),操作指南见 tinysend.com/agents/agent-auth
用法
import { Tinysend } from 'tinysend';
const ts = new Tinysend('sk_...');
// lists
const lists = await ts.lists.list();
const list = await ts.lists.create({ name: 'Weekly Update' });
// subscribers
await ts.subscribers.create(list.id, { email: '[email protected]', verified: true });
// send an email
const post = await ts.posts.create(list.id, {
subject: 'Hello World',
body_html: '<p>Welcome to our newsletter!</p>',
});
await ts.posts.send(list.id, post.id);
// contacts
const contacts = await ts.contacts.list({ search: 'john' });
// mailboxes
const mailboxes = await ts.mailboxes.list();
// stats
const stats = await ts.stats.project();
// webhooks
const hook = await ts.webhooks.create({
url: 'https://example.com/webhook',
events: ['post.sent', 'subscriber.created'],
});
// sender domain (who emails come from)
await ts.sender.set(list.id, { type: 'custom_domain', name: 'James', email: 'james', domain: 'acme.com' });
await ts.sender.check(list.id); // re-check DNS
// custom domain for the archive site
await ts.siteDomains.set(list.id, { domain: 'news.acme.com' });
// waitlists
await ts.lists.join(list.id, { email: '[email protected]' });
await ts.lists.invite(list.id, { count: 100 });
// automations, invites, usage, settings
const automations = await ts.automations.list();
const invites = await ts.invites.list();
const usage = await ts.usage.get();
此 SDK 涵盖完整的 API 功能 — 每次发布时都会根据实时的 openapi 规范进行验证。
错误处理
import { Tinysend, TinysendError } from 'tinysend';
try {
await ts.lists.get('nonexistent');
} catch (err) {
if (err instanceof TinysendError) {
console.log(err.status); // 404
console.log(err.code); // 'not_found'
console.log(err.message); // 'list not found'
}
}
配置
const ts = new Tinysend('sk_...', {
baseUrl: 'https://api.tinysend.com/v1', // default
fetch: customFetch, // custom fetch implementation
});
许可证
MIT
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。