TeamSpeak MCP 是一个基于模型上下文协议(MCP)的服务器,可让 Claude 等 AI 模型控制 TeamSpeak 服务器,实现诸如消息发送、用户管理、频道管理等功能。
python install.py
python test_mcp.py
# 构建镜像
docker build -t teamspeak-mcp .
# 使用 Docker 进行测试
docker run --rm -it \
-e TEAMSPEAK_HOST=your-server.com \
-e TEAMSPEAK_USER=your-user \
-e TEAMSPEAK_PASSWORD=your-password \
teamspeak-mcp test
TeamSpeak MCP 提供多种集成方法,以满足不同的设置和偏好:
# 安装
uvx install teamspeak-mcp
# 使用
uvx teamspeak-mcp --host your-server.com --user your-user --password your-password
# Claude Desktop 配置(CLI 参数)
{
"mcpServers": {
"teamspeak": {
"command": "uvx",
"args": ["teamspeak-mcp", "--host", "your-server.com", "--user", "your-user", "--password", "your-password"]
}
}
}
💡 注意:我们在参数中使用
-e标志,而不是"env": {}字段,因为 Claude Desktop 的环境变量处理可能不可靠。参数方法可确保变量传递的一致性。
# 安装
docker pull ghcr.io/marlburrow/teamspeak-mcp:latest
# Claude Desktop 配置(参数中的环境变量)
{
"mcpServers": {
"teamspeak": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "TEAMSPEAK_HOST=your-server.com",
"-e", "TEAMSPEAK_USER=your-user",
"-e", "TEAMSPEAK_PASSWORD=your-password",
"ghcr.io/marlburrow/teamspeak-mcp:latest"
]
}
}
}
# 安装
git clone https://github.com/MarlBurroW/teamspeak-mcp.git
cd teamspeak-mcp && pip install -r requirements.txt
# Claude Desktop 配置(Python 模块)
{
"mcpServers": {
"teamspeak": {
"command": "python",
"args": ["-m", "teamspeak_mcp.server", "--host", "your-server.com", "--user", "your-user", "--password", "your-password"]
}
}
}
# 安装
git clone https://github.com/MarlBurroW/teamspeak-mcp.git
cd teamspeak-mcp && docker build -t teamspeak-mcp .
# Claude Desktop 配置(本地镜像)
{
"mcpServers": {
"teamspeak": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "TEAMSPEAK_HOST=your-server.com",
"-e", "TEAMSPEAK_USER=your-user",
"-e", "TEAMSPEAK_PASSWORD=your-password",
"teamspeak-mcp"
]
}
}
}
| 使用场景 | 推荐方法 | 原因 |
|---|---|---|
| 首次使用 | PyPI 包 (uvx) |
设置简单,采用标准 MCP 模式 |
| 生产部署 | 预构建的 Docker 镜像 | 可靠、有版本控制、无依赖项 |
| CI/CD 环境 | 预构建的 Docker 镜像 | 部署一致、快速 |
| 开发/贡献代码 | 本地 Python 安装 | 可完全访问源代码 |
| 自定义修改 | 本地 Docker 构建 | 可控制构建过程 |
| 企业环境 | 本地 Docker 构建 | 无需外部依赖 |
最快方式(PyPI):
uvx install teamspeak-mcp
# 使用 CLI 参数添加到 Claude Desktop 配置中
最可靠方式(Docker):
docker pull ghcr.io/marlburrow/teamspeak-mcp:latest
# 使用参数中的环境变量添加到 Claude Desktop 配置中
最灵活方式(本地):
git clone https://github.com/MarlBurroW/teamspeak-mcp.git
cd teamspeak-mcp && pip install -r requirements.txt
# 使用 Python 模块添加到 Claude Desktop 配置中
使用 Claude 控制 TeamSpeak MCP 的基本命令如下:
# 连接到 TeamSpeak 服务器
"Connect to TeamSpeak server"
# 向通用频道发送消息
"Send message 'Hello everyone!' to general channel"
# 向用户 5 发送私人消息
"Send private message 'Can you join me?' to user 5"
# 向用户 12 发送戳消息
"Poke user 12 with message 'Urgent: Please check the announcement!'"
# 列出已连接的用户
"List connected users"
# 创建名为 'Meeting' 的临时频道
"Create temporary channel called 'Meeting'"
# 将用户 John 移动到私人频道
"Move user John to private channel"
# 显示服务器信息
"Show me server info"
使用 Claude 控制 TeamSpeak MCP 的高级命令如下:
# 将频道 5 设置为静音,禁止任何人发言
"Make channel 5 silent so nobody can talk"
# 设置一个受管理的欢迎频道
"Set up a moderated welcome channel"
# 更新频道 3,将最大客户端数设置为 10 并添加密码 'secret'
"Update channel 3 to set max clients to 10 and add password 'secret'"
# 显示频道 7 的详细信息
"Show me detailed information about channel 7"
# 获取客户端 12 的全面详细信息
"Get comprehensive details about client 12"
# 列出频道 4 的所有权限
"List all permissions for channel 4"
# 为频道 6 添加发言权限
"Add talk power permission to channel 6"
# 将服务器名称更改为 'My Gaming Server' 并将最大客户端数设置为 100
"Change server name to 'My Gaming Server' and set max clients to 100"
# 设置欢迎消息为 'Welcome to our server!'
"Set welcome message to 'Welcome to our server!'"
# 将用户 15 添加到管理员组 6
"Add user 15 to admin group 6"
# 将用户 8 从管理员组中移除
"Remove user 8 from moderator group"
# 显示用户 12 的所有服务器组
"Show all server groups for user 12"
# 为用户 20 授予 'b_client_kick' 权限,值为 75
"Give user 20 the 'b_client_kick' permission with value 75"
# 诊断当前权限和连接情况
"Diagnose my current permissions and connection"
# 检查无法列出客户端的原因
"Check why I can't list clients"
在使用 TeamSpeak MCP 之前,需要配置 TeamSpeak 服务器的凭据:
| 参数 | 描述 | 示例 |
|---|---|---|
| TEAMSPEAK_HOST | 服务器 IP 或域名 | ts.example.com 或 192.168.1.100 |
| TEAMSPEAK_PORT | ServerQuery 端口(默认:10011) | 10011 |
| TEAMSPEAK_USER | ServerQuery 用户名 | mcp_user |
| TEAMSPEAK_PASSWORD | ServerQuery 密码 | secure_password123 |
| TEAMSPEAK_SERVER_ID | 虚拟服务器 ID(通常为 1) | 1 |
在 TeamSpeak 服务器上,确保 ServerQuery 已启用:
ts3server.ini:query_port=10011token=AAAA...连接到 ServerQuery 并创建一个专用用户:
# 通过 telnet 或 putty 连接到 your-server:10011
telnet your-server.example.com 10011
# 使用管理员登录
login serveradmin YOUR_ADMIN_PASSWORD
# 为 MCP 创建专用用户
serverqueryadd client_login_name=mcp_user client_login_password=secure_password123
# 授予必要的权限(可选 - 根据需要调整)
servergroupaddclient sgid=6 cldbid=USER_DB_ID
# 使用我们的连接脚本进行测试
python test_mcp.py
# 或者使用 Docker 进行测试
docker run --rm -it \
-e TEAMSPEAK_HOST=your-server.example.com \
-e TEAMSPEAK_USER=mcp_user \
-e TEAMSPEAK_PASSWORD=secure_password123 \
ghcr.io/marlburrow/teamspeak-mcp:latest test
对于 PyPI 安装:
{
"mcpServers": {
"teamspeak": {
"command": "uvx",
"args": ["teamspeak-mcp", "--host", "your-server.example.com", "--user", "mcp_user", "--password", "secure_password123"]
}
}
}
对于 Docker 安装:
{
"mcpServers": {
"teamspeak": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "TEAMSPEAK_HOST=your-server.example.com",
"-e", "TEAMSPEAK_USER=mcp_user",
"-e", "TEAMSPEAK_PASSWORD=secure_password123",
"ghcr.io/marlburrow/teamspeak-mcp:latest"
]
}
}
}
⚠️ 重要提示
创建一个具有最小权限的专用 ServerQuery 用户。切勿将管理员账户用于自动化工具。
connect_to_server : 连接到 TeamSpeak 服务器send_channel_message : 向频道发送消息send_private_message : 发送私人消息poke_client : 向用户发送戳(提醒通知) - 比私人消息更引人注意list_clients : 列出已连接的客户端list_channels : 列出频道create_channel : 创建新频道delete_channel : 删除频道move_client : 将客户端移动到另一个频道kick_client : 踢出客户端ban_client : 封禁客户端server_info : 获取服务器信息update_channel : 更新频道属性(名称、描述、密码、发言权限、限制等)set_channel_talk_power : 使用预设快速设置 AFK/静音/受管理的频道channel_info : 获取详细的频道信息(权限、编解码器、类型等)manage_channel_permissions : 细粒度的权限控制(添加/删除/列出)client_info_detailed : 全面的客户端详细信息(平台、版本、状态等)update_server_settings : 更新虚拟服务器设置(名称、欢迎消息、最大客户端数、密码、主机消息、默认组)manage_user_permissions : 完整的用户权限管理(添加/删除服务器组、设置个人权限、列出分配情况)diagnose_permissions : 诊断当前连接权限并解决问题list_server_groups : 列出所有可用的服务器组assign_client_to_group : 将客户端添加或移除服务器组create_server_group : 创建具有自定义设置的新服务器组manage_server_group_permissions : 管理服务器组的权限list_bans : 列出服务器上所有活动的封禁规则manage_ban_rules : 创建、删除或管理封禁规则(基于 IP、名称、UID)list_complaints : 列出对用户的投诉search_clients : 按名称模式或唯一标识符搜索客户端find_channels : 按名称模式搜索频道list_privilege_tokens : 列出所有可用的特权密钥/令牌create_privilege_token : 创建用于服务器/频道访问的新特权令牌list_files : 列出频道文件存储库中的文件get_file_info : 获取特定文件的详细信息manage_file_permissions : 列出和管理活动的文件传输view_server_logs : 查看服务器日志的最近条目add_log_entry : 向服务器日志添加自定义条目get_connection_info : 获取详细的连接信息create_server_snapshot : 创建服务器配置的快照deploy_server_snapshot : 从快照部署/恢复服务器配置# 安装开发依赖项
pip install -r requirements.txt
# 运行测试
python test_mcp.py
# 启动 MCP 服务器
python -m teamspeak_mcp.server
# 构建
docker build -t teamspeak-mcp .
# 测试
docker run --rm -it teamspeak-mcp
本项目通过 GitHub Actions 实现了 完全自动化的发布,无需手动上传到 PyPI!
一键发布:
# 补丁发布 (1.0.3 -> 1.0.4)
make release-patch
# 小版本发布 (1.0.3 -> 1.1.0)
make release-minor
# 大版本发布 (1.0.3 -> 2.0.0)
make release-major
自动流程:
pyproject.toml 中的版本号一次性设置:
# 显示设置说明
make setup-pypi
uvx install teamspeak-mcp 可获取新版本ghcr.io/marlburrow/teamspeak-mcp:v1.0.4 可用本项目使用自动化的 GitHub Actions 来构建和发布 Docker 镜像:
make release-patch(或 release-minor/release-major)"连接被拒绝"
"身份验证失败"
"未找到虚拟服务器"
serverlist 检查虚拟服务器 ID"Python 版本错误"
"Docker 环境变量不起作用"
-e 标志,而不是 "env": {} 字段,以获得更好的兼容性# 使用 Docker
docker logs container-name
# 不使用 Docker
python -m teamspeak_mcp.server --verbose
MIT