refactor(mcp): extract order services into independent project

Remove Kingdee sync, business CLI/MCP tools, and internal order-query routing
now owned by the separate kingdee-orders-mcp project. Keep Wiki retrieval,
file assets and ingest available in code while its deployed service is off.
Retain legacy response fields with business access disabled, and document
migration ownership and rollback without exposing credentials or data.

Validation: 174 Wiki tests pass. Independent order service verified with
36 template parity checks, authenticated HTTP queries, and a real sync.
This commit is contained in:
Codex
2026-10-31 07:41:18 +00:00
parent 6c451c3eb6
commit 2396bd2d3e
25 changed files with 47 additions and 5793 deletions
+3 -13
View File
@@ -53,8 +53,7 @@ DEFAULT_RUNTIME_CLEANUP_DAYS = 30
TOOL_FILE_ASSETS = "file-assets"
TOOL_INGEST = "ingest"
TOOL_QUERY = "query"
TOOL_BUSINESS = "business"
AVAILABLE_TOOL_GROUPS = (TOOL_FILE_ASSETS, TOOL_INGEST, TOOL_QUERY, TOOL_BUSINESS)
AVAILABLE_TOOL_GROUPS = (TOOL_FILE_ASSETS, TOOL_INGEST, TOOL_QUERY)
DEFAULT_ENABLED_TOOLS = (TOOL_FILE_ASSETS,)
TERMINAL_JOB_STATES = {"succeeded", "failed", "cancelled"}
PROXY_ENV_NAMES = ("http_proxy", "https_proxy", "all_proxy", "no_proxy", "HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "NO_PROXY")
@@ -72,8 +71,6 @@ def normalize_tool_name(name: str) -> str:
"upload": TOOL_INGEST,
"uploads": TOOL_INGEST,
"opencode-ingest": TOOL_INGEST,
"business": TOOL_BUSINESS,
"orders": TOOL_BUSINESS,
"query": TOOL_QUERY,
"wiki-query": TOOL_QUERY,
"ask": TOOL_QUERY,
@@ -645,18 +642,12 @@ def render_remote_config(
"Remote agents should upload with create_ingest_upload_ticket and X-Obsidian-Wiki-Upload-Token.\n"
"Bearer upload is for local/admin use. POST multipart/form-data with one or more `files` fields.\n"
)
business_section = ""
if enabled_tools is not None and TOOL_BUSINESS in normalize_enabled_tools(enabled_tools):
business_section = (
"\nBusiness query tools (direct SQLite, no OpenCode):\n"
"Use get_business_schema, query_business_template, execute_business_sql, and get_business_status.\n"
)
query_section = ""
if enabled_tools is not None and TOOL_QUERY in normalize_enabled_tools(enabled_tools):
query_section = (
"\n"
"Wiki query tools:\n"
"Use ask_wiki for ordinary wiki, business facts, or hybrid questions.\n"
"Use ask_wiki for wiki questions.\n"
"For long-running jobs, use start_wiki_query, get_wiki_query_status, "
"get_wiki_query_result, cancel_wiki_query, and check_query_opencode_readiness.\n"
)
@@ -670,7 +661,6 @@ def render_remote_config(
f"{enabled_section}"
f"{ingest_upload_section}"
f"{query_section}"
f"{business_section}"
"\n"
"Use this header:\n"
f"Authorization: Bearer {token}\n"
@@ -1278,7 +1268,7 @@ def main(argv: Sequence[str] | None = None) -> int:
tools_disable_parser.add_argument("tool", choices=AVAILABLE_TOOL_GROUPS)
tools_disable_parser.add_argument("--project-root", default=Path(__file__).resolve().parent.parent, type=Path)
tools_set_parser = tools_subparsers.add_parser("set", help="Replace enabled groups and restart once; e.g. tools set business.")
tools_set_parser = tools_subparsers.add_parser("set", help="Replace enabled groups and restart once; e.g. tools set file-assets.")
tools_set_parser.add_argument("tools", nargs="+", choices=AVAILABLE_TOOL_GROUPS)
tools_set_parser.add_argument("--project-root", default=Path(__file__).resolve().parent.parent, type=Path)