Commit f1a0170
Add server-level description field to MCP runtime configuration (#3016)
## Why make this change?
MCP clients and agents require high-level behavioral context for servers
via the `initialize` response's `instructions` field. DAB previously had
no mechanism to surface this configurable semantic guidance.
## What is this change?
Added optional `description` field to MCP runtime configuration that
populates the MCP protocol's `instructions` field:
**Configuration model**
- `McpRuntimeOptions` now accepts `description` parameter
- `McpRuntimeOptionsConverter` handles serialization/deserialization
**CLI integration**
- `dab configure --runtime.mcp.description "text"` command support
- Configuration generator validates and persists the value
- Fixed config persistence bug: Added DML tools options to condition
check to ensure MCP configuration updates are properly written to config
file
**MCP server response**
- **Stdio Server**: `HandleInitialize()` retrieves description from
`RuntimeConfig.Runtime.Mcp.Description` and conditionally includes
`instructions` in initialize response when non-empty
- **HTTP Server**: Updated server name to "SQL MCP Server"
- Both servers now use explicit `object` type instead of `var` for
better type clarity
**Testing**
- Added comprehensive unit tests in
`McpRuntimeOptionsSerializationTests` covering:
- Serialization/deserialization with description
- Edge cases: null, empty strings, whitespace, very long strings (5000+
characters)
- Special characters: quotes, newlines, tabs, unicode characters
- Backward compatibility with existing configurations without
description field
- Improved assertion order to validate JSON field presence before value
matching
- Consolidated CLI tests: removed duplicate
`TestAddDescriptionToMcpSettings` and renamed
`TestUpdateDescriptionForMcpSettings` to
`TestConfigureDescriptionForMcpSettings`
**Code quality fixes**
- Fixed build errors by removing nullable reference type annotations
(project has nullable disabled)
- Fixed IDE0090 code style error by using target-typed new expression
- Fixed whitespace formatting error by removing trailing whitespace
Example configuration:
```json
{
"runtime": {
"mcp": {
"enabled": true,
"description": "This MCP provides access to the Products database..."
}
}
}
```
## How was this tested?
- [x] Unit Tests
- 9 serialization/deserialization tests for MCP description field
- 2 CLI configuration tests for description option (consolidated from 3)
- All existing ConfigureOptionsTests pass (58 tests)
- [x] Build verification - all projects build successfully with no
errors or warnings
## Sample Request(s)
CLI usage:
```bash
dab configure --runtime.mcp.description "This MCP provides access to the Products database and should be used to answer product-related or inventory-related questions from the user."
```
MCP initialize response (when description configured - Stdio Server):
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"protocolVersion": "2024-11-05",
"capabilities": { ... },
"serverInfo": {
"name": "SQL MCP Server",
"version": "1.0.0"
},
"instructions": "This MCP provides access to the Products database..."
}
}
```
**Note**: The HTTP server currently only updates the server name to "SQL
MCP Server". Instructions support will be added when the
ModelContextProtocol.AspNetCore library adds support for this field in
future versions.
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: JerryNixon <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Aniruddh25 <[email protected]>
Co-authored-by: anushakolan <[email protected]>
Co-authored-by: Anusha Kolan <[email protected]>
Co-authored-by: Aniruddh Munde <[email protected]>1 parent 6e8ac9f commit f1a0170
7 files changed
Lines changed: 321 additions & 5 deletions
File tree
- src
- Azure.DataApiBuilder.Mcp/Core
- Cli.Tests
- Cli
- Commands
- Config
- Converters
- ObjectModel
- Service.Tests/Configuration
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
158 | 160 | | |
159 | 161 | | |
160 | 162 | | |
161 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
162 | 183 | | |
163 | 184 | | |
164 | 185 | | |
| |||
170 | 191 | | |
171 | 192 | | |
172 | 193 | | |
173 | | - | |
| 194 | + | |
| 195 | + | |
174 | 196 | | |
175 | 197 | | |
176 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
926 | 926 | | |
927 | 927 | | |
928 | 928 | | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
929 | 957 | | |
930 | 958 | | |
931 | 959 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| 97 | + | |
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| |||
180 | 182 | | |
181 | 183 | | |
182 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
183 | 188 | | |
184 | 189 | | |
185 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
810 | 810 | | |
811 | 811 | | |
812 | 812 | | |
813 | | - | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
814 | 822 | | |
815 | 823 | | |
816 | 824 | | |
| |||
1066 | 1074 | | |
1067 | 1075 | | |
1068 | 1076 | | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
1069 | 1085 | | |
1070 | 1086 | | |
1071 | 1087 | | |
| |||
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | | - | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| |||
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
101 | 110 | | |
102 | 111 | | |
103 | 112 | | |
| |||
134 | 143 | | |
135 | 144 | | |
136 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
137 | 153 | | |
138 | 154 | | |
139 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
33 | 39 | | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
37 | | - | |
| 43 | + | |
| 44 | + | |
38 | 45 | | |
39 | 46 | | |
40 | 47 | | |
| |||
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
| 68 | + | |
| 69 | + | |
61 | 70 | | |
62 | 71 | | |
63 | 72 | | |
| |||
0 commit comments