@@ -26,6 +26,8 @@ public function testDefaultConfiguration()
2626 $ this ->assertSame ('0.0.1 ' , $ container ->getParameter ('mcp.version ' ));
2727 $ this ->assertSame (50 , $ container ->getParameter ('mcp.pagination_limit ' ));
2828 $ this ->assertNull ($ container ->getParameter ('mcp.instructions ' ));
29+ $ this ->assertSame (['src ' ], $ container ->getParameter ('mcp.discovery.scan_dirs ' ));
30+ $ this ->assertSame ([], $ container ->getParameter ('mcp.discovery.exclude_dirs ' ));
2931 }
3032
3133 public function testCustomConfiguration ()
@@ -296,6 +298,57 @@ public function testSessionStoreFileConfiguration()
296298 $ this ->assertSame (1800 , $ arguments [1 ]); // Custom TTL
297299 }
298300
301+ public function testDiscoveryDefaultConfiguration ()
302+ {
303+ $ container = $ this ->buildContainer ([]);
304+
305+ $ this ->assertSame (['src ' ], $ container ->getParameter ('mcp.discovery.scan_dirs ' ));
306+ $ this ->assertSame ([], $ container ->getParameter ('mcp.discovery.exclude_dirs ' ));
307+
308+ // Verify the builder service uses the correct parameters
309+ $ builderDefinition = $ container ->getDefinition ('mcp.server.builder ' );
310+ $ methodCalls = $ builderDefinition ->getMethodCalls ();
311+
312+ $ setDiscoveryCall = null ;
313+ foreach ($ methodCalls as $ call ) {
314+ if ('setDiscovery ' === $ call [0 ]) {
315+ $ setDiscoveryCall = $ call ;
316+ break ;
317+ }
318+ }
319+
320+ $ this ->assertNotNull ($ setDiscoveryCall , 'ServerBuilder should have setDiscovery method call ' );
321+ }
322+
323+ public function testDiscoveryCustomConfiguration ()
324+ {
325+ $ container = $ this ->buildContainer ([
326+ 'mcp ' => [
327+ 'discovery ' => [
328+ 'scan_dirs ' => ['src ' , 'lib ' , 'modules ' ],
329+ 'exclude_dirs ' => ['src/DataFixtures ' , 'tests ' ],
330+ ],
331+ ],
332+ ]);
333+
334+ $ this ->assertSame (['src ' , 'lib ' , 'modules ' ], $ container ->getParameter ('mcp.discovery.scan_dirs ' ));
335+ $ this ->assertSame (['src/DataFixtures ' , 'tests ' ], $ container ->getParameter ('mcp.discovery.exclude_dirs ' ));
336+ }
337+
338+ public function testDiscoveryWithExcludeDirsOnly ()
339+ {
340+ $ container = $ this ->buildContainer ([
341+ 'mcp ' => [
342+ 'discovery ' => [
343+ 'exclude_dirs ' => ['src/DataFixtures ' ],
344+ ],
345+ ],
346+ ]);
347+
348+ $ this ->assertSame (['src ' ], $ container ->getParameter ('mcp.discovery.scan_dirs ' ));
349+ $ this ->assertSame (['src/DataFixtures ' ], $ container ->getParameter ('mcp.discovery.exclude_dirs ' ));
350+ }
351+
299352 private function buildContainer (array $ configuration ): ContainerBuilder
300353 {
301354 $ container = new ContainerBuilder ();
0 commit comments