A Model Context Protocol server that bridges Microsoft Teams with MCP-compatible clients (LLMs, agentic frameworks, CLI), enabling chat integration, message search, and event streaming without traditional REST API endpoints.
This project implements a pure Model Context Protocol (MCP) server that bridges Microsoft Teams and MCP-compatible clients (LLMs, agentic frameworks, and a rich CLI MCP client). All features are exposed via MCP tools, resources, and events—no REST API endpoints.
+-------------------+ +-------------------+ +-------------------+
| CLI MCP Client || MCP Server || Microsoft Teams |
| (rich terminal UI)| | (Python, FastMCP) | | (Graph API) |
+-------------------+ +-------------------+ +-------------------+
| |
| v
| +-------------------+ +-------------------+
| | DuckDB DB | | IR Server |
| +-------------------+ | (PostgreSQL, API) |
+-------------------+
|
v
+-------------------+
| PostgreSQL DB |
| (with pgvector) |
+-------------------+
git clone cd mcp-teams
pip install -r requirements.txt
Copy the template and fill in your Azure AD/Teams credentials:
cp .env.template .env # Edit .env and fill in your Azure AD and other settings
See the table below for variable descriptions.
git clone cd mcp-teams
Copy the template and fill in your credentials:
cp .env.template .env # Edit .env and fill in your settings
docker-compose up -d
Variable | Description | Example / Default |
---|---|---|
AZURE_CLIENT_ID | Azure AD Application (client) ID | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
AZURE_CLIENT_SECRET | Azure AD Application secret | your-secret |
AZURE_TENANT_ID | Azure AD Tenant ID | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
AZURE_APP_OBJECT_ID | Azure AD Application object ID | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
DUCKDB_PATH | Path to DuckDB database file | db/teams_mcp.duckdb |
TOKEN_PATH | Path to store persistent token cache | db/token_cache.json |
POLL_INTERVAL | Polling interval (seconds) for new messages | 10 |
DEMO_MODE | Set to true for mock/demo mode (no real Teams API calls) | false |
OPENAI_API_KEY | OpenAI API key for embedding generation | sk-... |
POSTGRES_USER | PostgreSQL username | postgres |
POSTGRES_PASSWORD | PostgreSQL password | postgres |
POSTGRES_DB | PostgreSQL database name | mcp_ir |
IR_SERVER_HOST | IR server hostname | ir_server |
IR_SERVER_PORT | IR server port | 8090 |
python mcp_server/server.py
docker-compose up -d
To check logs:
docker-compose logs -f teams_mcp # Teams MCP server logs docker-compose logs -f ir_server # IR server logs
Set DEMO_MODE=true
in your .env
and run as above.
python cli/login.py login python cli/login.py status python cli/login.py logout
All commands below use the MCP stdio protocol to talk to the server.
python cli/mcp_client.py list_chats
python cli/mcp_client.py get_messages
python cli/mcp_client.py send_message "Hello from CLI!"
python cli/mcp_client.py create_chat
python cli/mcp_client.py search_messages "project update" --mode hybrid --top_k 5
python cli/mcp_client.py stream
The IR server provides advanced search capabilities with PostgreSQL and pgvector. It exposes an HTTP API for MCP server communication.
GET http://localhost:8090/
GET http://localhost:8090/api/tools
POST http://localhost:8090/api/tools/search
Body:
{ "query": "your search query", "search_type": "hybrid", "limit": 10 }
POST http://localhost:8090/api/tools/index_content
Body:
{ "content": "Text content to index", "source_type": "teams", "metadata": { "author": "User Name", "created": "2025-04-01T12:00:00Z" } }
For more detailed IR server documentation, see ir/README.md.
messages/incoming
for real-time updatesmcp_server/server.py
teams/graph.py
.env
values.env
DEMO_MODE=true
for local testing without real TeamsFor full product details, see specs/app-spec.md
.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!