Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Clothing inventory server hosted in Azure Functions

NotificationsYou must be signed in to change notification settings

Azure-Samples/functions-mcp-inventory-server-python

Repository files navigation

This template repository contains a Model Context Protocol (MCP) server implementation for managing clothing store inventory in Python. The sample can be easily deployed to Azure using the Azure Developer CLI (azd). It uses managed identity and a virtual network to make sure deployment is secure by default. You can opt out of a VNet being used in the sample by setting VNET_ENABLED to false in the parameters.

Model Context Protocol (MCP) is an open standard that enables secure connections between host applications (like Claude Desktop, IDEs, or other AI tools) and external data sources and tools. MCP allows AI assistants to securely interact with local and remote resources while maintaining user control and privacy.

This sample demonstrates how to create an MCP server that provides tools for managing clothing inventory, including adding items, searching inventory, updating quantities, and retrieving item details. The server uses FastMCP for HTTP transport and SQLite for data persistence.

Prerequisites

Initialize the local project

You can initialize a project from thisazd template in one of these ways:

  • Use thisazd init command from an empty local (root) folder:

    azd init --template functions-mcp-inventory-server-python

    Supply an environment name, such asmcpinventory when prompted. Inazd, the environment is used to maintain a unique deployment context for your app.

  • Clone the GitHub template repository locally using thegit clone command:

    git clone https://github.com/Azure-Samples/functions-mcp-inventory-server-python.gitcd functions-mcp-inventory-server-python

    You can also clone the repository from your own fork in GitHub.

Sample Data

SAMPLE_INVENTORY= [    {"id":1,"name":"Navy Single-Breasted Slim Fit Formal Blazer","category":"Jackets","price":89.99,"description":"Tailored navy blazer with notch lapels","sizes": {"XS":0,"S":0,"M":0,"L":0,"XL":0,"XXL":0,"XXXL":0        }    },# More items...]

Deployment

  1. This sample uses Visual Studio Code as the main client. Configure it as an allowed client application:

    azd envset PRE_AUTHORIZED_CLIENT_IDS aebc6443-996d-45c2-90f0-388ff96faa56
  2. Specify a service management reference if required by your organization. If you're not a Microsoft employee and don't know that you need to set this, you can skip this step. However, if provisioning fails with an error about a missing service management reference, you may need to revisit this step. Microsoft employees using a Microsoft tenant must provide a service management reference (your Service Tree ID). Without this, you won't be able to create the Entra app registration, and provisioning will fail.

    azd envset SERVICE_MANAGEMENT_REFERENCE<service-management-reference>
  3. Runazd up in the root directory.

    You're prompted to supply these required deployment parameters:

    ParameterDescription
    Environment nameAn environment that's used to maintain a unique deployment context for your app. You won't be prompted if you created the local project using azd init.
    Azure subscriptionSubscription in which your resources are created.
    Azure locationAzure region in which to create the resource group that contains the new Azure resources. Only regions that currently support the Flex Consumption plan are shown.

    When the deployment finishes, your terminal will display output similar to the following:

      (✓) Done: Resource group: rg-resource-group-name (12.061s)  (✓) Done: App Service plan: plan-random-guid (6.748s)  (✓) Done: Virtual Network: vnet-random-guid (8.566s)  (✓) Done: Log Analytics workspace: log-random-guid (29.422s)  (✓) Done: Storage account: strandomguid (34.527s)  (✓) Done: Application Insights: appi-random-guid (8.625s)  (✓) Done: Function App: func-mcp-random-guid (36.096s)  (✓) Done: Private Endpoint: blob-private-endpoint (30.67s)  Deploying services (azd deploy)  (✓) Done: Deploying service api  - Endpoint: https://functionapp-name.azurewebsites.net/

Redeploy your code

You can run theazd up command as many times as you need to both provision your Azure resources and deploy code updates to your function app.

Note: Deployed code files are always overwritten by the latest deployment package.

Clean up resources

When you're done working with your function app and related resources, you can use this command to delete the function app and its related resources from Azure and avoid incurring any further costs:

azd down

About

This repository contains an MCP (Model Context Protocol) server implementation for clothing inventory management written in Python. It's deployed to Azure Functions Flex Consumption plan using the Azure Developer CLI (azd). The sample uses managed identity and a virtual network to make sure deployment is secure by default.

The MCP server provides tools for:

  • Adding new clothing items with sizes and quantities
  • Searching and retrieving inventory items
  • Updating stock quantities
  • Managing clothing store inventory through the MCP protocol

This enables AI assistants and other MCP-compatible applications to securely interact with inventory data while maintaining proper access controls and data persistence.

About

Clothing inventory server hosted in Azure Functions

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp