@@ -28,15 +28,69 @@ class {
2828 * Configure Module
2929 */
3030 function configure(){
31- settings = {
31+ variables.settings = {
32+ // authToken controls who can access the MCP server and which tools each token may use.
33+ // This is useful for connecting chat agents with different capabilities, or for restricting access to certain tools.
34+ //
35+ // Three supported shapes:
36+ //
37+ // 1. Simple string — one token, full access to all tools:
38+ // authToken: "my-secret-token"
39+ //
40+ // 2. Array of structs with a profile reference (recommended):
41+ // authToken: [
42+ // { token: "admin-token", profile: "admin" },
43+ // { token: "monitor-token", profile: "readonly" }
44+ // ]
45+ // Profile names map to the securityProfiles setting below.
46+ //
47+ // 3. Array of structs with inline tool lists (glob patterns supported):
48+ // authToken: [
49+ // { token: "admin-token", includedTools: ["*"] },
50+ // { token: "jvm-token", includedTools: ["jvm_*"], excludedTools: ["jvm_trigger_gc"] }
51+ // ]
52+ // includedTools defaults to ["*"] (all); excludedTools defaults to [] (none).
53+ //
54+ // Leave empty ("") to disable authentication (open access).
55+ // Clients must send: Authorization: Bearer <token>
56+ authToken : [],
57+ // Named security profiles. Each profile defines includedTools and excludedTools arrays.
58+ // Glob wildcards are supported: "*" (any sequence) and "?" (one character).
59+ // Profile names are referenced from authToken entries via the `profile` field.
60+ //
61+ // Two profiles are built in and always available (you can override them here):
62+ // admin — unrestricted access to every tool
63+ // readonly — read-only observability: all *_get*, *_has*, *_search*, *_read* operations
64+ //
65+ // Add custom profiles as needed, for example:
66+ // operator: { includedTools: ["*_get*","*_has*","module_reload*","scheduler_*"], excludedTools: ["app_stop","runtime_toggle_debug_mode"] }
67+ securityProfiles : {
68+ admin : { includedTools: [ "*" ], excludedTools: [] },
69+ readonly : { includedTools: [ "*_get*", "*_has*", "*_search*", "*_read*" ], excludedTools: [] }
70+ },
71+ // Allowed IP addresses for request filtering. When non-empty, only requests from these IPs are accepted.
72+ // Supports individual IPs (e.g., "127.0.0.1") and CIDR ranges (e.g., "192.168.0.0/24").
73+ // Empty array means no IP filtering (all IPs allowed).
74+ allowedIPs : [ "127.0.0.1" ],
75+ // CORS allowed origins (array of strings, supports wildcards like *.domain.com)
76+ // Empty array means no CORS headers - secure by default
77+ corsAllowedOrigins : [],
78+ // Enable MCP server statistics tracking (default: true)
79+ enableStats : true,
80+ // Maximum HTTP request body size in bytes. 0 = no limit.
81+ maxRequestBodySize : 0,
82+ // Tool whitelist. ["*"] = include all. Specific names = only those tools.
83+ includedTools : [ "*" ],
84+ // Tool names to exclude after the included list is applied.
85+ excludedTools : []
3286 }
3387 }
3488
3589 /**
3690 * Fired when the module is registered and activated.
3791 */
3892 function onLoad(){
39- var mcpServer = new models.ColdBoxMCP()
93+ var mcpServer = new models.ColdBoxMCP( variables.settings )
4094 getBoxRuntime()
4195 .getGlobalService( "aiService" )
4296 .putServer( "cbMCP", mcpServer )
0 commit comments