Fix project attach reload before MCP discovery

This commit is contained in:
HumbleTurtle
2026-07-30 19:57:47 -03:00
parent 5f864eab06
commit ffd31cf568
2 changed files with 28 additions and 1 deletions
+11 -1
View File
@@ -7375,9 +7375,19 @@ def chmod_best_effort(path, mode):
def resolve_project_id(args):
# Project-scoped tools resolve their target before issuing an HTTP
# request. Reload auth here as well as in request_json so a long-running
# MCP worker observes `nap project attach` even when it started before a
# project was selected.
if AUTH_PATH.exists() or not DEFAULT_PROJECT_ID:
refresh_public_auth_state()
project_id = DEFAULT_PROJECT_ID
if not project_id:
raise RuntimeError("No project configured. Run nap project create or call nap_project_create first.")
raise SafeToolError(
"project_not_configured",
"No project is selected in this directory. Run `nap project attach` "
"for an existing project or `nap project create` for a new one.",
)
return project_id