Skip to content

Commit 31590b5

Browse files
refactor: Ensure environment variables are cast to appropriate types in MCP configuration
1 parent b1159a0 commit 31590b5

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

config/mcp.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
'.git',
4545
],
4646
'definitions_file' => base_path('routes/mcp.php'),
47-
'auto_discover' => env('MCP_AUTO_DISCOVER', true),
48-
'save_to_cache' => env('MCP_DISCOVERY_SAVE_TO_CACHE', true),
47+
'auto_discover' => (bool) env('MCP_AUTO_DISCOVER', true),
48+
'save_to_cache' => (bool) env('MCP_DISCOVERY_SAVE_TO_CACHE', true),
4949
],
5050

5151
/*
@@ -75,19 +75,19 @@
7575
*/
7676
'transports' => [
7777
'stdio' => [
78-
'enabled' => env('MCP_STDIO_ENABLED', true),
78+
'enabled' => (bool) env('MCP_STDIO_ENABLED', true),
7979
],
8080

8181
'http_dedicated' => [
82-
'enabled' => env('MCP_HTTP_DEDICATED_ENABLED', true),
82+
'enabled' => (bool) env('MCP_HTTP_DEDICATED_ENABLED', true),
8383
'host' => env('MCP_HTTP_DEDICATED_HOST', '127.0.0.1'),
8484
'port' => (int) env('MCP_HTTP_DEDICATED_PORT', 8090),
8585
'path_prefix' => env('MCP_HTTP_DEDICATED_PATH_PREFIX', 'mcp'),
8686
'ssl_context_options' => [],
8787
],
8888

8989
'http_integrated' => [
90-
'enabled' => env('MCP_HTTP_INTEGRATED_ENABLED', true),
90+
'enabled' => (bool) env('MCP_HTTP_INTEGRATED_ENABLED', true),
9191
'route_prefix' => env('MCP_HTTP_INTEGRATED_ROUTE_PREFIX', 'mcp'),
9292
'middleware' => explode(',', env('MCP_HTTP_INTEGRATED_MIDDLEWARE', 'web')),
9393
'domain' => env('MCP_HTTP_INTEGRATED_DOMAIN'),
@@ -118,24 +118,24 @@
118118
*/
119119
'capabilities' => [
120120
'tools' => [
121-
'enabled' => env('MCP_CAP_TOOLS_ENABLED', true),
122-
'listChanged' => env('MCP_CAP_TOOLS_LIST_CHANGED', true),
121+
'enabled' => (bool) env('MCP_CAP_TOOLS_ENABLED', true),
122+
'listChanged' => (bool) env('MCP_CAP_TOOLS_LIST_CHANGED', true),
123123
],
124124

125125
'resources' => [
126-
'enabled' => env('MCP_CAP_RESOURCES_ENABLED', true),
127-
'subscribe' => env('MCP_CAP_RESOURCES_SUBSCRIBE', true),
128-
'listChanged' => env('MCP_CAP_RESOURCES_LIST_CHANGED', true),
126+
'enabled' => (bool) env('MCP_CAP_RESOURCES_ENABLED', true),
127+
'subscribe' => (bool) env('MCP_CAP_RESOURCES_SUBSCRIBE', true),
128+
'listChanged' => (bool) env('MCP_CAP_RESOURCES_LIST_CHANGED', true),
129129
],
130130

131131
'prompts' => [
132-
'enabled' => env('MCP_CAP_PROMPTS_ENABLED', true),
133-
'listChanged' => env('MCP_CAP_PROMPTS_LIST_CHANGED', true),
132+
'enabled' => (bool) env('MCP_CAP_PROMPTS_ENABLED', true),
133+
'listChanged' => (bool) env('MCP_CAP_PROMPTS_LIST_CHANGED', true),
134134
],
135135

136136
'logging' => [
137-
'enabled' => env('MCP_CAP_LOGGING_ENABLED', true),
138-
'setLevel' => env('MCP_CAP_LOGGING_SET_LEVEL', false),
137+
'enabled' => (bool) env('MCP_CAP_LOGGING_ENABLED', true),
138+
'setLevel' => (bool) env('MCP_CAP_LOGGING_SET_LEVEL', false),
139139
],
140140
],
141141

0 commit comments

Comments
 (0)