| 1593 | }; |
| 1594 | |
| 1595 | cbm_mcp_server_t *cbm_mcp_server_new(const char *store_path) { |
| 1596 | cbm_mcp_server_t *srv = calloc(CBM_ALLOC_ONE, sizeof(*srv)); |
| 1597 | if (!srv) { |
| 1598 | return NULL; |
| 1599 | } |
| 1600 | cbm_mutex_init(&srv->request_scope_mutex); |
| 1601 | atomic_init(&srv->pipeline_cancel_requested, 0); |
| 1602 | |
| 1603 | /* If a store_path is given, open that project directly. |
| 1604 | * Otherwise, create an in-memory store for test/embedded use. */ |
| 1605 | if (store_path) { |
| 1606 | srv->store = cbm_store_open(store_path); |
| 1607 | srv->current_project = heap_strdup(store_path); |
| 1608 | } else { |
| 1609 | srv->store = cbm_store_open_memory(); |
| 1610 | } |
| 1611 | srv->owns_store = true; |
| 1612 | srv->tool_profile = CBM_MCP_TOOL_PROFILE_ALL; |
| 1613 | srv->background_tasks = true; |
| 1614 | |
| 1615 | return srv; |
| 1616 | } |
| 1617 | |
| 1618 | void cbm_mcp_server_set_tool_profile(cbm_mcp_server_t *srv, cbm_mcp_tool_profile_t profile) { |
| 1619 | if (srv) { |