Skip to content

MCP Server Example on MCP SDK#391

Merged
MehakBindra merged 5 commits intomainfrom
mehak/mcp-sample
Apr 16, 2026
Merged

MCP Server Example on MCP SDK#391
MehakBindra merged 5 commits intomainfrom
mehak/mcp-sample

Conversation

@MehakBindra
Copy link
Copy Markdown
Contributor

@MehakBindra MehakBindra commented Apr 15, 2026

This pull request significantly refactors the MCP server Teams bot sample to provide a robust, human-in-the-loop toolkit using the official mcp SDK, with clear separation of concerns and improved documentation. The changes introduce a modular structure, new tool definitions for user interaction and approvals, and improved state management. The README and project metadata are also updated for clarity and accuracy.

Key changes:

1. Major refactor and modularization

  • The codebase is split into clear modules: app.py (Teams bot handlers), mcp_tools.py (MCP tool definitions), state.py (in-memory state), and main.py (entry point and server wiring), replacing the previous monolithic and example-based implementation.

2. New MCP tools for human-in-the-loop workflows

  • Defines five MCP tools in mcp_tools.py: notify, ask, get_reply, request_approval, and get_approval, enabling agents to notify users, ask questions, and request approvals through Teams with polling for responses.
  • Introduces helper models for tool inputs and outputs in models.py.

3. Improved state management

  • Implements in-memory dictionaries in state.py to track conversations, pending asks, approvals, and user-to-request mappings, supporting the new tools and workflows.

4. Documentation and metadata updates

  • Overhauls the README.md to explain setup, architecture, tool usage, workflows, and limitations, providing a much clearer guide for users and developers.
  • Updates pyproject.toml to accurately describe the project and its dependencies, switching to the mcp SDK.

5. Removal of legacy/demo code

  • Removes the previous example tools (echo, get_weather, calculate, alert) and the old MCP server plugin setup, replacing them with the new modular and production-like approach.

Copilot AI review requested due to automatic review settings April 15, 2026 02:24
@MehakBindra MehakBindra marked this pull request as draft April 15, 2026 02:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Refactors the MCP server example to use the official mcp Python SDK (FastMCP) and exposes Microsoft Teams bot actions as MCP tools, replacing the previous custom plugin-based setup.

Changes:

  • Migrates MCP integration to FastMCP with @mcp.tool()-decorated Teams tools (messaging, reactions, members).
  • Mounts the MCP HTTP app into the Teams bot FastAPI server and adds MCP lifespan integration.
  • Updates example docs and dependencies to match the new architecture.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

File Description
examples/mcp-server/src/main.py Replaces custom MCP plugin registration with FastMCP tools; adds conversation/activity tracking and mounts MCP app into the Teams server.
examples/mcp-server/pyproject.toml Drops obsolete Teams MCP plugin/devtools deps and adds mcp SDK dependency.
examples/mcp-server/README.md Updates setup/run instructions and documents the new Teams-focused MCP tools and Inspector workflow.
Comments suppressed due to low confidence (1)

examples/mcp-server/src/main.py:1

  • These in-memory maps grow without bounds (especially activity_storage and bot_activity_storage if many messages are received/sent). For a long-running sample, this can lead to unbounded memory growth. Consider adding a simple eviction strategy (TTL, max size, or LRU) or documenting that this is intentionally ephemeral demo storage.
"""

Comment thread examples/mcp-server/src/main.py
Comment thread examples/mcp-server/src/main.py Outdated
Comment thread examples/mcp-server/src/main.py Outdated
Comment thread examples/mcp-server/src/main.py Outdated
Comment thread examples/mcp-server/src/main.py Outdated
@MehakBindra MehakBindra marked this pull request as ready for review April 15, 2026 05:09
Comment thread examples/mcp-server/src/app.py Outdated
Comment thread examples/mcp-server/src/app.py
Copy link
Copy Markdown
Collaborator

@heyitsaamir heyitsaamir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great PR!

Comment thread examples/mcp-server/src/mcp_tools.py Outdated
@MehakBindra MehakBindra merged commit 6db44d7 into main Apr 16, 2026
4 checks passed
@MehakBindra MehakBindra deleted the mehak/mcp-sample branch April 16, 2026 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants