MI

Microsoft Teams MCP Server Messaging Integration

Integrate Microsoft Teams messaging with an MCP server to read, post, mention users, and list members and threads for streamlined collaboration.

Quick Install
npx -y @InditexTech/mcp-teams-server

Overview

This MCP (Model Context Protocol) server connects Microsoft Teams messaging to an MCP-enabled model environment. It exposes a small set of HTTP endpoints (tools) that allow models or other automation to read channels and threads, post messages, mention users, and enumerate members and threads in a Team or channel. By wrapping Microsoft Graph operations in a standardized MCP tool interface, the server makes Teams functionality available to LLMs and orchestration systems that speak the MCP format.

Typical uses include system agents that need to surface or record Teams conversations, automated assistants that post summary messages or mention people, and integrations that sync or analyze Teams threads. The server handles authentication to Microsoft Graph and exposes lightweight, documented endpoints that map to common collaboration operations.

Features

  • Read messages from a channel or thread
  • Post messages to channels and threads
  • Mention users in messages (Graph-compatible mention payloads)
  • List channel or team members
  • Enumerate threads/conversations within a channel
  • Simple HTTP/MCP tool API for easy model integration
  • Configurable via environment variables or Docker

Installation / Configuration

Clone the repository and run with Node or Docker. The service needs Azure AD app credentials with Microsoft Graph permissions (for example, Chat.ReadWrite, ChannelMessage.Read.All, Group.Read.All) and an MCP API key if you want to restrict access.

Clone and run locally:

git clone https://github.com/InditexTech/mcp-teams-server.git
cd mcp-teams-server
npm install
# set env vars (example below), then:
npm start

Docker:

docker build -t mcp-teams-server .
docker run -p 3000:3000 --env-file .env mcp-teams-server

Example .env:

PORT=3000
AZURE_TENANT_ID=<your-tenant-id>
AZURE_CLIENT_ID=<your-client-id>
AZURE_CLIENT_SECRET=<your-client-secret>
MCP_API_KEY=<optional-api-key-to-restrict-access>

Notes:

  • Create an Azure AD app and grant delegated or application Graph permissions suitable for the actions you need (application permissions are common for server-to-server).
  • If using application permissions, you will need to grant admin consent in the Azure portal.

Available Resources

The server exposes a concise set of MCP-style endpoints (HTTP tools). Below is a reference table of the primary endpoints and their purpose.

EndpointMethodDescription
/tools/list_threadsPOSTList conversations/threads in a channel
/tools/list_membersPOSTList members of a team or channel
/tools/get_thread_messagesPOSTRead messages from a thread or channel
/tools/post_messagePOSTPost a message to a channel or thread
/tools/post_mentionPOSTPost a message that mentions one or more users

Each endpoint accepts a JSON body with parameters (see examples).

Sample tool request/response (curl)

List members of a team:

curl -X POST http://localhost:3000/tools/list_members \
  -H "Content-Type: application/json" \
  -H "x-mcp-api-key: $MCP_API_KEY" \
  -d '{"teamId":"<team-id>","channelId":null,"limit":100}'

Post a message with mention(s):

curl -X POST http://localhost:3000/tools/post_mention \
  -H "Content-Type: application/json" \
  -H "x-mcp-api-key: $MCP_API_KEY" \
  -d '{
    "teamId":"<team-id>",
    "channelId":"<channel-id>",
    "text":"Hello <at>Jane Doe</at>, see the update below.",
    "mentions":[{"id":"<user-id>","displayName":"Jane Doe"}]
  }'

Use Cases

  • Automated incident notifications: An incident response agent can detect a problem, summarize it, and use post_mention to notify on-call engineers in the relevant Teams channel.
  • Meeting follow-ups: A summarization model reads the thread of a meeting chat (get_thread_messages), generates action items, and posts a consolidated message to the channel.
  • Bot workflow orchestration: An orchestration system lists channel members (list_members) to determine recipients, then creates targeted messages (post_message) or mentions (post_mention) for required approvals.
  • Archival or analytics: A pipeline periodically lists threads (list_threads) and pulls messages for storage or NLP processing to extract trends or compliance signals.

Quick JavaScript example

Simple Node.js call to post a plain message (using axios):

const axios = require('axios');

async function postMessage(baseUrl, apiKey, payload) {
  const res = await axios.post(`${baseUrl}/tools/post_message`, payload, {
    headers: { 'Content-Type': 'application/json', 'x-mcp-api-key': apiKey }
  });
  return res.data;
}

const payload = {
  teamId: '<team-id>',
  channelId: '<channel-id>',
  text: 'Hello from MCP server!'
};

postMessage('http://localhost:3000', process.env.MCP_API_KEY, payload)
  .then(r => console.log('Posted:', r))
  .catch(e => console.error(e.response?.data || e.message));
  • GitHub repository: https://github.com/InditexTech/mcp-teams-server
  • Microsoft Graph docs (for required permissions and message payloads): https://learn.microsoft.com/graph/overview

If you need to extend the server, the codebase is organized to map each tool to a handler that calls Microsoft Graph. Adding new operations typically involves implementing a handler that authenticates with Graph, performs the call, and returns a JSON result that conforms to your MCP tool schema.