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:
admin committed 2026-06-16 23:49:05 +05:00
1 parent baecc24211
commit 63bb2a5c99
5 files changed
+29 -5

No files matched your search

+3 -2
View File
@@ -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 () => {