@@ -2,13 +2,15 @@ import path from "path";
2
2
import fs from "fs-extra" ;
3
3
4
4
/**
5
- * Generate xmcp.config.ts based on selected transports
5
+ * Generate xmcp.config.ts based on selected transports and paths
6
6
* @param projectPath - Project directory path
7
7
* @param transports - Array of selected transport types
8
+ * @param paths - Array of selected paths (tools, prompts)
8
9
*/
9
10
export function generateConfig (
10
11
projectPath : string ,
11
- transports : string [ ]
12
+ transports : string [ ] ,
13
+ paths : string [ ] = [ "tools" , "prompts" , "resources" ]
12
14
) : void {
13
15
const hasHttp = transports . includes ( "http" ) ;
14
16
const hasStdio = transports . includes ( "stdio" ) ;
@@ -27,6 +29,37 @@ const config: XmcpConfig = {`;
27
29
stdio: true,` ;
28
30
}
29
31
32
+ // Add paths configuration
33
+ configContent += `
34
+ paths: {` ;
35
+
36
+ // Add tools path if selected
37
+ if ( paths . includes ( "tools" ) ) {
38
+ configContent += `
39
+ tools: "./src/tools",` ;
40
+ }
41
+
42
+ // Add prompts path if selected
43
+ if ( paths . includes ( "prompts" ) ) {
44
+ configContent += `
45
+ prompts: "./src/prompts",` ;
46
+ }
47
+
48
+ // Add resources path if selected
49
+ if ( paths . includes ( "resources" ) ) {
50
+ configContent += `
51
+ resources: "./src/resources",` ;
52
+ }
53
+
54
+ // Close the paths object
55
+ configContent += `
56
+ },` ;
57
+
58
+ // Remove trailing comma if present
59
+ configContent = configContent . endsWith ( "," )
60
+ ? configContent . slice ( 0 , - 1 )
61
+ : configContent ;
62
+
30
63
configContent += `
31
64
};
32
65
0 commit comments