一组适用于 Atlantis MCP 服务器 的生产就绪示例函数。这些示例帮助 AI 编码代理了解可能的功能,并展示在 Atlantis 系统中构建动态函数的最佳实践。
此仓库作为开发者使用 Atlantis MCP 构建应用程序的学习资源和模板库。每个示例都是完全可运行的,并展示了实际应用场景,包括:
dynamic_functions 目录:cd /path/to/atlantis-mcp-server/python-server/dynamic_functions
git clone https://github.com/ProjectAtlantis-dev/atlantis-mcp-function-examples.git
atlantis-mcp-server/
└── python-server/
└── dynamic_functions/
└── atlantis-mcp-function-examples/
├── marketing/
├── comfyui_stuff/
└── bug_reports/
# 对于营销示例
export GEMINI_API_KEY="your-gemini-api-key"
# 添加其他特定示例所需的 API 密钥
/marketing)完整的 AI 助力内容生成社交媒体管理系统:
关键函数:
create_brand() - 设置新的品牌资料generate_social_post() - AI 生成的平台优化内容post_to_twitter(), post_to_linkedin(), post_to_facebook() - 发布内容save_linkedin_token(), save_facebook_token() - OAuth 集成/comfyui_stuff)使用 ComfyUI 工作流程进行高级 AI 媒体生成:
关键函数:
create_video_with_image() - 从图像生成文本到动画create_audio_with_voice() - 克隆声音并生成语音upscale_image_default() - 高质量图像放大qwen_image_edit() - AI 助力的图像编辑需求: 在 0.0.0.0:8188 上运行的 ComfyUI 服务器,且已安装所需模型
/bug_reports)具有 AI 辅助解决方案的智能错误跟踪系统:
关键函数:
create_bug_report() - 提交带有自动分类的新错误list_bugs() - 查看并筛选错误数据库update_bug_status() - 管理错误生命周期get_bug_details() - 深入具体问题研究代码以理解:
@visible 装饰器结构 Atlantis 函数复制并修改示例以适应您自己的用例:
@visible
async def your_custom_function(param1: str, param2: int = 10):
"""
您的函数描述
参数:
param1: 描述
param2: 默认值描述
"""
username = atlantis.get_caller() or "unknown_user"
await atlantis.client_log(f"开始处理 {username}...")
# 您的逻辑
await atlantis.client_log("✅ 完成!")
混合搭配组件:
# 向用户的界面记录日志
await atlantis.client_log("用户消息")
await atlantis.owner_log("服务器端日志")
# 在用户的界面渲染 HTML/CSS
await atlantis.client_html("<div>自定义 UI</div>")
await atlantis.client_script("// JavaScript 代码")
# 文件上传
await atlantis.client_upload(upload_id, callback_function)
# 获取当前用户
username = atlantis.get_caller()
uploadId = f"upload_{str(uuid.uuid4()).replace('-', '')[:8]}"
async def process_file(filename, filetype, base64Content):
# 解码并处理文件
base64_data = base64Content.split(',')[1] if base64Content.startswith('data:') else base64Content
file_bytes = base64.b64decode(base64_data)
# ... 处理文件
await atlantis.client_upload(uploadId, process_file)
# 包含占位符的 HTML
html_template = '''
<div id="my_component_{UPLOAD_ID}">
<!-- 您的 HTML -->
</div>
'''
# 包含事件处理器的 JavaScript
js_template = '''
document.getElementById('button_{UPLOAD_ID}').addEventListener('click', async function() {
await studioClient.sendRequest("engage", {
accessToken: "{UPLOAD_ID}",
mode: "action",
data: { /* 您的数据 */ }
});
});
'''
# 替换占位符并注入
await atlantis.client_html(html_template.replace("{UPLOAD_ID}", uploadId))
await atlantis.client_script(js_template.replace("{UPLOAD_ID}", uploadId))
这些示例特别设计来帮助 AI 编码代理(如 Claude、GPT-4 等)理解:
当与 AI 代理合作时,您可以参考这些示例:
"创建一个类似于
create_audio_with_voice()的函数,但用于文本转语音而不是声音克隆"
"使用
qwen_image_edit()中的文件上传模式,但修改它以接受 PDF 文件"
dynamic_functions/ 中创建一个新目录@visible 装饰器的 Python 文件我们欢迎贡献!要添加您自己的示例:
本项目根据 MIT 许可证授权 - 详情见 LICENSE 文件。
简而言之:您可以自由使用、修改、分发,甚至商业使用。只需保留版权声明。
由 ❤️ 为 Atlantis MCP 社区制作