Skip to content

jeevanbisht/CopilotMCPSample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

MCP Hello World Server for Microsoft Copilot Studio

A simple Model Context Protocol (MCP) server that provides a "Hello World" tool for Microsoft Copilot Studio.

Overview

This MCP server exposes one tool:

  • say_hello: Returns a greeting message. Optionally accepts a name parameter to personalize the greeting.

Note: This server uses Streamable HTTP transport (POST/GET /mcp), which is required by Microsoft Copilot Studio. SSE transport was deprecated in August 2025.

Installation

  1. Navigate to the project directory:
cd c:\Py\MCPSample
  1. Install dependencies:
pip install -r requirements.txt

Running the Server

Start the server with:

python server.py

Note: Port 80 requires administrator privileges on Windows. You may need to run the command prompt or terminal as administrator.

The server will start on http://localhost:80 with the MCP endpoint at http://localhost:80/mcp.

You should see output like:

INFO:__main__:Starting MCP Hello World Server on http://localhost:80
INFO:__main__:MCP Streamable HTTP endpoint: http://localhost:80/mcp
INFO:     Uvicorn running on http://0.0.0.0:80 (Press CTRL+C to quit)
INFO:__main__:MCP Streamable HTTP session manager running

Integration with Microsoft Copilot Studio

Step 1: Start the Server

Make sure your MCP server is running locally (see "Running the Server" above).

Step 2: Configure in Copilot Studio

  1. Go to Microsoft Copilot Studio
  2. Open your agent/copilot
  3. Navigate to Actions > Add an action
  4. Select Model Context Protocol (MCP)
  5. Configure the connection:
    • Name: Hello World MCP Server
    • URL: http://localhost:80/mcp
    • Transport: Streamable HTTP

Step 3: Test the Tool

Once connected, you can use the say_hello tool in your Copilot:

Example 1 (without parameter):

  • User: "Use the say_hello tool"
  • Response: "Hello, World!"

Example 2 (with name parameter):

  • User: "Say hello to Alice"
  • Response: "Hello, Alice!"

Tool Details

say_hello

Description: Returns a hello world greeting. Optionally accepts a name to personalize the greeting.

Parameters:

  • name (string, optional): Name to personalize the greeting (defaults to "World")

Returns: A greeting message as text

Architecture

This server uses:

  • MCP SDK: Official Model Context Protocol SDK for Python
  • Starlette: ASGI framework for handling HTTP requests
  • Uvicorn: ASGI server for running the application
  • Streamable HTTP Transport: Required transport for Microsoft Copilot Studio (SSE deprecated August 2025)

Transport Details

The server implements the StreamableHTTPSessionManager from the MCP SDK. The ASGI app (MCPApp) routes:

  • Lifespan events → managed by Starlette for session lifecycle
  • POST /mcp / GET /mcp → handled directly by StreamableHTTPSessionManager
  • All other paths → returns 404 Not Found

Files

  • server.py: Main MCP server implementation
  • requirements.txt: Python dependencies
  • README.md: This documentation file

Troubleshooting

Server won't start:

  • Ensure port 80 is not already in use
  • On Windows, run the command prompt or terminal as administrator (port 80 requires elevated permissions)
  • Check that all dependencies are installed: pip install -r requirements.txt

Copilot Studio can't connect:

  • Verify the server is running and accessible at http://localhost:80/mcp
  • Confirm you are using the Streamable HTTP transport option (not SSE) in Copilot Studio
  • Check firewall settings if running on a different machine
  • Ensure you're using the correct URL format (/mcp endpoint) in Copilot Studio
  • On Windows, ensure you're running with administrator privileges (port 80 requires elevated permissions)

Tool not appearing:

  • Refresh the connection in Copilot Studio
  • Check server logs for errors
  • Verify the MCP configuration in Copilot Studio

Notes

  • This is a basic example server designed for demonstration purposes
  • For production use, consider adding authentication, error handling, and security measures
  • The server runs on localhost by default — for remote access, configure appropriate security settings
  • SSE transport (/sse) is no longer supported; use Streamable HTTP (/mcp) instead

About

CopilotMCPSample

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages