Slack logo

Slack

Interact with Slack workspaces to send messages, manage channels, handle files, and automate workspace operations using natural language.

How to Use Model Context Protocol (MCP) in Cursor

What is MCP?

Model Context Protocol (MCP) is an open protocol that allows you to provide custom tools to agentic LLMs (Large Language Models) in Cursor's Composer feature.

Installation Steps

  1. Open Cursor Settings
    • Navigate to Cursor Settings > Features > MCP
    • Click the "+ Add New MCP Server" button
  2. Configure the Server
    • Name: Give your server a nickname
    • Type: Select the transport type (stdio or sse)
    • Command/URL: Enter either:
      • For SSE servers: The URL of the SSE endpoint
      • For stdio servers: A valid shell command to run the server

Example Configurations

For stdio Server (Slack Example):

Command: node ~/mcp-quickstart/slack-server/build/index.js --bot-token $SLACK_BOT_TOKEN --app-token $SLACK_APP_TOKEN --signing-secret $SLACK_SIGNING_SECRET

For SSE Server:

URL: https://slack.com/api/apps.connections.open

Using MCP Tools

Tool Availability

  • • After adding a server, it will appear in your MCP servers list
  • • You may need to click the refresh button to populate the tool list

Using Tools in Composer

  • • The Composer Agent automatically uses MCP tools when relevant
  • • You can explicitly prompt tool usage by:
    • Referring to the tool by name
    • Describing the tool's function

Tool Execution Process

  • • Displays a message in chat requesting approval
  • • Shows tool call arguments (expandable)
  • • Executes the tool upon user approval
  • • Displays the tool's response in the chat

Important Notes

  • • MCP tools may not work with all models
  • • MCP tools are only available to the Agent in Composer
  • • For Slack integration, you need to set up SLACK_BOT_TOKEN, SLACK_APP_TOKEN, and SLACK_SIGNING_SECRET environment variables
  • • Create a Slack App in your workspace through the Slack API dashboard
  • • Install the app to your workspace and get the Bot User OAuth Token
  • • Generate an App-Level Token with connections:write scope
  • • Get your Signing Secret from the App Credentials page
  • • For security, use a wrapper script that sets the environment variables before running the server
  • • Configure appropriate OAuth scopes based on your app's needs
  • • Be mindful of Slack's API rate limits and tier restrictions
  • • Consider implementing retry logic for failed API requests
  • • Use appropriate error handling for various Slack API responses