This repository contains the implementation of a travel recommendation system using Model Context Protocol (MCP). MCP enables seamless communication between models and remote servers, allowing for efficient, scalable, and modular deployment of AI services.
Model Context Protocol (MCP) is a lightweight, structured protocol designed to facilitate communication between AI models and remote execution environments. It allows models to offload tasks, retrieve context, and interact with external systems in a standardised way. MCP is particularly useful for:
- Decoupling model logic from infrastructure
- Enabling remote execution of model components
- Supporting scalable, cloud-native AI workflows
Azure Functions is a serverless compute platform that allows you to run small pieces of code (functions) without worrying about infrastructure. You can use Azure Functions to host MCP-compatible endpoints that your models can call remotely.
- Scalability: Automatically scales based on demand.
- Cost-effective: Pay only for the time your code runs.
- Integration: Easily integrates with other Azure services like Blob Storage, Cosmos DB, and Event Grid.
- Go to the https://portal.azure.com/.
- Click on Create a resource > Compute > Function App.
- Fill in the required fields:
- Subscription and Resource Group
- Function App name
- Runtime stack (e.g., Python, Node.js)
- Region
- Click Review + create, then Create.
-
Clone this repository:
git clone https://github.com/anu-01/mcpfunc-TravelRecommendation.git cd mcpfunc-TravelRecommendation
-
Install Python dependencies:
pip install -r requirements.txt
Note it is a best practice to create a Virtual Environment before doing the pip install to avoid dependency issues/collisions, or if you are running in CodeSpaces. See Python Environments in VS Code for more information.
-
Deploy to Azure for Remote MCP
- Log in to Azure:
az login
- Deploy to function app resource you created earlier in Step 1
az functionapp deployment source config-zip \ --resource-group <YourResourceGroup> \ --name <YourFunctionAppName> \ --src <path-to-your-zip-file>
Your client will need a key in order to invoke the new hosted SSE endpoint, which will be of the form https://.azurewebsites.net/runtime/webhooks/mcp/sse. The hosted function requires a system key by default which can be obtained from the portal or the CLI (az functionapp keys list --resource-group <resource_group> --name <function_app_name>). Obtain the system key named mcp_extension.
For MCP Inspector, you can include the key in the URL:
https://<funcappname>.azurewebsites.net/runtime/webhooks/mcp/sse?code=<your-mcp-extension-system-key>
For GitHub Copilot within VS Code, you should instead set the key as the x-functions-key header in mcp.json, and you would just use https://.azurewebsites.net/runtime/webhooks/mcp/sse for the URL. The following example uses an input and will prompt you to provide the key when you start the server from VS Code. Note mcp.json has already been included in this repo and will be picked up by VS Code. Click Start on the server to be prompted for values including functionapp-name (in your /.azure/*/.env file) and functions-mcp-extension-system-key which can be obtained from CLI command above or API Keys in the portal for the Function App.
{
"inputs":[
{
"type": "promptString",
"id": "functions-mcp-extension-system-key",
"description": "Azure Functions Extension System Key",
"password": true
}
],
"servers": {
"my-mcp-server-13c2eec6": {
"type": "sse",
"url": "https://<funcappname>.azurewebsites.net/runtime/webhooks/mcp/sse",
"headers": {
"x-functions-key": "${input:functions-mcp-extension-system-key}",
},
}
}
}
Feel free to fork the repo and submit pull requests. For major changes, please open an issue first to discuss what you would like to change.