fix(mcp): remove secrets_find/add/update aliases; align docs and repair script
Some checks failed
Secrets v3 CI / 检查 (push) Failing after 2m16s
Some checks failed
Secrets v3 CI / 检查 (push) Failing after 2m16s
This commit is contained in:
@@ -7,7 +7,7 @@ CSV format:
|
||||
019d...,api_key,sk-xxxx
|
||||
019d...,password,hunter2
|
||||
|
||||
The script groups rows by entry_id, then calls `secrets_update` with `secrets_obj`
|
||||
The script groups rows by entry_id, then calls `secrets_entry_update` with `secrets_obj`
|
||||
so the server re-encrypts the provided plaintext values with the current key.
|
||||
|
||||
Warnings:
|
||||
@@ -34,7 +34,7 @@ REQUIRED_COLUMNS = {"entry_id", "secret_name", "secret_value"}
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Repair secret ciphertexts by re-submitting plaintext via secrets_update."
|
||||
description="Repair secret ciphertexts by re-submitting plaintext via secrets_entry_update."
|
||||
)
|
||||
parser.add_argument(
|
||||
"--csv",
|
||||
@@ -225,7 +225,7 @@ def load_entry_index(
|
||||
"id": 999_001,
|
||||
"method": "tools/call",
|
||||
"params": {
|
||||
"name": "secrets_find",
|
||||
"name": "secrets_entry_find",
|
||||
"arguments": {
|
||||
"limit": 1000,
|
||||
},
|
||||
@@ -240,14 +240,14 @@ def load_entry_index(
|
||||
last = items[-1] if items else {"raw": body[:1000]}
|
||||
if status != 200:
|
||||
raise RuntimeError(
|
||||
f"secrets_find failed: status={status}, body={body[:500]}"
|
||||
f"secrets_entry_find failed: status={status}, body={body[:500]}"
|
||||
)
|
||||
if "error" in last:
|
||||
raise RuntimeError(f"secrets_find returned error: {last}")
|
||||
raise RuntimeError(f"secrets_entry_find returned error: {last}")
|
||||
|
||||
content = last.get("result", {}).get("content", [])
|
||||
if not content:
|
||||
raise RuntimeError("secrets_find returned no content")
|
||||
raise RuntimeError("secrets_entry_find returned no content")
|
||||
payload = json.loads(content[0]["text"])
|
||||
|
||||
index: dict[str, tuple[str, str]] = {}
|
||||
@@ -260,7 +260,7 @@ def load_entry_index(
|
||||
return index
|
||||
|
||||
|
||||
def call_secrets_update(
|
||||
def call_secrets_entry_update(
|
||||
url: str,
|
||||
auth: str,
|
||||
encryption_key: str,
|
||||
@@ -277,7 +277,7 @@ def call_secrets_update(
|
||||
"id": request_id,
|
||||
"method": "tools/call",
|
||||
"params": {
|
||||
"name": "secrets_update",
|
||||
"name": "secrets_entry_update",
|
||||
"arguments": {
|
||||
"id": entry_id,
|
||||
"name": entry_name,
|
||||
@@ -296,7 +296,7 @@ def call_secrets_update(
|
||||
last = items[-1] if items else {"raw": body[:1000]}
|
||||
if status != 200:
|
||||
raise RuntimeError(
|
||||
f"secrets_update failed for {entry_id}: status={status}, body={body[:500]}"
|
||||
f"secrets_entry_update failed for {entry_id}: status={status}, body={body[:500]}"
|
||||
)
|
||||
return last
|
||||
|
||||
@@ -339,10 +339,10 @@ def main() -> int:
|
||||
try:
|
||||
if entry_id not in entry_index:
|
||||
raise RuntimeError(
|
||||
f"entry id not found in secrets_find results: {entry_id}"
|
||||
f"entry id not found in secrets_entry_find results: {entry_id}"
|
||||
)
|
||||
entry_name, entry_folder = entry_index[entry_id]
|
||||
result = call_secrets_update(
|
||||
result = call_secrets_entry_update(
|
||||
url,
|
||||
auth,
|
||||
encryption_key,
|
||||
|
||||
Reference in New Issue
Block a user