IF -for-Microsoft-Teams
A demo of deploying an MCP server for use by a bot in Microsoft Teams.
claude mcp add --transport stdio microsoft-if-mcp-server-for-microsoft-teams docker run -i mcp-teams-server:latest \ --env AZURE_OPENAI_KEY="<your_openai_api_key>" \ --env DATAVERSE_CLIENT_ID="<your_dataverse_client_id>" \ --env DATAVERSE_TENANT_ID="<your_dataverse_tenant_id>" \ --env AZURE_OPENAI_ENDPOINT="<your_openai_endpoint>" \ --env COURT_LISTENER_BASE_URL="https://courtlistener.com" \ --env DATAVERSE_CLIENT_SECRET="<your_dataverse_client_secret>" \ --env FUNCTIONS_WORKER_RUNTIME="dotnet" \ --env AZURE_STORAGE_CONNECTION_STRING="<your_azure_storage_connection_string>"
How to use
This MCP server demonstrates how a Microsoft Teams bot can be built around the Model Context Protocol to provide legal research capabilities. The server exposes four MCP tools that wrap the Court Listener REST API and present results in a structured format suitable for Teams interactions. The server runs as an Azure Function-based MCP server and uses Dataverse as a caching layer to accelerate repeated queries, while Azure OpenAI handles intent understanding and tool parameter extraction. Teams users can ask natural language questions about cases, dockets, or court information and receive formatted, actionable results via the Teams bot.
The MCP tools available through the server include: search_opinions to find relevant court opinions, get_opinion_details to fetch specifics about a selected opinion, search_dockets to locate cases or dockets, and get_court_info to retrieve information about a given court. The MCP client speaks JSON-RPC 2.0 over HTTP/SSE, and the server handles authentication, routing, and caching. The Teams bot forwards user queries to Azure OpenAI for intent detection, extracts which tool to invoke and the required parameters, and then returns the formatted results back to Teams for display.
How to install
Prerequisites
- Docker installed and running
- Git installed
- Access to an Azure subscription for optional deployment of the Azure Functions components
- Optional: .NET 8 SDK if you prefer building locally rather than using Docker
Install steps (using Docker)
- Clone the repository:
git clone https://github.com/your-org/microsoft-if-mcp-server-for-microsoft-teams.git
cd microsoft-if-mcp-server-for-microsoft-teams
- Build the Docker image (assuming a Dockerfile is configured in the repo):
docker build -t mcp-teams-server:latest .
- Run the container with necessary environment variables (placeholders to be filled):
docker run -d --name mcp-teams-server \
-e FUNCTIONS_WORKER_RUNTIME=dotnet \
-e AZURE_STORAGE_CONNECTION_STRING="<your_azure_storage_connection_string>" \
-e DATAVERSE_CLIENT_ID="<your_dataverse_client_id>" \
-e DATAVERSE_CLIENT_SECRET="<your_dataverse_client_secret>" \
-e DATAVERSE_TENANT_ID="<your_dataverse_tenant_id>" \
-e COURT_LISTENER_BASE_URL="https://courtlistener.com" \
-e AZURE_OPENAI_ENDPOINT="<your_openai_endpoint>" \
-e AZURE_OPENAI_KEY="<your_openai_api_key>" \
mcp-teams-server:latest
- (Optional) If you prefer deploying as an Azure Functions app, follow the repository’s azure setup instructions in docs/ to configure Functions runtime and deploy to Azure.
If you want to run locally without Docker, ensure you have the .NET 8 SDK and use the provided Azure Functions project and run commands from the mcp-server directory, e.g. dotnet build and func start, adjusting local.settings.json for your environment.
Additional notes
Tips and common issues:
- The MCP endpoint is /runtime/webhooks/mcp; ensure the function app is reachable from your MCP clients.
- Dataverse caching uses a 30-day TTL and SHA-256 keys; make sure the cache table is properly provisioned and the service principal has access.
- Be aware of the end-of-support note for the Bot Framework when using this demo; for production, consider updating to the Microsoft Agents SDK as recommended.
- Set the Azure OpenAI GPT-4.1 deployment names and keys securely; rotate credentials regularly.
- If you experience connectivity issues with Court Listener, verify network egress rules and that COURT_LISTENER_BASE_URL is correct.
- For local development, use local.settings.json to mock environment variables and enable verbose logs to diagnose MCP routing or tool invocation problems.
Related MCP Servers
mssql
MSSQL Server MCP implementation written in C#
McpDotNet.Extensions.SemanticKernel
Microsoft SemanticKernel integration for the Model Context Protocol (MCP). Enables seamless use of MCP tools as AI functions.
DatabaseMcpServer
MCP server from ttcc666/DatabaseMcpServer
mcp-dataverse
MCP Server for querying Dataverse using SQL
xperience-community
ASP.NET Core MCP server for Xperience by Kentico projects
console-to-http
Example of converting a stdio MCP server to HTTP using ModelContextProtocol.AspNetCore