Skip to content

Conversation

@seligj95
Copy link

Summary

Migrated the inventory MCP server from SQLite to Azure Table Storage to support the read-only filesystem in Azure Functions deployment environment.

Changes Made

Storage Migration

  • Replaced SQLite database with Azure Table Storage for persistent data
  • Implemented lazy initialization with deferred retry on startup failures
  • JSON serialization for complex types (sizes dictionary)
  • Consistent partition key strategy using INVENTORY partition

Authentication & Security

  • Configured Managed Identity authentication with explicit client ID
  • Proper RBAC configuration for Table Storage access

Dependencies

  • Added azure-data-tables for Table Storage SDK
  • Added azure-identity for managed identity authentication
  • Removed SQLite3 dependencies

Infrastructure Updates

  • Updated infra/main.bicep to enable Table Storage (enableTable: true)
  • Updated infra/app/api.bicep to configure STORAGE_ACCOUNT_NAME and AZURE_CLIENT_ID environment variables
  • Maintained compatibility with existing Flex Consumption plan deployment

Error Handling

  • Robust error handling with graceful degradation
  • Non-blocking initialization allowing server startup even if Table Storage is temporarily unavailable
  • Comprehensive logging for troubleshooting

Key Files Changed

  • server.py - Complete migration to Azure Table Storage with managed identity auth
  • requirements.txt - Updated dependencies
  • infra/main.bicep - Enabled Table Storage feature flag
  • infra/app/api.bicep - Added environment variable configuration

Testing Completed

  • ✅ All 5 MCP tools (get_inventory, add_item, get_item_by_id, update_item_quantity, search_items) working via HTTP
  • ✅ Data persistence verified across function app restarts
  • ✅ Managed identity authentication successful in Azure
  • ✅ Local development and Azure deployment both tested

Breaking Changes

None - All API contracts remain unchanged. Existing MCP clients continue to work without modifications.

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.

1 participant