nx-mcp-server 1.0.2 → 1.0.4

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/.dockerignore ADDED
@@ -0,0 +1,5 @@
1
+ node_modules
2
+ output
3
+ .git
4
+ .claude
5
+ *.md
package/Dockerfile ADDED
@@ -0,0 +1,19 @@
1
+ FROM node:18-alpine
2
+
3
+ WORKDIR /app
4
+
5
+ COPY package*.json ./
6
+ RUN npm ci --omit=dev
7
+
8
+ COPY src/ ./src/
9
+ COPY config.json ./
10
+
11
+ ENV MCP_TRANSPORT=http
12
+ ENV MCP_PORT=3000
13
+
14
+ EXPOSE 3000
15
+
16
+ HEALTHCHECK --interval=30s --timeout=3s \
17
+ CMD wget -qO- http://localhost:3000/health || exit 1
18
+
19
+ CMD ["node", "src/index.js"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx-mcp-server",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "图像生成 MCP Server — 智能生图(万相API) + 本地图形工具集",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {Server} from '@modelcontextprotocol/sdk/server/index.js';
3
3
  import {StdioServerTransport} from '@modelcontextprotocol/sdk/server/stdio.js';
4
- import {CallToolRequestSchema, ListToolsRequestSchema} from '@modelcontextprotocol/sdk/types.js';
4
+ import {CallToolRequestSchema, ListToolsRequestSchema, isInitializeRequest} from '@modelcontextprotocol/sdk/types.js';
5
5
  import {generateSmart} from './tools/smart.js';
6
6
  import {generateBasic} from './tools/basic.js';
7
7
  import {generateQrcode} from './tools/qrcode.js';
@@ -260,7 +260,7 @@ async function startHttp(){
260
260
 
261
261
  if(sessionId&&transports[sessionId]){
262
262
  transport=transports[sessionId];
263
- }else if(!sessionId){
263
+ }else if(!sessionId&&isInitializeRequest(req.body)){
264
264
  // 新会话初始化
265
265
  const eventStore={
266
266
  events:[],
@@ -21,22 +21,16 @@ export async function generateSmart(args){
21
21
  const buf=Buffer.from(res.data);
22
22
  const saved=await saveOutput(buf,'ai_generated.png',args.outputDir,'url');
23
23
 
24
- if(args.outputFormat==='base64'){
25
- const b64=buf.toString('base64');
26
- results.push({
27
- ...saved,
28
- base64:`data:image/png;base64,${b64}`,
29
- mimeType:'image/png',
30
- width:args.width||1024,
31
- height:args.height||1024,
32
- });
33
- }else{
34
- results.push({
35
- ...saved,
36
- width:args.width||1024,
37
- height:args.height||1024,
38
- });
39
- }
24
+ // 始终附带 base64,确保远程部署时用户也能看到图片
25
+ const b64=buf.toString('base64');
26
+ const mime='image/png';
27
+ results.push({
28
+ ...saved,
29
+ base64:`data:${mime};base64,${b64}`,
30
+ mimeType:mime,
31
+ width:args.width||1024,
32
+ height:args.height||1024,
33
+ });
40
34
  }
41
35
 
42
36
  return {