|
31 | 31 |
|
32 | 32 | from vectorcode.cli_utils import ( |
33 | 33 | Config, |
34 | | - LockManager, |
35 | 34 | SpecResolver, |
36 | 35 | config_logging, |
37 | 36 | expand_globs, |
|
40 | 39 | get_project_config, |
41 | 40 | load_config_file, |
42 | 41 | ) |
43 | | -from vectorcode.common import ( |
44 | | - ClientManager, |
45 | | -) |
46 | 42 | from vectorcode.subcommands.prompt import prompt_by_categories |
47 | 43 | from vectorcode.subcommands.query import ( |
48 | 44 | _prepare_formatted_result, |
|
51 | 47 | ) |
52 | 48 |
|
53 | 49 | logger = logging.getLogger(name=__name__) |
54 | | -locks = LockManager() |
55 | 50 |
|
56 | 51 |
|
57 | 52 | @dataclass |
@@ -246,24 +241,11 @@ async def mcp_server(): |
246 | 241 | default_project_root = project_root |
247 | 242 | default_config = await get_project_config(project_root) |
248 | 243 | default_config.project_root = project_root |
249 | | - async with ClientManager().get_client(default_config) as client: |
250 | | - logger.info("Collection initialised for %s.", project_root) |
251 | | - |
252 | | - if client is None: |
253 | | - if mcp_config.ls_on_start: # pragma: nocover |
254 | | - logger.warning( |
255 | | - "Failed to initialise a chromadb client. Ignoring --ls-on-start flag." |
256 | | - ) |
257 | | - else: |
258 | | - if mcp_config.ls_on_start: |
259 | | - logger.info( |
260 | | - "Adding available collections to the server instructions." |
261 | | - ) |
262 | | - default_instructions += ( |
263 | | - "\nYou have access to the following collections:\n" |
264 | | - ) |
265 | | - for name in await list_collections(): |
266 | | - default_instructions += f"<collection>{name}</collection>" |
| 244 | + if mcp_config.ls_on_start: |
| 245 | + logger.info("Adding available collections to the server instructions.") |
| 246 | + default_instructions += "\nYou have access to the following collections:\n" |
| 247 | + for name in await list_collections(): |
| 248 | + default_instructions += f"<collection>{name}</collection>" |
267 | 249 |
|
268 | 250 | mcp = FastMCP("VectorCode", instructions=default_instructions) |
269 | 251 | mcp.add_tool( |
@@ -316,7 +298,6 @@ async def run_server(): # pragma: nocover |
316 | 298 | mcp = await mcp_server() |
317 | 299 | await mcp.run_stdio_async() |
318 | 300 | finally: |
319 | | - await ClientManager().kill_servers() |
320 | 301 | return 0 |
321 | 302 |
|
322 | 303 |
|
|
0 commit comments