这是一个全面的 TypeScript 实现,集成了 Buttondown 时事通讯服务。它提供命令行界面 (CLI) 和模型上下文协议 (MCP) 服务器,可用于管理时事通讯、草稿和分析,为用户带来便捷的时事通讯管理体验。
你可以根据自己的需求选择以下任意一种方式进行安装:
# 使用 pnpm(推荐)
pnpm install
# 或使用 npm
npm install
# 或使用 yarn
yarn install
API 密钥可以通过以下两种方式提供:
export BUTTONDOWN_API_KEY=your_api_key
op://Development/Buttondown API/notesPlain。# 列出所有时事通讯
buttondown emails list
# 创建新草稿
buttondown emails draft new
# 发送测试电子邮件
buttonton emails send --test
# 获取帮助信息
buttondown help
MCP 服务器是一个用于与 AI 模型交互的接口,支持以下操作:
curl -X GET "http://localhost:1234/api/v1/context"
curl -X POST "http://localhost:1234/api/v1/context" \
-H "Content-Type: application/json" \
-d '{"context": {"key": "value"}}'
import { Buttondown } from '@buttondown/buttondown-api';
const buttondown = new Buttondown({
apiKey: 'your_api_key',
});
// 创建新草稿
async function createDraft() {
try {
const response = await buttondown.drafts.create();
console.log('草稿已创建:', response);
} catch (error) {
console.error('错误:', error);
}
}
# 安装依赖项
npm install
# 启动开发服务器
npm run dev
# 运行测试
npm test
src/:包含主要的源代码文件。public/:包含构建后的静态资源文件。node_modules/:自动安装的依赖项。package.json:项目的依赖管理和运行脚本。.env:环境变量配置文件。git clone https://github.com/yourusername/buttondown-api.git
cd buttondown-api
git checkout -b feature/new-feature
git add .
git commit -m "添加新功能"
git push origin feature/new-feature
本项目受 MIT 许可证约束。请参阅 LICENSE 了解详细信息。