A2E AI 虚拟人 MCP Server 介绍:为 Vibe Coding 接入 AI 虚拟人能力
A2E 是 AI 驱动虚拟人生成领域的先行者。现在,我们推出全新的 AI 虚拟人 MCP Server,为开发者工具带来一次重要升级:AI 编程助手可以深入理解 API,从而自动生成复杂 AI 虚拟人系统所需的代码。

A2E 是 AI 驱动虚拟人生成领域的先行者。全新的 Model Context Protocol(MCP)Server 将改变开发者工具的使用方式,让 AI 编程助手通过深入理解 API,自动生成复杂 AI 虚拟人系统代码。
我们的 AI 虚拟人 MCP Server 由 apidog 提供支持,在以下三者之间建立动态桥梁:
- AI 编程工具 (由大语言模型驱动的 IDE)
- A2E 虚拟人生成 API 生态
- 项目自身的实现需求
这条智能通道让自动化代码生成既能利用平台能力,也能遵循项目约束。
在你的工作流中启用 MCP Server

准备条件
Node.js (18 或更高版本,建议使用最新 LTS 版本)。同时需要一个支持 MCP 的 IDE,例如:Cursor,或 VS Code + Cline 插件
配置 IDE
复制下面的 JSON 配置,并添加到你的 IDE 的 MCP 配置文件中:
{
"mcpServers": {
"A2E - API Specification": {
"command": "npx",
"args": [
"-y",
"apidog-mcp-server@latest",
"--site-id=746061"
]
}
}
}
如果你使用的是 Windows ,且上面的配置无法生效,可以改用下面这份配置:
{
"mcpServers": {
"A2E - API Specification": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"apidog-mcp-server@latest",
"--site-id=746061"
]
}
}
}
Cursor 示例
按照上一节的步骤,在 Cursor 中启用 A2E MCP Server。然后新建一个空的 Python 文件,向 Cursor 发送请求:“编写一段示例代码,列出 A2E 的所有虚拟人,并生成一个随机公众人物的视频”。下面是 AI 在 5 秒内写出的代码:
import os
import random
import requests
def list_a2e_avatars():
"""
Function to list all available avatars from A2E API
Returns a list of avatar information
"""
try:
# Make API request to get avatars
response = requests.get("https://video.a2e.ai/devv1/avatars")
response.raise_for_status()
# Parse JSON response
avatars = response.json()
print(f"Found {len(avatars)} avatars:")
for i, avatar in enumerate(avatars):
print(f"{i+1}. {avatar['name']} (ID: {avatar['id']})")
return avatars
except Exception as e:
print(f"Error fetching avatars: {str(e)}")
return []
def generate_public_figure_video(prompt=None, output_path="./generated_video.mp4"):
"""
Generate a video of a random public figure using A2E API
Args:
prompt (str, optional): Custom prompt. If None, a default will be used
output_path (str): Path to save the generated video
Returns:
str: Path to the generated video file
"""
# List of public figures to choose from
public_figures = [
"Elon Musk", "Barack Obama", "Taylor Swift", "Leonardo DiCaprio",
"Oprah Winfrey", "Bill Gates", "Beyoncé", "Tom Hanks"
]
# Select a random public figure
figure = random.choice(public_figures)
# Default prompt if none provided
if prompt is None:
prompt = f"{figure} giving a short speech about artificial intelligence"
print(f"Generating video for: {prompt}")
try:
# Get available avatars
avatars = list_a2e_avatars()
if not avatars:
raise Exception("No avatars available")
# Select a random avatar
avatar = random.choice(avatars)
avatar_id = avatar['id']
print(f"Using avatar: {avatar['name']} (ID: {avatar_id})")
# API request to generate video
api_key = os.environ.get("A2E_API_KEY")
if not api_key:
raise Exception("A2E_API_KEY environment variable not set")
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
payload = {
"avatar_id": avatar_id,
"prompt": prompt,
"settings": {
"quality": "high",
"duration": 15 # seconds
}
}
# Make API request
response = requests.post(
"https://video.a2e.ai/devv1/generate",
headers=headers,
json=payload
)
response.raise_for_status()
# Get generation ID from response
generation_id = response.json().get("generation_id")
if not generation_id:
raise Exception("No generation ID returned")
print(f"Generation started with ID: {generation_id}")
# Poll for completion
status = "pending"
while status in ["pending", "processing"]:
status_response = requests.get(
f"https://video.a2e.ai/devv1/generations/{generation_id}",
headers=headers
)
status_response.raise_for_status()
status_data = status_response.json()
status = status_data.get("status")
print(f"Generation status: {status}")
if status == "completed":
video_url = status_data.get("video_url")
if not video_url:
raise Exception("No video URL in completed response")
# Download the video
video_response = requests.get(video_url)
video_response.raise_for_status()
with open(output_path, "wb") as f:
f.write(video_response.content)
print(f"视频 saved to: {output_path}")
return output_path
elif status == "failed":
raise Exception(f"Generation failed: {status_data.get('error')}")
# Wait before polling again
import time
time.sleep(5)
except Exception as e:
print(f"Error generating video: {str(e)}")
return None
# Example usage
if __name__ == "__main__":
# List all available avatars
avatars = list_a2e_avatars()
# Generate a video with a random public figure
video_path = generate_public_figure_video(
prompt="A public figure discussing the future of AI technology",
output_path="./public_figure_video.mp4"
)
if video_path:
print(f"Successfully generated video at: {video_path}")
else:
print("Failed to generate video")
A2E 的最新创新为 AI 驱动开发开启了新篇章。无论你是在创建复杂的数字虚拟人,还是在优化自己的编码工作流,这款强大的工具都能让流程更快、更聪明,也更直观。现在就试试看,感受它如何改变你的下一个项目。



