Skip to main content
Glama
piekstra

Slack MCP Server

by piekstra

invite_to_channel

Add users to a Slack channel by providing their IDs and the target channel ID for team collaboration.

Instructions

Invite users to a Slack channel.

Args: channel: Channel ID users: Comma-separated list of user IDs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYes
usersYes

Implementation Reference

  • MCP tool handler function that parses comma-separated users, creates SlackClient instance, calls the underlying invite_to_channel method, and returns JSON result or error.
    @mcp.tool()
    async def invite_to_channel(channel: str, users: str) -> str:
        """
        Invite users to a Slack channel.
    
        Args:
            channel: Channel ID
            users: Comma-separated list of user IDs
        """
        try:
            client = SlackClient()
            users_list = users.split(",")
            result = await client.invite_to_channel(channel, users_list)
            return json.dumps(result, indent=2)
        except Exception as e:
            return json.dumps({"error": str(e)}, indent=2)
  • Helper method in SlackClient class that makes the actual Slack API POST request to conversations.invite endpoint with channel and comma-joined user IDs.
    async def invite_to_channel(self, channel: str, users: List[str]) -> Dict[str, Any]:
        """Invite users to a channel."""
        data = {"channel": channel, "users": ",".join(users)}
        return await self._make_request("POST", "conversations.invite", json_data=data)
  • Registration of the invite_to_channel tool using the @mcp.tool() decorator.
    @mcp.tool()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/piekstra/slack-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server