Skip to main content

MCP server for sending messages to QQ groups via HTTP API

Project description

QQ MCP Server

PyPI version Python

通过 HTTP API 向 QQ 群发送消息的 MCP 服务端。基于 python-sdk 构建。

安装

pip install qq-mcp

配置

两种方式任选其一,优先级:环境变量 > config.json

方式一:config.json(推荐)

在当前工作目录创建 config.json

{
  "qq_api_url": "http://your-api:3000",
  "qq_token": "your-bearer-token",
  "qq_group_id": "123456789",
  "message_type": "text"
}

方式二:环境变量

export QQ_API_URL="http://your-api:3000"
export QQ_TOKEN="your-bearer-token"
export QQ_GROUP_ID="123456789"
export QQ_MESSAGE_TYPE="text"      # 可选,默认 text

使用

Claude Code

在项目根目录创建 .mcp.json

{
  "mcpServers": {
    "qq-mcp": {
      "command": "qq-mcp"
    }
  }
}

命令行

qq-mcp                        # stdio 模式(默认)
qq-mcp --transport sse        # SSE HTTP 模式
python -m qq_mcp              # 模块方式启动

手动调用

from qq_mcp import mcp

mcp.run()        # stdio
mcp.run("sse")   # SSE

工具

send_qq_message

向 QQ 群发送消息。

参数 类型 必填 说明
message str 消息内容
group_id str 覆盖默认群号
message_type str 覆盖消息类型
api_url str 覆盖 API 地址
token str 覆盖 Bearer token

示例:

send_qq_message(message="Hello, QQ!")
send_qq_message(message="Hi", group_id="987654321")

hello

返回问候语。

hello(name="world")    # → "Hello, world!"

add

两数相加。

add(a=1, b=2)          # → 3.0

API 规范

服务端对接的 QQ API 接口:

POST {qq_api_url}/send_msg
Content-Type: application/json
Authorization: Bearer {qq_token}

{
  "message_type": "text",
  "group_id": "123456789",
  "message": "消息内容"
}

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qq_mcp-0.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file qq_mcp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: qq_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for qq_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b6b1069f2a699a320ebbc8bb0f07e89e7e9899cd83f6e9210c5c62d22d788f3
MD5 b6974a3a4413ea7c7082b761c8659149
BLAKE2b-256 35265739753e6d0ec6807d6e48fadaedcc7cdc5e2e2c8b14bd23749ec3cd9e30

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page