Skip to content

Commit 74ff076

Browse files
committed
feat: report health check version
1 parent d80f417 commit 74ff076

7 files changed

Lines changed: 37 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project are documented here.
44

5+
## 1.15.1 - 2026-06-30
6+
7+
- Added top-level `serverVersion` to `health_check` so operators can confirm the published service version without a separate `initialize` probe.
8+
59
## 1.15.0 - 2026-06-29
610

711
- Added `changedLineSummary` to module/file comparison results so callers do not need to parse summary text for changed and returned line counts.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Relative `logs`, `cache`, and `tmp` directories are created beside the config fi
9898
| Tool | Purpose |
9999
| --- | --- |
100100
| `test_connection` | Validate the connection and current SQL identity |
101-
| `health_check` | Check config, runtime paths, connection, and permissions |
101+
| `health_check` | Check serverVersion, config, runtime paths, connection, and permissions |
102102
| `find_objects` | Search tables, views, procedures, and functions |
103103
| `describe_table` | Inspect columns, indexes, constraints, and foreign keys |
104104
| `get_object_overview` | Return compact metadata and dependency context |

README.zh-CN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ SQL 文本可能包含敏感数据,仅在确有需要时启用 `logging.logSql
7777
- `search_config_text``run_readonly_query``describe_query_result``explain_query_plan`
7878
- `reload_connection`
7979

80+
`health_check` 顶层返回 `serverVersion`,可直接确认当前发布到运行目录的服务端版本。
81+
8082
`explain_query_plan` 返回原始 SHOWPLAN XML,同时附带语句、内存授予、warning、扫描、缺失索引、隐式转换、排序、hash、lookup、并行等结构化摘要。
8183

8284
`analyze_module_temp_tables` 会分析模块内本地临时表的创建、读写、JOIN、跨行 INSERT/SELECT INTO/UPDATE 和字段流转摘要。

src/SqlServerMcp/Sql/SqlMetadataService.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Data;
22
using System.Diagnostics;
33
using System.Globalization;
4+
using System.Reflection;
45
using System.Security.Cryptography;
56
using System.Text;
67
using System.Text.Json;
@@ -218,6 +219,7 @@ public async Task<object> HealthCheckAsync(CancellationToken cancellationToken)
218219
return new
219220
{
220221
ok = error is null,
222+
serverVersion = GetServerVersion(),
221223
config = new
222224
{
223225
configPath = _options.ConfigPath,
@@ -261,6 +263,13 @@ public async Task<object> HealthCheckAsync(CancellationToken cancellationToken)
261263
};
262264
}
263265

266+
internal static string GetServerVersion()
267+
{
268+
return typeof(SqlMetadataService).Assembly.GetName().Version?.ToString()
269+
?? typeof(SqlMetadataService).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion
270+
?? "unknown";
271+
}
272+
264273
public async Task<object> FindObjectsAsync(
265274
string keyword,
266275
string[]? objectTypes,

src/SqlServerMcp/SqlServerMcp.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
<RootNamespace>SqlServerMcp</RootNamespace>
88
<ImplicitUsings>enable</ImplicitUsings>
99
<Nullable>enable</Nullable>
10-
<Version>1.15.0</Version>
11-
<AssemblyVersion>1.15.0.0</AssemblyVersion>
12-
<FileVersion>1.15.0.0</FileVersion>
13-
<InformationalVersion>1.15.0</InformationalVersion>
10+
<Version>1.15.1</Version>
11+
<AssemblyVersion>1.15.1.0</AssemblyVersion>
12+
<FileVersion>1.15.1.0</FileVersion>
13+
<InformationalVersion>1.15.1</InformationalVersion>
1414
<Description>A read-only Model Context Protocol server for exploring and querying SQL Server.</Description>
1515
<RepositoryUrl>https://github.com/EdmondLu/sqlserver-mcp</RepositoryUrl>
1616
<RepositoryType>git</RepositoryType>

src/SqlServerMcp/Tools/SqlServerMcpTools.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static Task<string> TestConnection(
1414
return service.TestConnectionAsync(cancellationToken);
1515
}
1616

17-
[McpServerTool(ReadOnly = true), Description("Return config, connection, runtime directory, and SQL permission health for this MCP server.")]
17+
[McpServerTool(ReadOnly = true), Description("Return serverVersion, config, connection, runtime directory, and SQL permission health for this MCP server.")]
1818
public static Task<string> HealthCheck(
1919
SqlServerToolService service,
2020
CancellationToken cancellationToken)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using SqlServerMcp.Sql;
2+
3+
namespace SqlServerMcp.Tests;
4+
5+
public sealed class VersionInfoTests
6+
{
7+
[Fact]
8+
public void GetServerVersion_ReturnsAssemblyVersion()
9+
{
10+
var expected = typeof(SqlMetadataService).Assembly.GetName().Version?.ToString();
11+
12+
Assert.NotNull(expected);
13+
Assert.Equal(expected, SqlMetadataService.GetServerVersion());
14+
Assert.Matches(@"^\d+\.\d+\.\d+\.\d+$", SqlMetadataService.GetServerVersion());
15+
}
16+
}

0 commit comments

Comments
 (0)