i have been trying to connect custom build MCP-server which is hosted in our KAAS platform.
from mcp.server.fastmcp import FastMCP
from dotenv import load_dotenv
#from fastapi.middleware.cors import CORSMiddleware
load_dotenv("../.env")
# Create an MCP server
# === Your MCP Server ===
mcp = FastMCP(
name="Calculator",
host="0.0.0.0",
port=8050,
)
# Add a simple calculator tool
@mcp.tool()
async def add(a: int, b: int) -> int:
# auth_header=request.headers.get('authorization')
# if not auth_header:
# raise HTTPException(status_code=401, detail="Missing Authorization header")
# token = auth_header.replace("Bearer ", "")
# print("Received token:", token)
"""Add two numbers together"""
return a + b
# Run the server
if __name__ == "__main__":
print("Running server with Stramble-http transport")
mcp.run(transport="streamable-http")
i am trying to connect this server from copilot studio and i am able to create/connect to connector from agent using swagger.yml
swagger: '2.0'
info:
title: Mcp-add-5
description: >-
MCP Test Specification, YAML for streamable MCP support Copilot Studio which
adds two numbers
version: 1.0.0
host: <host name>
basePath: /
schemes:
- https
paths:
/mcp/:
post:
summary: Mcp-add-5
x-ms-agentic-protocol: mcp-streamable-1.0
operationId: InvokeMCP
responses:
'200':
description: Success
securityDefinitions: {}
but after trying many times tools are not loading in copilot studio:
Not sure where am i making mistake ..same mcp-server works fine when i access from github-copilot and with fastapi-client
