Skip to main content

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.

📖 Documentation

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

microsoft_teams_mcpplugin-2.0.0a50.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

microsoft_teams_mcpplugin-2.0.0a50-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file microsoft_teams_mcpplugin-2.0.0a50.tar.gz.

File metadata

File hashes

Hashes for microsoft_teams_mcpplugin-2.0.0a50.tar.gz
Algorithm Hash digest
SHA256 511142a6a36911700334c0fea6cabdb93ef969559a02f586711e1ac2ab5196f2
MD5 e205d7633ed864d90063a6cf9017a4af
BLAKE2b-256 a1ca9e000b44f3fd06b5f7c88efd5e161c39aa4fb88b46a6619e7f528ab99c46

See more details on using hashes here.

File details

Details for the file microsoft_teams_mcpplugin-2.0.0a50-py3-none-any.whl.

File metadata

File hashes

Hashes for microsoft_teams_mcpplugin-2.0.0a50-py3-none-any.whl
Algorithm Hash digest
SHA256 5aaa1121d868748c70edd48ded4e6973df3a9b9391e39b7a50034e27044721f3
MD5 e0c69d8ec6fce073da00f58292aa0f8c
BLAKE2b-256 beca4c3f0603b6c34450c19d8f2bfecf78e45324b90a7faf466651cd91d538e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page