Skip to content

Commit 6beb2a0

Browse files
authored
Merge branch 'main' into sql_cli_db_ex-ip
2 parents 991b484 + 36ed249 commit 6beb2a0

File tree

20 files changed

+1930
-91
lines changed

20 files changed

+1930
-91
lines changed

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<PackageVersion Include="Azure.Identity" Version="1.16.0" />
1414
<PackageVersion Include="Azure.Developer.LoadTesting" Version="1.0.2" />
1515
<PackageVersion Include="Azure.Identity.Broker" Version="1.3.0" />
16+
<PackageVersion Include="Azure.Messaging.EventGrid" Version="4.24.0" />
1617
<PackageVersion Include="Azure.Messaging.ServiceBus" Version="7.20.1" />
1718
<PackageVersion Include="Azure.Monitor.Ingestion" Version="1.2.0" />
1819
<PackageVersion Include="Azure.Monitor.Query" Version="1.7.1" />

core/Azure.Mcp.Core/tests/Azure.Mcp.Core.UnitTests/Client/MockClientTests.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,45 @@ await Invoke_Request_To_Server(
180180
});
181181
}
182182

183+
[Fact]
184+
public async Task Invoke_Invalid_Tool_Returns_Error()
185+
{
186+
await Invoke_Request_To_Server(
187+
method: "tools/call",
188+
new ServerCapabilities
189+
{
190+
Tools = new()
191+
{
192+
CallToolHandler = (request, ct) =>
193+
{
194+
// Simulate the behavior when an invalid tool is called
195+
return ValueTask.FromResult(new CallToolResult
196+
{
197+
Content = [new TextContentBlock { Text = $"The tool {request.Params?.Name} was not found" }],
198+
IsError = true
199+
});
200+
},
201+
ListToolsHandler = (request, ct) => throw new NotImplementedException(),
202+
}
203+
},
204+
requestParams: JsonSerializer.SerializeToNode(new
205+
{
206+
name = "non_existent_tool",
207+
arguments = new { }
208+
}),
209+
configureOptions: null,
210+
assertResult: response =>
211+
{
212+
var result = JsonSerializer.Deserialize<CallToolResult>(response);
213+
Assert.NotNull(result);
214+
Assert.True(result.IsError, "Expected error response for non-existent tool");
215+
Assert.NotEmpty(result.Content);
216+
217+
var textContent = Assert.IsType<TextContentBlock>(result.Content[0]);
218+
Assert.Contains("The tool non_existent_tool was not found", textContent.Text);
219+
});
220+
}
221+
183222

