Skip to main content
Glama
jdenp

Instagram DM MCP Server

by jdenp

Instagram DM MCP Server

用于发送和阅读 Instagram 私信的 MCP(Model Context Protocol)服务器。

快速开始

uv run mcp_server.py

服务器通过 stdin/stdout 使用 JSON-RPC 2.0 进行通信。

Related MCP server: Instagram MCP Server

设置

  1. 将 config/config.json.template 复制为 config/config.json - 添加你的 sessionid、可选的 username 和 max_messages_per_thread。

  2. 将 config/recipients.json.template 复制为 config/recipients.json - 包含 Instagram 用户名及可选别名的列表。

  3. .json 文件已被 Git 忽略;.template 文件作为指南被跟踪。

工具

send_dm(recipient, message)

向指定收件人发送私信。

参数:

  • recipient(必填) - 接收私信的 Instagram 用户名

  • message(必填) - 要发送的消息文本

read_dm(recipient, max_messages=10)

读取指定收件人会话线程中的最近 N 条消息。

参数:

  • recipient(必填) - 要读取其私信的 Instagram 用户名

  • max_messages(可选) - 每个线程的最大消息数(如果省略,则使用配置中的 max_messages_per_thread)

list_recipients()

列出所有已配置的收件人及其别名。智能体应使用此工具来发现可以向谁发送消息。

参数: 无

配置

字段

默认值

描述

sessionid

(必填)

你的 Instagram 会话 ID

username

""

你的 Instagram 用户名(可选)

message_text

"test"

使用 send_dm 时发送的消息

max_messages_per_thread

10

每个线程最多读取的消息数

只能向 recipients.json 中的收件人发送消息。请勿直接修改脚本。

收件人别名

在 recipients.json 中,每个条目都可以包含一个供智能体使用的 alias 字段:

[
    {
        "username": "john_doe",
        "alias": "John Doe"
    }
]

别名是可选的 - 如果省略,则使用用户名。使用 list_recipients 工具查看所有已配置的别名。也支持纯字符串条目(向后兼容):

["john_doe", "jane_smith"]

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to read, send, and manage Instagram direct messages, including viewing conversations, sending DMs to users, reacting to messages, and searching for users by username.
    10
    -
  • F
    license
    A
    quality
    C
    maintenance
    Enables agents to interact with Instagram through 49 tools for direct messages, feed, profiles, search, and persona discovery, with write actions disabled by default until explicitly enabled.
    4
    49
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables reading and replying to direct messages, comments, and templates across Instagram, WhatsApp, and Messenger through official Meta Business APIs, with support for human handover and AI assistant controls.
    22 npm
    MIT