varmory 1.0.4 → 1.0.6

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/mcp/server.js CHANGED
@@ -2,7 +2,7 @@ import path from 'path';
2
2
  import { fileURLToPath } from 'url';
3
3
  import Fastify from 'fastify';
4
4
  import fastifyStatic from '@fastify/static';
5
- import cors from '@fastify/cors';
5
+ // import cors from '@fastify/cors';
6
6
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
7
  import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
8
8
  import attachShowcase from './showcaseMcp.js';
@@ -12,7 +12,7 @@ const PORT = process.env.PORT || 3000;
12
12
 
13
13
  const app = Fastify({ logger: true });
14
14
 
15
- app.register(cors, { origin: true });
15
+ // app.register(cors, { origin: true });
16
16
 
17
17
  // Serve the built SPA from ../demo
18
18
  app.register(fastifyStatic, {
@@ -23,13 +23,13 @@ app.register(fastifyStatic, {
23
23
  // MCP Streamable HTTP transport — stateless, one server per request
24
24
  // CORS headers are set on the raw response since reply.hijack() bypasses Fastify's pipeline
25
25
  app.all('/mcp', async (request, reply) => {
26
- const origin = request.headers.origin;
27
- if (origin) {
28
- reply.raw.setHeader('Access-Control-Allow-Origin', origin);
29
- reply.raw.setHeader('Access-Control-Allow-Methods', 'GET, POST, DELETE, OPTIONS');
30
- reply.raw.setHeader('Access-Control-Allow-Headers', 'Content-Type, Accept, Mcp-Session-Id');
31
- reply.raw.setHeader('Access-Control-Expose-Headers', 'Mcp-Session-Id');
32
- }
26
+ // const origin = request.headers.origin;
27
+ // if (origin) {
28
+ // reply.raw.setHeader('Access-Control-Allow-Origin', origin);
29
+ // reply.raw.setHeader('Access-Control-Allow-Methods', 'GET, POST, DELETE, OPTIONS');
30
+ // reply.raw.setHeader('Access-Control-Allow-Headers', 'Content-Type, Accept, Mcp-Session-Id');
31
+ // reply.raw.setHeader('Access-Control-Expose-Headers', 'Mcp-Session-Id');
32
+ // }
33
33
 
34
34
  if (request.method === 'OPTIONS') {
35
35
  reply.raw.writeHead(204);
@@ -38,7 +38,9 @@ app.all('/mcp', async (request, reply) => {
38
38
  }
39
39
 
40
40
  const server = new McpServer({ name: 'varmory', version: '1.0.0' });
41
- attachShowcase(server);
41
+ // rootDir = repo root (one level up from this file); enables filesystem
42
+ // scanning of the showcase layout + Quasar src.
43
+ attachShowcase(server, { rootDir: path.join(__dirname, '..') });
42
44
 
43
45
  const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined });
44
46
  await server.connect(transport);