@type-crafter/mcp 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +20 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8,6 +8,10 @@ import { dirname } from 'path';
|
|
|
8
8
|
import { parse as parseYaml } from 'yaml';
|
|
9
9
|
import { randomUUID } from 'crypto';
|
|
10
10
|
import { z } from 'zod';
|
|
11
|
+
import { createRequire } from 'module';
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
const packageJson = require('../package.json');
|
|
14
|
+
const MCP_VERSION = packageJson.version;
|
|
11
15
|
// ES module dirname workaround
|
|
12
16
|
const __filename = fileURLToPath(import.meta.url);
|
|
13
17
|
const __dirname = dirname(__filename);
|
|
@@ -212,7 +216,7 @@ function checkSpecContent(specContent, resolvedSpecPath) {
|
|
|
212
216
|
// Create server instance
|
|
213
217
|
const server = new McpServer({
|
|
214
218
|
name: 'type-crafter-mcp',
|
|
215
|
-
version:
|
|
219
|
+
version: MCP_VERSION,
|
|
216
220
|
}, {
|
|
217
221
|
capabilities: {
|
|
218
222
|
tools: {},
|
|
@@ -547,11 +551,25 @@ server.registerTool('list-languages', {
|
|
|
547
551
|
],
|
|
548
552
|
};
|
|
549
553
|
});
|
|
554
|
+
// Tool 6: get-version
|
|
555
|
+
server.registerTool('get-version', {
|
|
556
|
+
description: 'Returns the current version of the Type Crafter MCP server.',
|
|
557
|
+
inputSchema: z.object({}),
|
|
558
|
+
}, async () => {
|
|
559
|
+
return {
|
|
560
|
+
content: [
|
|
561
|
+
{
|
|
562
|
+
type: 'text',
|
|
563
|
+
text: `Type Crafter MCP v${MCP_VERSION}`,
|
|
564
|
+
},
|
|
565
|
+
],
|
|
566
|
+
};
|
|
567
|
+
});
|
|
550
568
|
// Start the server
|
|
551
569
|
async function main() {
|
|
552
570
|
const transport = new StdioServerTransport();
|
|
553
571
|
await server.connect(transport);
|
|
554
|
-
console.error(
|
|
572
|
+
console.error(`Type Crafter MCP Server v${MCP_VERSION} running on stdio`);
|
|
555
573
|
}
|
|
556
574
|
main().catch((error) => {
|
|
557
575
|
console.error('Server error:', error);
|