library for handling mcp with teams sdk
Project description
Microsoft Teams MCP Plugin
Model Context Protocol (MCP) integration for Microsoft Teams AI applications. Enables Teams bots to both expose tools as MCP servers and use MCP servers as clients.
Installation
pip install microsoft-teams-mcpplugin
Or if using uv:
uv add microsoft-teams-mcpplugin
Usage
MCP Client (Use MCP Servers)
from microsoft_teams.apps import App
from microsoft_teams.mcpplugin import McpClientPlugin
from microsoft_teams.ai import ChatPrompt
from microsoft_teams.openai import OpenAICompletionsAIModel
# Create MCP client plugin
mcp_client = McpClientPlugin()
# Connect to MCP servers
mcp_client.use_mcp_server("https://example.com/mcp")
# Use with ChatPrompt
model = OpenAICompletionsAIModel(api_key="your-api-key", model="gpt-4")
prompt = ChatPrompt(model, plugins=[mcp_client])
MCP Server (Expose Tools)
from microsoft_teams.apps import App
from microsoft_teams.mcpplugin import McpServerPlugin
from microsoft_teams.ai import Function
from pydantic import BaseModel
# Create MCP server plugin
mcp_server = McpServerPlugin(name="my-mcp-server")
# Define a tool
class EchoParams(BaseModel):
input: str
async def echo_handler(params: EchoParams) -> str:
return f"You said {params.input}"
# Register tool with MCP server
mcp_server.use_tool(
Function(
name="echo",
description="Echo back whatever you said",
parameter_schema=EchoParams,
handler=echo_handler
)
)
app = App(plugins=[mcp_server])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file microsoft_teams_mcpplugin-2.0.0a31.tar.gz.
File metadata
- Download URL: microsoft_teams_mcpplugin-2.0.0a31.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: RestSharp/106.13.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f328542911f68fb447e01449085dffc91a0194fd88034ca466b8b126dc48833c
|
|
| MD5 |
34705804a43e1736ded8413a88d1259a
|
|
| BLAKE2b-256 |
eacd3ffc3235bb43431d98bd16555ece5797686eda5dacc956036bbd47454c69
|
File details
Details for the file microsoft_teams_mcpplugin-2.0.0a31-py3-none-any.whl.
File metadata
- Download URL: microsoft_teams_mcpplugin-2.0.0a31-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: RestSharp/106.13.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3affb7f5eed81af99d956dd4a97bbeafb2ec06099094f5dbe3d1b9260b60d3f0
|
|
| MD5 |
424ca6ffb358a60b64918428d15fa7a6
|
|
| BLAKE2b-256 |
c9657f0ccde113e4692805c62a28b22f328d5fee8d5be68c29039fa1cda4a7c9
|