fix: derive SERVER_VERSION from package.json
dbmole reported a hardcoded SERVER_VERSION of 0.1.0 while the package was already published as 0.1.1: the constant had drifted because a bump has to touch two places. Both servers now read the version from package.json (resolveJsonModule + a JSON import attribute), so a release updates one place and the reported version can no longer fall behind. Add a dbmole guard test that add_connection publishes a non-empty inputSchema with the expected required fields, mirroring esmole, so a future `.superRefine` on the schema cannot silently empty it.
This commit is contained in:
1 parent
baecc24211
commit
63bb2a5c99
5 files changed
+29
-5
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { registerConnectionTools } from '@dbmole/core'
|
||||
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
||||
import * as z from 'zod'
|
||||
import pkg from '../package.json' with { type: 'json' }
|
||||
import type { EsBackend } from './es/backend.js'
|
||||
import { ping } from './esBackend.js'
|
||||
import { esFormatError } from './esError.js'
|
||||
@@ -16,7 +17,7 @@ import {
|
||||
} from './schema.js'
|
||||
import { registerEsTools } from './tools/index.js'
|
||||
|
||||
export const SERVER_VERSION = '0.1.1'
|
||||
export const SERVER_VERSION = pkg.version
|
||||
|
||||
const patchSchema = z
|
||||
.object({
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js'
|
||||
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js'
|
||||
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import pkg from '../../package.json' with { type: 'json' }
|
||||
import { createManager } from '../../src/manager.js'
|
||||
import { createRegistry } from '../../src/registry.js'
|
||||
import { createServer, SERVER_VERSION } from '../../src/server.js'
|
||||
@@ -27,8 +28,8 @@ describe('createServer', () => {
|
||||
rmSync(dir, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
it('exports SERVER_VERSION', () => {
|
||||
expect(SERVER_VERSION).toBe('0.1.1')
|
||||
it('reports the package version over MCP', () => {
|
||||
expect(SERVER_VERSION).toBe(pkg.version)
|
||||
})
|
||||
|
||||
it('registers exactly the ten tools and names the server esmole-mcp', async () => {
|
||||
|
||||
Reference in new issue
Block a user