snippy
If you are the rightful owner of snippy and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
Snippy is a serverless code snippet management service using Azure Functions, Durable Functions, Azure OpenAI, Microsoft Fabric, and Azure AI Agents.
Snippy ¡ Intelligent Code-Snippet Service with MCP Tools
Snippy is an Azure Functionsâbased reference application that turns any function into an MCP (Model Context Protocol) tool consumable by GitHub Copilot Chat and other MCPâaware clients. The sample implements a productionâstyle codeâsnippet service with AIâpowered analysis:
- Save snippets â persists code, metadata and OpenAI embeddings in Cosmos DB DiskANN
- Semantic retrieve â vector search over embeddings
- AI Agents â generate a deep wiki or languageâspecific code style guide from stored snippets
- Durable fanâout/fanâin with Blueprints â in experimental branch for largeâscale processing
- Microsoft Fabric integration â in gk/fabric branch demonstrating how to build Agents with Fabric Data Agents
The project ships with reproducible azd infrastructure, so azd up
will stand up the entire stack â Functions, CosmosâŻDB, Azure OpenAI and Azure AI Agents â in a single command.
Important Security Notice This repository is intended for learning and demonstration purposes. Do not deploy it to production without a thorough security review. At a minimum you should:
- Swap connection strings for Managed Identity + Azure Key Vault
- Restrict network access to Azure services via Private Endpoints or serviceâtags
- Enable GitHub secretâscanning and CI security tools
Features â˘Â Architecture â˘Â Getting Started â˘Â Guidance
Features
- Remote MCP trigger â expose Functions as realâtime SSE tools
- AIâassisted documentation â "deepâwiki" and "codeâstyle" agents create rich Markdown (Mermaid, diagrams, etc.)
- Vector search on Cosmos DB DiskANN â lowâlatency semantic retrieval
- Oneâclick deploy â
azd up
provisions and deploys code & infra - Codespaces & Dev Containers â fully configured dev environment in your browser or local VS Code
Tool Matrix
Tool Name | Purpose |
---|---|
save_snippet | Save code snippets with vector embeddings for semantic search |
get_snippet | Retrieve previously saved code snippets by their unique name |
code_style | Generate language-specific code style guides from saved snippets |
deep_wiki | Create comprehensive wiki documentation by analyzing code snippets |
Architecture Diagram
flowchart LR
%% âââ MCP Hosts & Clients (local) ââââââââââââââââââââââââââââââ
subgraph mcphosts["MCP Hosts & Clients (YourâŻComputer)"]
Host["Host<br/>(VS Code / IDE)"]
Client["Client<br/>(GitHub Copilot)"]
end
%% âââ Application on Azure (remote) ââââââââââââââââââââââââââââ
subgraph app["Application (Azure)"]
Snippy["MCP Server<br/>SnippyâŻTriggers<br/>(Function App)"]:::dashed
Foundry["FoundryâŻAgent<br/>Deep Wiki ¡ Code Style"]
Cosmos["CosmosâŻDB<br/>Operational + Vector DB"]:::datasource
AOAI["AzureâŻOpenAI<br/>textâembeddingâ3âsmall"]
FabricDA["Fabric â Data Agent"]
VectorTool["Tools â Vector Search"]
end
%% âââ Local interactions âââââââââââââââââââââââââââââââââââââââ
Host <--> Client
%% âââ MCP protocol to Azure ââââââââââââââââââââââââââââââââââââ
Client <-- "MCPâŻProtocol (SSE)" --> Snippy
%% âââ Bindings & data flow inside Azure ââââââââââââââââââââââââ
Snippy -- Bindings --> AOAI
Snippy --> Cosmos
Snippy --> Foundry
Foundry --> FabricDA
Foundry --> VectorTool
%% âââ Styling ââââââââââââââââââââââââââââââââââââââââââââââââââ
classDef datasource stroke-width:2,stroke-dasharray:5 5
classDef dashed stroke-width:2,stroke-dasharray:5 5,fill:transparent
class Cosmos datasource
class Snippy dashed
style mcphosts fill:transparent
style app fill:transparent
Getting Started
You can run Snippy in GitHub Codespaces, VS Code Dev Containers, or your local environment. The fastest path is Codespaces.
Snippy requires an Azure region that supports textâembeddingâ3âsmall (or a compatible embeddings model) and Azure AI Agents. The
azd
workflow prompts you for a region; we recommend eastus for best availability.
GitHub Codespaces
-
Click Open in Codespaces above (first badge) â the container build may take a few minutes.
-
When the terminal appears, sign in:
azd auth login --use-device-code
-
Launch the stack:
azd up
-
Once deployment completes, copy the printed MCP URL and open GitHub Copilot Chat â Agent mode to try commands like âSave this snippet asâŻhelloâworldâ.
VS Code Dev Containers
Prerequisites: Docker Desktop + the Dev Containers extension.
-
Click the Dev Containers badge (second badge) or run RemoteâContainers: Open Repository in Container from VS Code.
-
Sign in and launch as shown for Codespaces:
azd auth login azd up
Local Environment
Prerequisites
- azd CLI
- Python 3.11 +
uv
- Node 18+ (for Functions Core Tools)
- Azure Functions Core Tools v4 (
npm i -g azure-functions-core-tools@4 --unsafe-perm
)
Quickstart
# 1. Clone & init
azd init --template Azure-Samples/snippy
# 2. Sign in
azd auth login
# 3. Provision & deploy
azd up
The CLI prints the Function App URL, MCP endpoint and system key when finished. To remove all resources later:
azd down --purge
Guidance
Region Availability
Azure OpenAI model support varies by region. Verify availability here and choose the same region for all Azure resources. eastus and swedencentral are good default choices.
Costs
Estimate monthly cost using the Azure Pricing Calculator. Major components:
- Azure Functions â Consumption / Flex tiers
- Cosmos DB â Serverless or provisioned throughput
- Azure OpenAI â payâasâyouâgo per 1K tokens
- Azure AI Agents â perâexecution billing (preview)
Security
Snippy uses User-Assigned Managed Identity for secure service-to-service authentication. The infrastructure is configured with:
- User-Assigned Managed Identity on the Function App with appropriate RBAC roles:
- Cosmos DB Data Contributor
- Storage Blob Data Owner and Queue Data Contributor
- Application Insights Monitoring Metrics Publisher
- Azure AI Project Developer
For production deployments, we recommend:
- Restrict inbound traffic with Private Endpoints + VNet integration
- Enable network security features like service endpoints and firewall rules
Resources
- Blog â Build AI agent tools using Remote MCP with Azure Functions (https://aka.ms/snippy-blog)
- Model Context Protocol spec â https://aka.ms/mcp
- Azure Functions Remote MCP docs â https://aka.ms/azure-functions-mcp
- Develop Python apps for Azure AI â https://learn.microsoft.com/azure/developer/python/azure-ai-for-python-developers
Contributing
Standard fork â branch â PR workflow. Use Conventional Commits (feat:
, fix:
) in commit messages.
License
MIT Š Microsoft Corporation