@xyd-js/mcp-server 0.0.0-build-52f9bb2-20251012023142 → 0.0.0-build-2bb31f3-20251012215032

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/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "@xyd-js/mcp-server",
3
- "version": "0.0.0-build-52f9bb2-20251012023142",
3
+ "version": "0.0.0-build-2bb31f3-20251012215032",
4
4
  "type": "module",
5
5
  "description": "MCP server for xyd",
6
6
  "main": "dist/index.js",
7
7
  "exports": {
8
8
  "./package.json": "./package.json",
9
9
  ".": {
10
- "import": "./dist/index.js"
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
11
12
  },
12
13
  "./mcp": {
13
- "import": "./dist/mcp.js"
14
+ "import": "./dist/mcp.js",
15
+ "types": "./dist/mcp.d.ts"
14
16
  }
15
17
  },
16
18
  "bin": {
@@ -19,7 +21,7 @@
19
21
  "dependencies": {
20
22
  "@modelcontextprotocol/sdk": "^1.18.1",
21
23
  "express": "^5.1.0",
22
- "@xyd-js/mcp": "0.0.0-build-52f9bb2-20251012023142"
24
+ "@xyd-js/mcp": "0.0.0-build-2bb31f3-20251012215032"
23
25
  },
24
26
  "devDependencies": {
25
27
  "@types/express": "^4.17.21",
@@ -29,8 +31,10 @@
29
31
  "@types/bun": "latest"
30
32
  },
31
33
  "scripts": {
32
- "build": "bun build src/index.ts --outdir dist --target node --format esm",
34
+ "build": "bun run build:server && bun run build:mcp && bun run build:types",
35
+ "build:server": "bun build src/index.ts --outdir dist --target node --format esm",
33
36
  "build:mcp": "bun build src/mcp.ts --outfile dist/mcp.js --target node --format esm",
37
+ "build:types": "tsc --project tsconfig.json",
34
38
  "dev": "bun --watch src/index.ts",
35
39
  "start": "bun dist/index.js",
36
40
  "demo:simple": "bun --watch demo/simple/server.ts",
package/src/index.ts CHANGED
@@ -15,4 +15,3 @@ const port = process.env.PORT || 3000;
15
15
  console.log("Running MCP server on port", port);
16
16
 
17
17
  app.listen(port);
18
-
package/src/mcp.ts CHANGED
@@ -24,15 +24,17 @@ export class MCPServer {
24
24
  // Store tokens by session ID
25
25
  private sessionTokens: { [sessionId: string]: string } = {};
26
26
 
27
- private uniformSource: string = "";
27
+ private uniformSources: string[] = []
28
28
 
29
- constructor(uniformSource: string = process.argv[2]) {
29
+ constructor(uniformSources: string | string[] = process.argv[2]) {
30
30
  this.connect = this.connect.bind(this);
31
31
  this.handleConnectionRequest = this.handleConnectionRequest.bind(this);
32
32
  this.handleSessionRequest = this.handleSessionRequest.bind(this);
33
33
 
34
- if (uniformSource) {
35
- this.uniformSource = uniformSource;
34
+ if (uniformSources && typeof uniformSources === "string") {
35
+ this.uniformSources.push(uniformSources);
36
+ } else if (uniformSources && Array.isArray(uniformSources)) {
37
+ this.uniformSources.push(...uniformSources);
36
38
  }
37
39
  }
38
40
 
@@ -123,11 +125,14 @@ export class MCPServer {
123
125
  version: "1.0.0",
124
126
  });
125
127
 
126
- if (this.uniformSource) {
127
- await mcpUniformResources(server, this.uniformSource);
128
+ // TODO: !!! support multiple sources !!!
129
+ const source = this.uniformSources[0] || ""
130
+
131
+ if (this.uniformSources[0]) {
132
+ await mcpUniformResources(server, source);
128
133
  }
129
134
 
130
- await mcpUniformTools(server, this.uniformSource, token);
135
+ await mcpUniformTools(server, source || "", token || "");
131
136
 
132
137
  // Add simple token tool
133
138
  this.addSimpleTokenTool(server);
package/tsconfig.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "allowSyntheticDefaultImports": true,
7
+ "esModuleInterop": true,
8
+ "allowJs": true,
9
+ "strict": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "declaration": true,
15
+ "emitDeclarationOnly": true,
16
+ "outDir": "dist",
17
+ "jsx": "react-jsx"
18
+ },
19
+ "include": [
20
+ "src/**/*"
21
+ ],
22
+ "exclude": [
23
+ "node_modules",
24
+ "dist"
25
+ ]
26
+ }