184223
private async Task Invoke_Request_To_Server(string method, ServerCapabilities? serverCapabilities, Action<McpServerOptions>? configureOptions, Action<JsonNode?> assertResult)
185224
{

docs/azmcp-commands.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,13 @@ azmcp eventgrid subscription list --subscription <subscription> \
624624
[--resource-group <resource-group>] \
625625
[--topic <topic>]
626626
[--location <location>]
627+
628+
# Publish custom events to Event Grid topics
629+
azmcp eventgrid events publish --subscription <subscription> \
630+
--topic <topic> \
631+
--data <json-event-data> \
632+
[--resource-group <resource-group>] \
633+
[--schema <schema-type>]
627634
```
628635

629636
### Azure Function App Operations

docs/e2eTestPrompts.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ This file contains prompts used for end-to-end testing to ensure each tool is in
178178
| azmcp_eventgrid_subscription_list | List all Event Grid subscriptions in subscription <subscription> |
179179
| azmcp_eventgrid_subscription_list | Show Event Grid subscriptions in resource group <resource_group_name> in subscription <subscription> |
180180
| azmcp_eventgrid_subscription_list | List Event Grid subscriptions for subscription <subscription> in location <location> |
181+
| azmcp_eventgrid_events_publish | Publish an event to Event Grid topic <topic_name> using <event_schema> with the following data <event_data> |
182+
| azmcp_eventgrid_events_publish | Publish event to my Event Grid topic <topic_name> with the following events <event_data> |
183+
| azmcp_eventgrid_events_publish | Send an event to Event Grid topic <topic_name> in resource group <resource_group_name> with <event_data> |
181184

182185
## Azure Function App
183186

servers/Azure.Mcp.Server/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ The Azure MCP Server updates automatically by default whenever a new release com
44

55
## 0.8.2 (2025-09-25)
66

7+
### Features Added
8+
9+
-- Added support for publishing custom events to Event Grid topics via the command `azmcp_eventgrid_events_publish`. Supports EventGrid, CloudEvents, and custom schemas with structured event data delivery for event-driven architectures. [[#514](https://github.com/microsoft/mcp/pull/514)]
10+
711
### Bugs Fixed
812

913
- Fixed `azmcp_subscription_list` to return empty enumerable instead of `null` when no subscriptions are found. [[#508](https://github.com/microsoft/mcp/pull/508)]

servers/Azure.Mcp.Server/README.md

Lines changed: 92 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -8,141 +8,155 @@ All Azure MCP tools in a single server. The Azure MCP Server implements the [MCP
88
## Table of Contents
99
- [Overview](#overview)
1010
- [Installation](#installation)
11-
- [IDE Extensions](#ide-extensions)
11+
- [IDE](#ide)
1212
- [VS Code (Recommended)](#vs-code-recommended)
1313
- [Visual Studio 2022](#visual-studio-2022)
1414
- [IntelliJ IDEA](#intellij-idea)
15-
- [Package Managers](#package-managers)
15+
- [Additional IDEs](#additional-ides)
16+
- [Package Manager](#package-manager)
1617
- [NuGet](#nuget)
1718
- [NPM](#npm)
1819
- [Docker](#docker)
19-
- [Custom Clients](#custom-clients)
2020
- [Usage](#usage)
2121
- [Getting Started](#getting-started)
2222
- [What can you do with the Azure MCP Server?](#what-can-you-do-with-the-azure-mcp-server)
2323
- [Complete List of Supported Azure Services](#complete-list-of-supported-azure-services)
24-
- [Support & Reference](#support-and-reference)
24+
- [Support and Reference](#support-and-reference)
2525
- [Documentation](#documentation)
26-
- [Feedback & Support](#feedback-and-support)
26+
- [Feedback and Support](#feedback-and-support)
2727
- [Security](#security)
2828
- [Data Collection](#data-collection)
2929
- [Contributing & Code of Conduct](#contributing)
3030

31-
# <a id="overview"></a> Overview
31+
# Overview
3232

3333
**Azure MCP Server** supercharges your agents with Azure context across **30+ different Azure services**.
3434

35-
# <a id="installation"></a> Installation
35+
# Installation
3636

37-
## <a id="ide-extensions"></a> 🧩 IDE Extensions
37+
Install Azure MCP Server using either an IDE extension or package manager. Choose one method below.
3838

39-
Follow these simple steps to start using Azure MCP with your favorite IDE. We recommend VS Code:
39+
## IDE
4040

41-
### <a id="vs-code-recommended"></a> 🔷 VS Code (Recommended)
41+
Start using Azure MCP with your favorite IDE. We recommend VS Code:
42+
43+
### VS Code (Recommended)
4244

4345
1. Install either the stable or Insiders release of VS Code:
4446
* [💫 Stable release](https://code.visualstudio.com/download)
4547
* [🔮 Insiders release](https://code.visualstudio.com/insiders)
4648
1. Install the [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) and [GitHub Copilot Chat](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat) extensions
4749
1. Install the [Azure MCP Server](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azure-mcp-server) extension
4850

49-
### <a id="visual-studio-2022"></a> 💜 Visual Studio 2022
51+
### Visual Studio 2022
5052

5153
From within Visual Studio 2022 install [GitHub Copilot for Azure (VS 2022)](https://marketplace.visualstudio.com/items?itemName=github-copilot-azure.GitHubCopilotForAzure2022):
5254
1. Go to `Extensions | Manage Extensions...`
5355
2. Switch to the `Browse` tab in `Extension Manager`
5456
3. Search for `Github Copilot for Azure`
5557
4. Click `Install`
5658

57-
### <a id="intellij-idea"></a> ☕ IntelliJ IDEA
59+
### IntelliJ IDEA
5860

5961
1. Install either the [IntelliJ IDEA Ultimate](https://www.jetbrains.com/idea/download) or [IntelliJ IDEA Community](https://www.jetbrains.com/idea/download) edition.
6062
1. Install the [GitHub Copilot](https://plugins.jetbrains.com/plugin/17718-github-copilot) plugin.
6163
1. Install the [Azure Toolkit for Intellij](https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij) plugin.
6264

63-
## <a id="package-managers"></a> Package Managers
64-
65-
### <a id="nuget"></a> 🤖 NuGet
66-
67-
Microsoft publishes an official Azure MCP Server .NET Tool on NuGet: [Azure.Mcp](https://www.nuget.org/packages/Azure.Mcp).
68-
69-
### <a id="npm"></a> 📦 NPM
70-
71-
Microsoft publishes an official Azure MCP Server npm package for Node.js: [@azure/mcp](https://www.npmjs.com/package/@azure/mcp).
72-
73-
### <a id="docker"></a> 🐋 Docker
65+
### Additional IDEs
7466

75-
Microsoft publishes an official Azure MCP Server Docker container on the [Microsoft Artifact Registry](https://mcr.microsoft.com/artifact/mar/azure-sdk/azure-mcp).
67+
For IDEs not listed above, manually setup Azure MCP Server within the IDE.
7668

7769
<details>
78-
<summary>For a step-by-step Docker installation, follow these instructions:</summary>
79-
80-
1. Create an `.env` file with environment variables that [match one of the `EnvironmentCredential`](https://learn.microsoft.com/dotnet/api/azure.identity.environmentcredential) sets. For example, a `.env` file using a service principal could look like:
81-
82-
```bash
83-
AZURE_TENANT_ID={YOUR_AZURE_TENANT_ID}
84-
AZURE_CLIENT_ID={YOUR_AZURE_CLIENT_ID}
85-
AZURE_CLIENT_SECRET={YOUR_AZURE_CLIENT_SECRET}
86-
```
70+
<summary>Manual setup instructions</summary>
8771

88-
2. Add `.vscode/mcp.json` or update existing MCP configuration. Replace `/full/path/to/.env` with a path to your `.env` file.
72+
Configure via `mcp.json` (VS Code example - adapt structure for your IDE):
8973

90-
```json
74+
```json
9175
{
9276
"servers": {
9377
"Azure MCP Server": {
94-
"command": "docker",
78+
"command": "npx",
9579
"args": [
96-
"run",
97-
"-i",
98-
"--rm",
99-
"--env-file",
100-
"/full/path/to/.env",
101-
"mcr.microsoft.com/azure-sdk/azure-mcp:latest",
80+
"-y",
81+
"@azure/mcp@latest",
82+
"server",
83+
"start"
10284
]
10385
}
10486
}
10587
}
106-
```
88+
```
89+
90+
In some environments you may need to run the server directly:
91+
92+
```bash
93+
npx -y @azure/mcp@latest server start
94+
```
10795

108-
Optionally, use `--env` or `--volume` to pass authentication values.
10996
</details>
11097

111-
## <a id="custom-clients"></a> 🤖 Custom Clients
11298

113-
You can easily configure your MCP client to use the Azure MCP Server.
99+
## Package Manager
114100

115-
<details>
116-
<summary>Have your client run the following command and access it via standard IO:</summary>
101+
Install Azure MCP Server via a package manager:
102+
103+
### NuGet
104+
105+
Install the .NET Tool: [Azure.Mcp](https://www.nuget.org/packages/Azure.Mcp).
117106

118107
```bash
119-
npx -y @azure/mcp@latest server start
108+
dotnet tool install --global Azure.Mcp
120109
```
121110

122-
For example, add the following `mcp.json` to VS Code. Other clients will look similar, but may be structured slightly different. Consult the documentation of the custom client for details.
111+
### NPM
123112

124-
1. Example `mcp.json`:
113+
Install the Node.js package: [@azure/mcp](https://www.npmjs.com/package/@azure/mcp).
125114

126-
```json
127-
{
115+
```bash
116+
npm install -g @azure/mcp
117+
```
118+
119+
### Docker
120+
121+
Microsoft publishes an official Azure MCP Server Docker container on the [Microsoft Artifact Registry](https://mcr.microsoft.com/artifact/mar/azure-sdk/azure-mcp).
122+
123+
<details>
124+
<summary>Docker setup instructions</summary>
125+
126+
1. Create a `.env` file with Azure credentials ([see EnvironmentCredential options](https://learn.microsoft.com/dotnet/api/azure.identity.environmentcredential)):
127+
128+
```bash
129+
AZURE_TENANT_ID={YOUR_AZURE_TENANT_ID}
130+
AZURE_CLIENT_ID={YOUR_AZURE_CLIENT_ID}
131+
AZURE_CLIENT_SECRET={YOUR_AZURE_CLIENT_SECRET}
132+
```
133+
134+
2. Configure your MCP client with the Docker command:
135+
136+
```json
137+
{
128138
"servers": {
129-
"Azure MCP Server": {
130-
"command": "npx",
131-
"args": [
132-
"-y",
133-
"@azure/mcp@latest",
134-
"server",
135-
"start"
136-
]
137-
}
139+
"Azure MCP Server": {
140+
"command": "docker",
141+
"args": [
142+
"run",
143+
"-i",
144+
"--rm",
145+
"--env-file",
146+
"/full/path/to/.env",
147+
"mcr.microsoft.com/azure-sdk/azure-mcp:latest"
148+
]
149+
}
138150
}
139-
}
140-
```
151+
}
152+
```
153+
154+
Replace `/full/path/to/.env` with your actual .env file path. Alternatively, use individual `--env` flags or `--volume` mounts for credentials.
141155
</details>
142156

143-
# <a id="usage"></a> Usage
157+
# Usage
144158

145-
## <a id="getting-started"></a> 🚀 Getting Started
159+
## Getting Started
146160

147161
1. Open GitHub Copilot in [VS Code](https://code.visualstudio.com/docs/copilot/chat/chat-agent-mode) or [IntelliJ](https://github.blog/changelog/2025-05-19-agent-mode-and-mcp-support-for-copilot-in-jetbrains-eclipse-and-xcode-now-in-public-preview/#agent-mode) and switch to Agent mode.
148162
1. Click `refresh` on the tools list
@@ -153,9 +167,9 @@ For example, add the following `mcp.json` to VS Code. Other clients will look s
153167
1. We're building this in the open. Your feedback is much appreciated, and will help us shape the future of the Azure MCP server
154168
- 👉 [Open an issue in the public repository](https://github.com/microsoft/mcp/issues/new/choose)
155169

156-
## <a id="what-can-you-do-with-the-azure-mcp-server"></a> ✨ What can you do with the Azure MCP Server?
170+
## What can you do with the Azure MCP Server?
157171

158-
The Azure MCP Server supercharges your agents with Azure context. Here are some cool prompts you can try:
172+
The Azure MCP Server supercharges your agents with Azure context. Here are some cool prompts you can try:
159173

160174
### 🧮 Azure AI Foundry
161175

@@ -211,6 +225,8 @@ The Azure MCP Server supercharges your agents with Azure context. Here are some
211225
* "List Event Grid subscriptions for topic 'my-topic' in subscription 'my-subscription'"
212226
* "List Event Grid Subscriptions in subscription 'my-subscription'"
213227
* "List Event Grid subscriptions for topic 'my-topic' in location 'my-location'"
228+
* "Publish an event with data '{\"name\": \"test\"}' to topic 'my-topic' using CloudEvents schema"
229+
* "Send custom event data to Event Grid topic 'analytics-events' with EventGrid schema"
214230

215231
### 🔑 Azure Key Vault
216232

@@ -264,7 +280,7 @@ The Azure MCP Server supercharges your agents with Azure context. Here are some
264280
* "Upload my file to the blob container"
265281

266282

267-
## <a id="complete-list-of-supported-azure-services"></a> 🛠️ Complete List of Supported Azure Services
283+
## Complete List of Supported Azure Services
268284

269285
The Azure MCP Server provides tools for interacting with **30+ Azure service areas**:
270286

@@ -305,26 +321,26 @@ The Azure MCP Server provides tools for interacting with **30+ Azure service are
305321
- 🏗️ **Bicep** - Azure resource templates
306322
- 🏗️ **Cloud Architect** - Guided architecture design
307323

308-
# <a id="support-and-reference"></a> Support & Reference
324+
# Support and Reference
309325

310-
## <a id="documentation"></a> Documentation
326+
## Documentation
311327

312328
- See our [official documentation on learn.microsoft.com](https://learn.microsoft.com/azure/developer/azure-mcp-server/) to learn how to use the Azure MCP Server to interact with Azure resources through natural language commands from AI agents and other types of clients.
313329
- For additional command documentation and examples, see [Azure MCP Commands](https://github.com/microsoft/mcp/blob/main/docs/azmcp-commands.md).
314330

315-
## <a id="feedback-and-support"></a> Feedback & Support
331+
## Feedback and Support
316332

317333
- Check the [Troubleshooting guide](https://aka.ms/azmcp/troubleshooting) to diagnose and resolve common issues with the Azure MCP Server.
318334
- We're building this in the open. Your feedback is much appreciated, and will help us shape the future of the Azure MCP server.
319335
- 👉 [Open an issue](https://github.com/microsoft/mcp/issues) in the public GitHub repository — we’d love to hear from you!
320336

321-
## <a id="security"></a> 🛡️ Security
337+
## Security
322338

323339
Your credentials are always handled securely through the official [Azure Identity SDK](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md) - **we never store or manage tokens directly**.
324340

325341
MCP as a phenomenon is very novel and cutting-edge. As with all new technology standards, consider doing a security review to ensure any systems that integrate with MCP servers follow all regulations and standards your system is expected to adhere to. This includes not only the Azure MCP Server, but any MCP client/agent that you choose to implement down to the model provider.
326342

327-
## <a id="data-collection"></a> Data Collection
343+
## Data Collection
328344

329345
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's [privacy statement](https://www.microsoft.com/privacy/privacystatement). You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
330346

@@ -336,7 +352,7 @@ To opt out, set the environment variable `AZURE_MCP_COLLECT_TELEMETRY` to `false
336352

337353

338354

339-
## <a id="contributing"></a> 👥 Contributing
355+
## Contributing
340356

341357
We welcome contributions to the Azure MCP Server! Whether you're fixing bugs, adding new features, or improving documentation, your contributions are welcome.
342358

@@ -348,7 +364,7 @@ Please read our [Contributing Guide](https://github.com/microsoft/mcp/blob/main/
348364
* 🔄 Making pull requests
349365

350366

351-
## <a id="code-of-conduct"></a> 🤝 Code of Conduct
367+
## Code of Conduct
352368

353369
This project has adopted the
354370
[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).

tools/Azure.Mcp.Tools.EventGrid/src/Azure.Mcp.Tools.EventGrid.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<ProjectReference Include="..\..\..\core\Azure.Mcp.Core\src\Azure.Mcp.Core.csproj" />
1111
</ItemGroup>
1212
<ItemGroup>
13+
<PackageReference Include="Azure.Messaging.EventGrid" />
1314
<PackageReference Include="Azure.ResourceManager" />
1415
<PackageReference Include="Azure.ResourceManager.EventGrid" />
1516
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />

0 commit comments

Comments
 (0)