SMEDC MCP
Use SMEDC only through its official remote MCP launcher. This skill is the
current-user installation and recovery runbook for an employee-owned agent; it is not a
service-operations runbook.
The approved service origin is https://api.smedatacenter.xyz. The approved launcher is
the exact npm package smedc-mcp-launcher@0.5.0. Do not substitute another
origin, package, tag, or version. In particular, never install npm latest and never let
the launcher update itself. This pin governs launcher installation, not fetching a newer official
copy of this skill; after a skill refresh, read the newly verified copy for its current pin.
Update This Skill
The canonical skill name is smedc-mcp; smedc-mcp-skill is its repository
name and a recognized user-facing alias. “帮我更新 smedc-mcp-skill 这个 skill” means
refresh this skill's files from its official source. The request authorizes that local update;
do not ask which kind of update the employee means when they explicitly name the skill.
Official source: YinXiaoyu-1998/smedc-mcp-skill,
directory skills/smedc-mcp/, latest commit on the repository's default branch
(currently main). A marketplace listing, SMEDC login, MCP connection, and an approved
new launcher pin in the old installed skill are not prerequisites for refreshing the skill.
Use ordinary Git/HTTPS and local file tools for this maintenance task.
Follow the skill update procedure for source retrieval, backup,
complete-directory replacement, verification, and host reload. A skill-only update does not
authorize a launcher upgrade. For an authorized launcher update, first refresh this skill if its
pin is older than the server recommendation, then follow Official Install Or Update using the
newly verified exact pin. Never derive a new approved pin from server metadata alone.
Optional Companion Skills
Companion skills are independently maintained workflows that use SMEDC MCP data. They
are not bundled with this core skill and are not required for ordinary SMEDC work. This
skill continues to own launcher installation, authentication, uploads, and authorization-safe data
access; a companion owns its business-specific analysis and deliverables.
smedc-business-analysis
generates organization-backed operating diagnoses, weekly reports, and monthly reports. When the
employee asks for one of those deliverables and the companion is installed, use it together with
this skill instead of creating the report here.
smedc-delivery-ledger
renders the standard delivery-ledger table, exports the approved CSV, and guides receipt-linked
quarantine-certificate photo operations. When the employee asks for those ledger deliverables and
the companion is installed, use it together with this skill instead of recreating ledger-specific
presentation logic here.
- If the matching companion is not installed, explain that it is optional, identify its official
source, and offer to install it. Install it only when the employee explicitly authorizes its
installation or has already requested that named companion or all recommended companions.
Never install it silently during a core-skill install, update, login, upload, or query request.
- Updating this skill does not update a companion, and updating a companion does not change this
skill or the launcher pin. Follow each repository's own update guidance.
Do not copy companion-specific report logic, dataset transformations, or business conclusions into
this base skill. Keep the core boundary below and route only the matching employee request.
Hard Boundaries
- The employee enters an account password only in the SMEDC browser page. Never ask
for, accept, read, store, paste, or transmit an email/password, access token, durable
credential, authorization code, raw
Authorization header, or credential-store record.
- For SMEDC service access, use only launcher configuration and tools. Do not call
SMEDC API endpoints directly and do not operate its API, database, Qdrant, storage,
Docker, worker, cloud resources, or deployment.
- Do not create reports, dashboards, or final business conclusions. Return only tool-visible
records, statuses, and evidence within the employee's backend-authorized scope.
- Do not provide an organization ID. The service derives organization and confidentiality access
from the authenticated Employee Account; never infer hidden data from a forbidden/not-found result.
- The launcher stores its durable credential only in the operating-system secure store. Never
put credentials in configuration, environment variables, arguments, ordinary files, logs, or
chat.
Tool Discovery
The launcher is a standard stdio MCP server. When the invoking host is configured correctly,
its SMEDC tools appear in the host's native MCP tool list; the agent does not need to
discover them by hand.
- Never hand-craft JSON-RPC (
initialize, ping, tools/list, tools/call) against the
launcher process. Use the host's MCP integration and its tool list.
- The launcher registers the complete MCP tool contracts bundled into its published package.
It does not safely invent contracts for service tools added later. Discover the available tools
from the connected host; if the server requires a tool absent from that list, update to the exact
launcher version approved by this skill before retrying.
- Call
list_structured_datasets before using any structured dataset; use dish_catalog,
delivery_ledger, or supplier_catalog only when discovery advertises it and its fields.
- In structured dataset discovery,
canonicalName is the queryable field name. sourceColumn and
aliases are not accepted directly by query_structured_dataset; use them to map the user's
wording or source-table headers to canonicalName, and to choose friendly table headers when
presenting results.
- Discovery also advertises each field's operators and capabilities. A field can be present
without supporting every structured-query role; use only fields whose registry capabilities allow
the intended filtering, sorting, grouping, or aggregation.
- Use
describe_structured_dataset_coverage when the employee needs to know which uploaded
structured sources are currently readable for a dataset before deciding whether a query is scoped
enough. Treat coverage as source facts only, not a service-side completeness judgment.
- Discovery metadata is not an upload template. Do not rewrite, reshape, normalize, rename
headers, duplicate receipt metadata into item rows, or generate a replacement CSV/XLSX to make a
file match registry fields unless the employee explicitly asks for a separate local conversion
task.
- If SMEDC tools are not visible: run the pinned launcher's credential-free self-check
(see Official Install Or Update), verify the invoking agent's MCP entry (
codex mcp list /
codex mcp get smedc or the host equivalent), reload or restart the host, then
recheck its tool list. Only if the entry is missing or the self-check fails, follow the focused
recovery below. Do not debug the launcher protocol or service internals.
- If a self-check reports
recommendedUpdateAvailable: true (the server recommends a launcher
version newer than the installed one), tell the employee a newer launcher is recommended and
offer to update. If that update is already requested, proceed without asking again. Refresh
stale skill guidance through Update This Skill before choosing the approved exact launcher
version. Follow Official Install Or Update; never update silently in the background.
Request Limits
Keep tool input within the public service contract:
- ordinary upload content is at most 50 MiB after Base64 decoding.
business and dishes are the
exception: path-mode multipart upload streams one original CSV/XLSX up to the current 2 GiB
service limit without placing file bytes in the MCP argument. A basename-only filename is at
most 255 characters;
- an evidence title is at most 512 characters and
sourceSystem is at most 255 characters;
- structured
enterpriseName and idempotencyKey are each at most 255 characters;
- receipt IDs and quarantine-certificate
idempotencyKey values are each at most 255 characters;
confidentialityLevel, when supplied, is an integer from 0 through 3; omit it to use the
service default of 0;
- an evidence question is at most 4,000 characters; each evidence filter ID is at most 64
characters, with at most 100 IDs in each filter group;
- an opaque cursor is at most 4,096 characters, and each structured-query string filter value is
at most 32,767 characters.
- a structured query returns at most 200 rows or aggregate groups per page, with up to 50 selected
fields, 2 sort fields, 4 group-by fields, 12 explicit aggregates, 20 filter conditions, 100
in
values, and boolean nesting depth 3.
If a tool rejects an input at one of these boundaries, report the validation error and ask the
employee to shorten the text, reduce filters, or provide a corrected source. Never manually split
business or dishes; the service validates and partitions the original file atomically. Never
split dish_catalog: keep one complete snapshot and ask the employee to remove unrelated
sheets/columns outside the catalog schema, use a service-supported larger limit, or seek operator
help. Never silently truncate a title, key,
query, cursor, filter value, or file.
Prefer file.encoding:"path" uploads with the file's absolute local path so the launcher reads the
file locally and the model never emits payload bytes. Inline file.encoding:"base64" remains
subject to the ordinary 50 MiB service ceiling and much smaller host tool-argument caps. For
business and dishes, path mode is required for the multipart flow described below.
Upload Completion And Status Polling
Treat every text/evidence or row-query structured-table upload response with HTTP 202 as accepted
for background processing, not as a completed upload. Keep the returned documentId; for a
row-query structured upload also keep importBatchId. Poll get_evidence_document_status or
get_import_status after
2 seconds, then 5 seconds, then 10 seconds, then every 15 seconds, for at most 10 minutes.
- Tell the employee an upload succeeded only after its terminal success state: evidence is
active/ready; a structured import is importBatch.status=applied (with the returned document
and processing views complete). Never call a queued/pending response successful.
- On terminal
rejected or failed, summarize only safe tool-returned errors and give correction
advice, usually by asking the employee for a corrected source file or metadata. Do not silently
rewrite and re-upload the file yourself. Never expose internal exceptions, stacks, credentials,
or infrastructure details.
- At 10 minutes with no terminal state, report still processing, include the Document and
ImportBatch IDs when present, and say the employee can check later with the corresponding status
tool. This is not a failure.
- Do not re-upload instead of polling. Upload retries must follow idempotency rules: reuse a
structured idempotency key only for the exact same file bytes and metadata; use a new key only
after the employee intentionally corrects or changes the upload.
For business and dishes, keep partitionImportJobId and poll
get_partition_import_status. For a source file larger than 50 MiB, check first after 2 minutes,
then every 2 minutes, for at most 20 minutes; this replaces the ordinary polling schedule above.
Tell the employee once that large-file processing may take 10–20 minutes, then use a passive wait
when the host provides one. Do not narrate unchanged queued or processing states between
checks. For a source file at or below 50 MiB, use the ordinary polling schedule above.
published is the only success state;
rejected, failed, cancelled, and expired are terminal non-success states. A queued or
processing response is not complete. Exact-repeat uploads may return the existing published job;
same-key requests with different bytes or metadata are conflicts, not retries.
Business And Dishes Partition Uploads
business and dishes use an atomic source-to-partitions workflow. Upload the employee's original
CSV/XLSX exactly once with upload_structured_dataset; do not inspect row count to decide whether
to split, rewrite, convert, or Base64-encode it.
- Use
file.encoding:"path" with an absolute path, dataset, enterpriseName, inclusive
startDate and endDate in YYYYMMDD, and a stable idempotencyKey. Optionally supply
confidentialityLevel; otherwise the service uses 0.
- The launcher streams the file through bounded multipart upload. The source may be up to the
service's current 2 GiB limit; the model and MCP request never contain the file bytes or storage
upload URLs.
- The service validates the complete source and publishes all daily store partitions atomically.
If any row or partition fails, nothing from that source replaces live data. On success, matching
organization + enterprise + dataset + store + date partitions replace prior content, including
its confidentiality level.
- Keep
partitionImportJobId and follow the partition status polling rules above. Do not query or
download from a job until its status is published.
query_structured_dataset is not available for these datasets and returns
DATASET_REQUIRES_PARTITION_EXTRACT. Use describe_structured_dataset_coverage, then call
download_structured_partitions with dataset, the exact coverage enterpriseName, inclusive
startDate/endDate in YYYYMMDD, and optional merchant IDs in storeIds.
- The launcher consumes presigned links internally, verifies each CSV, and returns
localDirectory, dataset/window metadata, counts, and local file names. Never expose or request
presigned links. The calling analysis workflow owns the returned scratch directory and must
delete that exact directory in finally; it must not delete broader temp or report directories.
Dish Catalog Snapshot Uploads
Use this path only when list_structured_datasets reports dish_catalog as available. It is a
complete, append-only menu snapshot rather than a sales/business date-window dataset.
- Call
upload_structured_dataset with dataset: "dish_catalog", snapshotDate: "YYYYMMDD",
enterpriseName, a stable idempotencyKey, and the CSV/XLSX file. Optionally include an
explicit confidentialityLevel; otherwise it is 0. Do not include startDate or endDate.
- Treat the uploaded file as the full directory for that date. Do not split it into CSV parts,
upload only changed rows, use the service to merge it with another file, or describe a partial
file as a complete catalog.
- The service validates catalog headers, sheets, and row values after upload. If validation rejects
the upload, summarize the safe returned errors and ask for a corrected source file or explicit
local-conversion instruction; do not pre-normalize or regenerate the catalog file from registry
metadata.
- The organization can upload historical snapshots out of date order, but only one non-archived
snapshot may occupy a date. For a same-date correction with different content, the existing
snapshot must be archived through the authorized maintenance path before a new upload. Uploading
a newer snapshot does not archive or replace older history.
- After
importBatch.status=applied, query catalog rows through the discovery-reported
snapshot_date field. Do not infer a current/latest menu, a diff, or added, removed,
discontinued, or other cross-snapshot status.
Delivery Ledgers And Supplier Catalogs
For delivery_ledger and supplier_catalog, call upload_structured_dataset with file,
enterpriseName and idempotencyKey. Optionally include an explicit confidentialityLevel.
Do not send startDate, endDate,
or snapshotDate.
delivery_ledger accepts one complete CSV/XLSX delivery receipt per file. The receipt ID
and date are extracted by the service, and each item row becomes one ledger row. Upload the
original receipt file as provided, even when receipt-level fields appear in header rows rather
than in the item table. Do not generate a normalized CSV with repeated receipt metadata. The
normalized receipt ID is the organization-scoped natural idempotency key, so different content
for the same receipt is a conflict rather than an overwrite.
- For delivery-ledger queries, use the
list_structured_datasets registry's canonicalName,
sourceColumn, and aliases instead of guessing English field names. Paper-ledger terms such as
进货数量, 进货金额, and 供货单位名称 are aliases for the matching fields; resolve them to
purchase_quantity, purchase_amount, and supplier_name before querying.
supplier_catalog is the current supplier snapshot used for delivery-ledger enrichment. Upload
the provided supplier catalog file as-is; do not rewrite it locally to match registry metadata.
The service validates required and optional columns after upload. The latest successfully applied
snapshot is current; older history is not a fallback, and an in-progress, failed, or rejected
upload cannot replace it.
- Keep the returned
importBatchId and poll get_import_status until
importBatch.status=applied before querying. A queued or pending response is not success.
- In delivery detail queries,
supplier_contact_phone and supplier_unit_address are selectable
dynamic fields only; they cannot filter, sort, group, or aggregate. They may be null when no
current catalog is available or visible, no exact match exists, the source value is blank, or the
supplier name is ambiguous. Enrichment never changes the authorized ledger page or falls back to
an older catalog.
- Select
source_document_id on detail-row structured queries when the employee needs the
original uploaded receipt file. This field is not returned by default and cannot filter, sort,
group, or aggregate.
Quarantine Certificates And Source Downloads
Use quarantine-certificate tools only for animal quarantine certificate images that should be
linked to delivery-ledger receipt IDs. The service does not inspect whether the photo actually
looks like a certificate.
- Upload with
upload_quarantine_certificate: provide one JPG/JPEG/PNG file, one receiptId, and
one stable idempotencyKey. Optionally include an explicit confidentialityLevel; otherwise it
is 0. Use file.encoding:"path" when possible. If the employee gives several photos for the
same receipt, call the tool once per photo.
receiptId is the public business key for both delivery ledgers and certificates. The service
trims and uppercases it. Do not call it receiptNumber, do not treat it as a count, and do not
require the corresponding delivery ledger to already exist.
- Query with
query_quarantine_certificates using explicit receiptIds only. It returns one group
per requested receipt ID, each with zero or more certificates. An empty group means no visible
matching certificate; do not infer whether a hidden one exists.
- Archive with
archive_quarantine_certificates. Use sourceDocumentId for a single visible
certificate. Only admins may archive by receiptId, which archives all visible certificates
under that receipt ID.
- For downloading originals, call
get_source_document_download_url with a visible
sourceDocumentId. The result is a 24-hour attachment link; return the link to the employee
rather than fetching or proxying the file bytes yourself.
Official Install Or Update
An employee may ask in natural language to install, update, or repair SMEDC. The
employee does not need to run these commands personally. Agents should also offer an update when
a self-check reports recommendedUpdateAvailable: true (see Tool Discovery). Work only for the
current OS user and only on the invoking agent's configuration.
Confirm the host is macOS or Windows and that the user authorizes this current-user install.
Run node --version and npm --version. Require Node.js major version 22 or newer and a
working npm. If Node.js is missing or older than 22, install or upgrade Node.js/npm for the
current user before continuing; do not use administrator privileges or alter unrelated tools.
Use the fixed platform directory:
| Platform |
Launcher directory |
| macOS |
~/Library/Application Support/SMEDC/launcher/versions/0.5.0/ |
| Windows |
%LOCALAPPDATA%\\SMEDC\\launcher\\versions\\0.5.0\\ |
Install or repair the exact package idempotently. Substitute only the platform directory
above; do not add credentials or a global install:
npm install --prefix "<launcher-directory>" --save-exact smedc-mcp-launcher@0.5.0
Preserve the existing installation if the same pinned package is already present. For an
approved update, install the newly approved exact version into its own versioned directory,
update the one launcher path in the invoking agent's MCP entry, then run the self-check.
Updating does not delete the secure-store session or unrelated MCP servers.
Run the installed launcher's credential-free self-check before changing or declaring an MCP
configuration healthy:
SMEDC_BASE_URL=https://api.smedatacenter.xyz \
"$HOME/Library/Application Support/SMEDC/launcher/versions/0.5.0/node_modules/.bin/smedc-mcp-launcher" self-check
$env:SMEDC_BASE_URL = "https://api.smedatacenter.xyz"
& "$env:LOCALAPPDATA\SMEDC\launcher\versions\0.5.0\node_modules\.bin\smedc-mcp-launcher.cmd" self-check
The stable self-check contract is safe machine-readable JSON with this shape:
{
"ok": true,
"launcherVersion": "0.5.0",
"serviceOrigin": "https://api.smedatacenter.xyz",
"platform": "<safe platform>",
"secureStore": {
"available": true,
"durableCredentialPresent": false
},
"server": {
"reachable": true,
"metadataCompatible": true,
"minimumLauncherVersion": "<safe version>",
"recommendedLauncherVersion": "<safe version>",
"recommendedUpdateAvailable": false
},
"mcp": {
"handshake": "ok"
}
}
mcp.handshake is ok, not_authenticated, or unavailable. Self-check never performs
browser login and never returns credential contents. If it reports a typed failure, follow the
focused recovery below; do not inspect secure storage or repair the remote service.
Use this exact stdio launch tuple after installation. SMEDC_BASE_URL is the only
launcher environment variable; do not add another environment value or any credential.
| Platform |
Command |
Arguments |
Environment |
| macOS |
~/Library/Application Support/SMEDC/launcher/versions/0.5.0/node_modules/.bin/smedc-mcp-launcher |
serve |
SMEDC_BASE_URL=https://api.smedatacenter.xyz |
| Windows |
%LOCALAPPDATA%\\SMEDC\\launcher\\versions\\0.5.0\\node_modules\\.bin\\smedc-mcp-launcher.cmd |
serve |
SMEDC_BASE_URL=https://api.smedatacenter.xyz |
The command, its single serve argument, and the one URL-only environment value are the complete
stdio configuration. It must never contain a password, token, header, client secret, or OAuth
setting.
Device-Code Login Flow
Starting with launcher 0.2.2, every login uses the OAuth Device Authorization Grant: the launcher
obtains a first-party SMEDC verification link, opens it automatically when a system
browser is available (desktop agents), or returns it for the agent to surface through the employee
channel (phone-remote-controlled and headless agents). The employee confirms the agent instance
name shown on the page, enters email/password, and the launcher completes sign-in by polling.
- The employee's only credential input remains email/password on the SMEDC page; never
ask for, read, or relay verification codes or tokens.
- On macOS/Windows the launcher keeps the durable session in Keychain/Credential Manager exactly as
before.
- On hosts without a secure store (headless Linux/VPS), the launcher keeps the session in memory
only; after a launcher or host restart, run the login tool again so the employee can tap a fresh
link.
- If a business tool reports
authentication_pending, tell the employee to complete the sign-in
link and retry the original request once; if it reports authentication_required, run
smedc_login to obtain a new link.
This flow is available in launcher 0.2.2 and later; this document pins launcher 0.5.0.
Configure The Invoking Agent
Always inspect the existing configuration first, create a timestamped backup before modifying it,
then make the smallest idempotent change: one smedc stdio MCP entry. Preserve every
unrelated server and setting. Do not configure a direct HTTP/OAuth SMEDC server because
the local launcher owns browser login and credential storage.
Codex
Use the verified Codex CLI MCP registry. On macOS, prefer codex from PATH; when it is absent,
use the bundled /Applications/ChatGPT.app/Contents/Resources/codex fallback. On Windows, resolve
codex.exe from PATH. Stop if neither verified binary exists.
Before the first mutation, inspect with codex mcp list --json and
codex mcp get smedc --json. Back up ~/.codex/config.toml (Windows:
%USERPROFILE%\.codex\config.toml) to a timestamped sibling file when it exists. If the existing
entry already matches the exact command, serve argument, and sole BASE_URL environment value, do
nothing.
For macOS add/repair:
CODEX_BIN="$(command -v codex 2>/dev/null || true)"
if [ -z "$CODEX_BIN" ] && [ -x "/Applications/ChatGPT.app/Contents/Resources/codex" ]; then
CODEX_BIN="/Applications/ChatGPT.app/Contents/Resources/codex"
fi
test -n "$CODEX_BIN"
CODEX_CONFIG="$HOME/.codex/config.toml"
if [ -f "$CODEX_CONFIG" ]; then
cp -p "$CODEX_CONFIG" "$CODEX_CONFIG.smedc.bak.$(date +%Y%m%d%H%M%S)"
fi
"$CODEX_BIN" mcp list --json
"$CODEX_BIN" mcp get smedc --json
If get reports the entry absent, add it. If it is present and exact, stop without mutation. Only
when it is present and mismatched, remove that one entry immediately before running the same add
command:
# Mismatched entry only:
"$CODEX_BIN" mcp remove smedc
# Missing or just-removed entry:
"$CODEX_BIN" mcp add \
--env SMEDC_BASE_URL=https://api.smedatacenter.xyz \
smedc -- \
"$HOME/Library/Application Support/SMEDC/launcher/versions/0.5.0/node_modules/.bin/smedc-mcp-launcher" serve
"$CODEX_BIN" mcp get smedc --json
For Windows PowerShell, use the same list/get/remove/add sequence:
$CodexBin = (Get-Command codex.exe -ErrorAction Stop).Source
$CodexConfig = Join-Path $env:USERPROFILE ".codex\config.toml"
if (Test-Path $CodexConfig) {
Copy-Item $CodexConfig "$CodexConfig.smedc.bak.$(Get-Date -Format yyyyMMddHHmmss)"
}
$LauncherBin = "$env:LOCALAPPDATA\SMEDC\launcher\versions\0.5.0\node_modules\.bin\smedc-mcp-launcher.cmd"
& $CodexBin mcp list --json
& $CodexBin mcp get smedc --json
If get reports the entry absent, add it. If it is present and exact, stop without mutation. Only
for a present mismatched entry, run:
# Mismatched entry only:
& $CodexBin mcp remove smedc
# Missing or just-removed entry:
& $CodexBin mcp add --env "SMEDC_BASE_URL=https://api.smedatacenter.xyz" smedc -- $LauncherBin serve
& $CodexBin mcp get smedc --json
After add/repair, run the platform self-check above, restart/reload Codex, run
codex mcp list --json and codex mcp get smedc --json, and confirm the discovered tools.
If add fails after removal, restore the timestamped backup and report the focused failure. For
per-agent removal, back up first, run codex mcp remove smedc, then verify
codex mcp list --json no longer contains it and codex mcp get smedc --json reports it
absent.
OpenClaw
Use OpenClaw's MCP CLI registry for a stdio launcher; do not use OpenClaw's direct remote
OAuth store, openclaw mcp login, or openclaw mcp logout for SMEDC.
Inspect first: openclaw mcp status --verbose and, when present,
openclaw mcp show smedc --json.
Back up the OpenClaw configuration using its supported current-user mechanism.
Add the entry with the platform-specific launcher path from the table, its single serve
argument, and the sole URL-only environment value. On macOS, the verified OpenClaw CLI form is:
openclaw mcp add smedc \
--command "$HOME/Library/Application Support/SMEDC/launcher/versions/0.5.0/node_modules/.bin/smedc-mcp-launcher" \
--arg serve \
--env SMEDC_BASE_URL=https://api.smedatacenter.xyz
If the entry already exists, use openclaw mcp set smedc '<one stdio JSON object>'
with exactly command, args: ["serve"], and the one SMEDC_BASE_URL environment
value. Do not add an HTTP URL or auth: oauth configuration.
Verify with openclaw mcp doctor smedc --probe. Reload or restart the owning
OpenClaw runtime when required by its current setup.
openclaw mcp add/set/doctor --probe are the supported configuration/proof path. The launcher,
not OpenClaw's OAuth store, opens the browser and manages the SMEDC secure session.
Other Agents
Use guarded adaptive discovery. Inspect the installed client's help, current configuration, and
MCP capabilities to confirm that it can start a local stdio server. Back up its configuration,
add only the pinned SMEDC launcher entry, validate its handshake, and preserve every
unrelated server. If its supported configuration mechanism is not clear, report the narrow blocker
instead of editing guessed files or configuring direct remote OAuth.
Browser Login And Normal Use
Call smedc_auth_status before beginning work when the authentication state is unknown.
If it reports authentication_required, call smedc_login. The launcher opens the
system browser; ask the employee to finish login there and never request any credential in chat.
The launcher returns only a safe outcome.
After successful login, retry the employee's original business tool call exactly once. Do not
retry repeatedly after browser cancellation or an unsuccessful login. Use
smedc_logout only when the employee asks to sign out. It clears the shared local
session for SMEDC under the current OS user, so all locally configured agents on that
OS user are signed out.
When the employee asks which SMEDC account is currently active, call the zero-input
smedc_get_current_user tool. Return its displayName, email, role, and clearance; do not infer
identity from launcher configuration or smedc_auth_status, and do not ask for an account
selector. The tool is self-scoped to the bearer-authenticated employee and never returns internal
IDs or credentials. Follow the normal authentication recovery above if login is required.
SMEDC Data Questions
When the employee asks about资料、SOP、上传过的文件、公司数据、SMEDC 里的表格, or what was
“刚上传/刚传进去/这份表”, answer through SMEDC MCP tools. Do not answer those questions by
reading a local attachment, local CSV/XLSX, previous chat text, cache, or filesystem copy unless
the employee explicitly asks you to inspect a local file outside SMEDC.
Local files are upload inputs only. After uploading a file, keep the returned service metadata
needed for follow-up questions: document id, import batch id, dataset id, declared confidentiality
level, declared business
date window or snapshotDate, enterprise/store name, and status. In a later task, rediscover
available datasets through MCP; if the intended uploaded table/document cannot be
identified safely, ask one short natural clarification instead of querying all visible history.
For structured-table questions:
- Call
list_structured_datasets before constructing a structured query unless you already have a
fresh compatible registry from the same MCP session.
- Resolve field wording through the registry before every structured query: match user-facing terms
against
sourceColumn/aliases, then send only canonicalName values in select, filters,
sorts, groups, and aggregates. Use sourceColumn or the matched alias as the displayed table
header when that is clearer for the employee.
- Respect registry capabilities for every field. Detail
select entries must be registered
canonical fields; filter, sort, group, and aggregate only with fields whose advertised
capabilities permit that use. Dynamic enrichment fields are selectable detail fields only unless
discovery says otherwise.
- Use explicit mechanical aggregates only:
count, countDistinct, sum, avg, min, max,
and weightedAvg. Group by at most four canonical fields and request at most twelve aggregate
outputs. Aggregate sort fields must be either a group-by field or a unique aggregate alias from
the same request.
- For
weightedAvg, both field and weightField must be numeric aggregatable canonical fields
in the same dataset. It represents SUM(field * weightField) / SUM(weightField) with a null
result when total weight is zero or missing; do not describe it as a service-generated business
conclusion.
- Select
source_document_id on detail-row queries when the employee needs the original uploaded
file behind a structured row, then pass it to get_source_document_download_url. This field is
not returned by default and is not for filters, sorting, grouping, or aggregates.
- Call
describe_structured_dataset_coverage before answering whether SMEDC has enough
readable applied data for a dataset, time window, snapshot, or source-file scope. Coverage shares
structured-query authorization and returns readable source windows or snapshots; decide and state
any sufficiency assumptions yourself.
- Scope follow-up questions about a recent upload to that upload's returned import metadata,
declared business-date window, enterprise/store name, or other explicit service-returned
metadata. Avoid broad unbounded queries for phrases like “这份表”, “刚才那张表”, or “我刚传的”.
- For
dish_catalog, scope queries with the discovery-reported snapshot_date field. Do not
infer latest/current catalog state, diffs, or row status across snapshots.
- If the employee asks about a local spreadsheet before it has been uploaded, offer to upload it
first. Do not compute final SMEDC answers directly from the local spreadsheet unless the
employee explicitly says they want a local-file-only inspection.
- If a query result contains historical rows outside the intended upload/window, narrow the query
or ask for clarification before presenting totals as “这份表”的 totals.
For authorized service tools:
- Default an upload to confidentiality level
0 when the employee does not explicitly provide a
level. Never infer or elevate the level from filenames, content, source context, or apparent
document lineage. If the employee explicitly supplies 0–3, pass it unchanged.
- Prefer
file.encoding:"path" uploads with the file's absolute local path; the launcher reads
exact bytes mechanically. Use file.encoding:"base64" only for small inline payloads. Do not
alter business content, schema, headers, or row meaning unless the employee explicitly asks for a
local file-conversion task before upload.
- Follow Upload Completion And Status Polling after every
202 upload; never start a worker.
- Quarantine-certificate uploads are synchronous
201 operations, not background imports. Call
upload_quarantine_certificate once per JPG/PNG image with exactly one receiptId, one
idempotency key, and declared confidentiality level. A receipt ID may have zero, one, or multiple
certificates; one certificate upload request contains only one image.
- Reuse a structured-import idempotency key only for the exact same file and metadata. Treat an
import-status 404 as "not visible or missing" and do not infer hidden metadata.
- Reuse a quarantine-certificate idempotency key only for the exact same image bytes, receipt ID,
and declared confidentiality level. Use
query_quarantine_certificates with explicit receiptIds; never try to
query all quarantine certificates. Use get_source_document_download_url with a returned
sourceDocumentId when the employee asks to download or view the original source file.
- Treat evidence cursors as opaque, short-lived continuations. Return
page.nextCursor unchanged
with the same query, filters, and limit. Restart without it on INVALID_CURSOR; on
CURSOR_EXPIRED, explain the expiry and restart only if the employee still wants more results.
smedc_list_skills exposes approved directory metadata only; do not execute an entry.
Local File Read Errors
When a path-mode upload fails because the launcher cannot read the file, report the typed error
and ask the employee, in the employee's language, to provide an accessible file. Do not fabricate
content, do not paste file contents into chat, and do not silently retry with an inline copy.
MCP_LOCAL_FILE_NOT_FOUND: the file does not exist at the given path.
MCP_LOCAL_FILE_PERMISSION_DENIED: the launcher cannot read the file (file permissions, macOS
privacy protection, sandbox, or another OS access boundary).
MCP_LOCAL_FILE_INVALID: the path is relative, a directory, or not a regular file.
MCP_LOCAL_FILE_TOO_LARGE: the file exceeds the applicable contract (2 GiB for path-mode
business/dishes; 50 MiB for ordinary uploads).
MCP_LOCAL_FILE_READ_FAILED: another read error.
Example employee-facing reply (Chinese):
您刚才提供的文件企业数据中枢没有足够权限读取,请把文件放到桌面/下载等可访问位置后重新提供,
或重新拖入文件。
For MCP_LOCAL_FILE_NOT_FOUND / MCP_LOCAL_FILE_INVALID, ask the employee to re-check the file
location or re-attach the file. For MCP_LOCAL_FILE_TOO_LARGE, do not split business, dishes,
or dish_catalog; ask the employee for a smaller complete export, a service-supported larger
limit, or operator help.
Typed Recovery
| Condition |
Required response |
authentication_required |
Call smedc_login, wait for browser completion, then retry the original business operation once. |
| Browser cancelled, timed out, or login failed |
Report the safe outcome. Do not reopen the browser automatically or retry the business operation. |
service_unavailable |
Report that the official service cannot be reached. Do not start, repair, or diagnose service infrastructure. |
forbidden or not-found |
Treat the resource as unavailable to this employee; do not infer hidden data. |
| `launcher_upgrade |
|
…(truncated)
1---2name: smedc-mcp3description: 上传和查询企业数据中枢(SMEDC)中的文件与资料:当员工要求把文件/文档/表格上传到 企业数据中枢、企业资料中枢、企业知识库或企业数据库,或想基于已上传的企业资料提问业务问题时使用。 用户要求更新 smedc-mcp 或 smedc-mcp-skill 这个 skill 时也使用本技能。 用户询问 SMEDC 的配套分析、报表或扩展 skill 时也使用本技能。 Also use when users ask about optional SMEDC analysis, reporting, or extension skills. Also covers updating this skill from its official GitHub source and installing, configuring, and authenticating the official SMEDC remote MCP launcher (api.smedatacenter.xyz); accesses SMEDC through the launcher only and never exposes employee credentials or service infrastructure.4---56# SMEDC MCP78Use SMEDC only through its official remote MCP launcher. This skill is the9current-user installation and recovery runbook for an employee-owned agent; it is not a10service-operations runbook.1112The approved service origin is `https://api.smedatacenter.xyz`. The approved launcher is13the exact npm package `smedc-mcp-launcher@0.5.0`. Do not substitute another14origin, package, tag, or version. In particular, never install npm `latest` and never let15the launcher update itself. This pin governs launcher installation, not fetching a newer official16copy of this skill; after a skill refresh, read the newly verified copy for its current pin.1718## Update This Skill1920The canonical skill name is `smedc-mcp`; `smedc-mcp-skill` is its repository21name and a recognized user-facing alias. “帮我更新 smedc-mcp-skill 这个 skill” means22refresh this skill's files from its official source. The request authorizes that local update;23do not ask which kind of update the employee means when they explicitly name the skill.2425Official source: [YinXiaoyu-1998/smedc-mcp-skill](https://github.com/YinXiaoyu-1998/smedc-mcp-skill),26directory `skills/smedc-mcp/`, latest commit on the repository's default branch27(currently `main`). A marketplace listing, SMEDC login, MCP connection, and an approved28new launcher pin in the old installed skill are not prerequisites for refreshing the skill.29Use ordinary Git/HTTPS and local file tools for this maintenance task.3031Follow [the skill update procedure](references/update-skill.md) for source retrieval, backup,32complete-directory replacement, verification, and host reload. A skill-only update does not33authorize a launcher upgrade. For an authorized launcher update, first refresh this skill if its34pin is older than the server recommendation, then follow Official Install Or Update using the35newly verified exact pin. Never derive a new approved pin from server metadata alone.3637## Optional Companion Skills3839Companion skills are independently maintained workflows that use SMEDC MCP data. They40are not bundled with this core skill and are not required for ordinary SMEDC work. This41skill continues to own launcher installation, authentication, uploads, and authorization-safe data42access; a companion owns its business-specific analysis and deliverables.4344- [`smedc-business-analysis`](https://github.com/YinXiaoyu-1998/smedc-companion-skills)45 generates organization-backed operating diagnoses, weekly reports, and monthly reports. When the46 employee asks for one of those deliverables and the companion is installed, use it together with47 this skill instead of creating the report here.48- [`smedc-delivery-ledger`](https://github.com/YinXiaoyu-1998/smedc-companion-skills)49 renders the standard delivery-ledger table, exports the approved CSV, and guides receipt-linked50 quarantine-certificate photo operations. When the employee asks for those ledger deliverables and51 the companion is installed, use it together with this skill instead of recreating ledger-specific52 presentation logic here.53- If the matching companion is not installed, explain that it is optional, identify its official54 source, and offer to install it. Install it only when the employee explicitly authorizes its55 installation or has already requested that named companion or all recommended companions.56 Never install it silently during a core-skill install, update, login, upload, or query request.57- Updating this skill does not update a companion, and updating a companion does not change this58 skill or the launcher pin. Follow each repository's own update guidance.5960Do not copy companion-specific report logic, dataset transformations, or business conclusions into61this base skill. Keep the core boundary below and route only the matching employee request.6263## Hard Boundaries6465- The employee enters an account password only in the SMEDC browser page. Never ask66 for, accept, read, store, paste, or transmit an email/password, access token, durable67 credential, authorization code, raw `Authorization` header, or credential-store record.68- For SMEDC service access, use only launcher configuration and tools. Do not call69 SMEDC API endpoints directly and do not operate its API, database, Qdrant, storage,70 Docker, worker, cloud resources, or deployment.71- Do not create reports, dashboards, or final business conclusions. Return only tool-visible72 records, statuses, and evidence within the employee's backend-authorized scope.73- Do not provide an organization ID. The service derives organization and confidentiality access74 from the authenticated Employee Account; never infer hidden data from a forbidden/not-found result.75- The launcher stores its durable credential only in the operating-system secure store. Never76 put credentials in configuration, environment variables, arguments, ordinary files, logs, or77 chat.7879## Tool Discovery8081The launcher is a standard stdio MCP server. When the invoking host is configured correctly,82its SMEDC tools appear in the host's native MCP tool list; the agent does not need to83discover them by hand.8485- Never hand-craft JSON-RPC (`initialize`, `ping`, `tools/list`, `tools/call`) against the86 launcher process. Use the host's MCP integration and its tool list.87- The launcher registers the complete MCP tool contracts bundled into its published package.88 It does not safely invent contracts for service tools added later. Discover the available tools89 from the connected host; if the server requires a tool absent from that list, update to the exact90 launcher version approved by this skill before retrying.91- Call `list_structured_datasets` before using any structured dataset; use `dish_catalog`,92 `delivery_ledger`, or `supplier_catalog` only when discovery advertises it and its fields.93- In structured dataset discovery, `canonicalName` is the queryable field name. `sourceColumn` and94 `aliases` are not accepted directly by `query_structured_dataset`; use them to map the user's95 wording or source-table headers to `canonicalName`, and to choose friendly table headers when96 presenting results.97- Discovery also advertises each field's operators and capabilities. A field can be present98 without supporting every structured-query role; use only fields whose registry capabilities allow99 the intended filtering, sorting, grouping, or aggregation.100- Use `describe_structured_dataset_coverage` when the employee needs to know which uploaded101 structured sources are currently readable for a dataset before deciding whether a query is scoped102 enough. Treat coverage as source facts only, not a service-side completeness judgment.103- Discovery metadata is not an upload template. Do not rewrite, reshape, normalize, rename104 headers, duplicate receipt metadata into item rows, or generate a replacement CSV/XLSX to make a105 file match registry fields unless the employee explicitly asks for a separate local conversion106 task.107- If SMEDC tools are not visible: run the pinned launcher's credential-free self-check108 (see Official Install Or Update), verify the invoking agent's MCP entry (`codex mcp list` /109 `codex mcp get smedc` or the host equivalent), reload or restart the host, then110 recheck its tool list. Only if the entry is missing or the self-check fails, follow the focused111 recovery below. Do not debug the launcher protocol or service internals.112- If a self-check reports `recommendedUpdateAvailable: true` (the server recommends a launcher113 version newer than the installed one), tell the employee a newer launcher is recommended and114 offer to update. If that update is already requested, proceed without asking again. Refresh115 stale skill guidance through Update This Skill before choosing the approved exact launcher116 version. Follow Official Install Or Update; never update silently in the background.117118## Request Limits119120Keep tool input within the public service contract:121122- ordinary upload content is at most 50 MiB after Base64 decoding. `business` and `dishes` are the123 exception: path-mode multipart upload streams one original CSV/XLSX up to the current 2 GiB124 service limit without placing file bytes in the MCP argument. A basename-only filename is at125 most 255 characters;126- an evidence title is at most 512 characters and `sourceSystem` is at most 255 characters;127- structured `enterpriseName` and `idempotencyKey` are each at most 255 characters;128- receipt IDs and quarantine-certificate `idempotencyKey` values are each at most 255 characters;129- `confidentialityLevel`, when supplied, is an integer from `0` through `3`; omit it to use the130 service default of `0`;131- an evidence question is at most 4,000 characters; each evidence filter ID is at most 64132 characters, with at most 100 IDs in each filter group;133- an opaque cursor is at most 4,096 characters, and each structured-query string filter value is134 at most 32,767 characters.135- a structured query returns at most 200 rows or aggregate groups per page, with up to 50 selected136 fields, 2 sort fields, 4 group-by fields, 12 explicit aggregates, 20 filter conditions, 100 `in`137 values, and boolean nesting depth 3.138139If a tool rejects an input at one of these boundaries, report the validation error and ask the140employee to shorten the text, reduce filters, or provide a corrected source. Never manually split141`business` or `dishes`; the service validates and partitions the original file atomically. Never142split `dish_catalog`: keep one complete snapshot and ask the employee to remove unrelated143sheets/columns outside the catalog schema, use a service-supported larger limit, or seek operator144help. Never silently truncate a title, key,145query, cursor, filter value, or file.146147Prefer `file.encoding:"path"` uploads with the file's absolute local path so the launcher reads the148file locally and the model never emits payload bytes. Inline `file.encoding:"base64"` remains149subject to the ordinary 50 MiB service ceiling and much smaller host tool-argument caps. For150`business` and `dishes`, path mode is required for the multipart flow described below.151152## Upload Completion And Status Polling153154Treat every text/evidence or row-query structured-table upload response with HTTP `202` as accepted155for background processing, not as a completed upload. Keep the returned `documentId`; for a156row-query structured upload also keep `importBatchId`. Poll `get_evidence_document_status` or157`get_import_status` after158**2 seconds, then 5 seconds, then 10 seconds, then every 15 seconds**, for at most **10 minutes**.159160- Tell the employee an upload succeeded only after its terminal success state: evidence is161 `active/ready`; a structured import is `importBatch.status=applied` (with the returned document162 and processing views complete). Never call a queued/pending response successful.163- On terminal `rejected` or `failed`, summarize only safe tool-returned errors and give correction164 advice, usually by asking the employee for a corrected source file or metadata. Do not silently165 rewrite and re-upload the file yourself. Never expose internal exceptions, stacks, credentials,166 or infrastructure details.167- At 10 minutes with no terminal state, report **still processing**, include the Document and168 ImportBatch IDs when present, and say the employee can check later with the corresponding status169 tool. This is not a failure.170- Do not re-upload instead of polling. Upload retries must follow idempotency rules: reuse a171 structured idempotency key only for the exact same file bytes and metadata; use a new key only172 after the employee intentionally corrects or changes the upload.173174For `business` and `dishes`, keep `partitionImportJobId` and poll175`get_partition_import_status`. For a source file larger than 50 MiB, check first after 2 minutes,176then every 2 minutes, for at most 20 minutes; this replaces the ordinary polling schedule above.177Tell the employee once that large-file processing may take 10–20 minutes, then use a passive wait178when the host provides one. Do not narrate unchanged `queued` or `processing` states between179checks. For a source file at or below 50 MiB, use the ordinary polling schedule above.180`published` is the only success state;181`rejected`, `failed`, `cancelled`, and `expired` are terminal non-success states. A `queued` or182`processing` response is not complete. Exact-repeat uploads may return the existing published job;183same-key requests with different bytes or metadata are conflicts, not retries.184185## Business And Dishes Partition Uploads186187`business` and `dishes` use an atomic source-to-partitions workflow. Upload the employee's original188CSV/XLSX exactly once with `upload_structured_dataset`; do not inspect row count to decide whether189to split, rewrite, convert, or Base64-encode it.190191- Use `file.encoding:"path"` with an absolute path, `dataset`, `enterpriseName`, inclusive192 `startDate` and `endDate` in `YYYYMMDD`, and a stable `idempotencyKey`. Optionally supply193 `confidentialityLevel`; otherwise the service uses `0`.194- The launcher streams the file through bounded multipart upload. The source may be up to the195 service's current 2 GiB limit; the model and MCP request never contain the file bytes or storage196 upload URLs.197- The service validates the complete source and publishes all daily store partitions atomically.198 If any row or partition fails, nothing from that source replaces live data. On success, matching199 organization + enterprise + dataset + store + date partitions replace prior content, including200 its confidentiality level.201- Keep `partitionImportJobId` and follow the partition status polling rules above. Do not query or202 download from a job until its status is `published`.203- `query_structured_dataset` is not available for these datasets and returns204 `DATASET_REQUIRES_PARTITION_EXTRACT`. Use `describe_structured_dataset_coverage`, then call205 `download_structured_partitions` with `dataset`, the exact coverage `enterpriseName`, inclusive206 `startDate`/`endDate` in `YYYYMMDD`, and optional merchant IDs in `storeIds`.207- The launcher consumes presigned links internally, verifies each CSV, and returns208 `localDirectory`, dataset/window metadata, counts, and local file names. Never expose or request209 presigned links. The calling analysis workflow owns the returned scratch directory and must210 delete that exact directory in `finally`; it must not delete broader temp or report directories.211212## Dish Catalog Snapshot Uploads213214Use this path only when `list_structured_datasets` reports `dish_catalog` as available. It is a215complete, append-only menu snapshot rather than a sales/business date-window dataset.216217- Call `upload_structured_dataset` with `dataset: "dish_catalog"`, `snapshotDate: "YYYYMMDD"`,218 `enterpriseName`, a stable `idempotencyKey`, and the CSV/XLSX file. Optionally include an219 explicit `confidentialityLevel`; otherwise it is `0`. Do not include `startDate` or `endDate`.220- Treat the uploaded file as the full directory for that date. Do not split it into CSV parts,221 upload only changed rows, use the service to merge it with another file, or describe a partial222 file as a complete catalog.223- The service validates catalog headers, sheets, and row values after upload. If validation rejects224 the upload, summarize the safe returned errors and ask for a corrected source file or explicit225 local-conversion instruction; do not pre-normalize or regenerate the catalog file from registry226 metadata.227- The organization can upload historical snapshots out of date order, but only one non-archived228 snapshot may occupy a date. For a same-date correction with different content, the existing229 snapshot must be archived through the authorized maintenance path before a new upload. Uploading230 a newer snapshot does not archive or replace older history.231- After `importBatch.status=applied`, query catalog rows through the discovery-reported232 `snapshot_date` field. Do not infer a current/latest menu, a diff, or added, removed,233 discontinued, or other cross-snapshot status.234235## Delivery Ledgers And Supplier Catalogs236237For `delivery_ledger` and `supplier_catalog`, call `upload_structured_dataset` with `file`,238`enterpriseName` and `idempotencyKey`. Optionally include an explicit `confidentialityLevel`.239Do not send `startDate`, `endDate`,240or `snapshotDate`.241242- `delivery_ledger` accepts one complete CSV/XLSX delivery receipt per file. The receipt ID243 and date are extracted by the service, and each item row becomes one ledger row. Upload the244 original receipt file as provided, even when receipt-level fields appear in header rows rather245 than in the item table. Do not generate a normalized CSV with repeated receipt metadata. The246 normalized receipt ID is the organization-scoped natural idempotency key, so different content247 for the same receipt is a conflict rather than an overwrite.248- For delivery-ledger queries, use the `list_structured_datasets` registry's `canonicalName`,249 `sourceColumn`, and `aliases` instead of guessing English field names. Paper-ledger terms such as250 `进货数量`, `进货金额`, and `供货单位名称` are aliases for the matching fields; resolve them to251 `purchase_quantity`, `purchase_amount`, and `supplier_name` before querying.252- `supplier_catalog` is the current supplier snapshot used for delivery-ledger enrichment. Upload253 the provided supplier catalog file as-is; do not rewrite it locally to match registry metadata.254 The service validates required and optional columns after upload. The latest successfully applied255 snapshot is current; older history is not a fallback, and an in-progress, failed, or rejected256 upload cannot replace it.257- Keep the returned `importBatchId` and poll `get_import_status` until258 `importBatch.status=applied` before querying. A queued or pending response is not success.259- In delivery detail queries, `supplier_contact_phone` and `supplier_unit_address` are selectable260 dynamic fields only; they cannot filter, sort, group, or aggregate. They may be `null` when no261 current catalog is available or visible, no exact match exists, the source value is blank, or the262 supplier name is ambiguous. Enrichment never changes the authorized ledger page or falls back to263 an older catalog.264- Select `source_document_id` on detail-row structured queries when the employee needs the265 original uploaded receipt file. This field is not returned by default and cannot filter, sort,266 group, or aggregate.267268## Quarantine Certificates And Source Downloads269270Use quarantine-certificate tools only for animal quarantine certificate images that should be271linked to delivery-ledger receipt IDs. The service does not inspect whether the photo actually272looks like a certificate.273274- Upload with `upload_quarantine_certificate`: provide one JPG/JPEG/PNG file, one `receiptId`, and275 one stable `idempotencyKey`. Optionally include an explicit `confidentialityLevel`; otherwise it276 is `0`. Use `file.encoding:"path"` when possible. If the employee gives several photos for the277 same receipt, call the tool once per photo.278- `receiptId` is the public business key for both delivery ledgers and certificates. The service279 trims and uppercases it. Do not call it `receiptNumber`, do not treat it as a count, and do not280 require the corresponding delivery ledger to already exist.281- Query with `query_quarantine_certificates` using explicit `receiptIds` only. It returns one group282 per requested receipt ID, each with zero or more certificates. An empty group means no visible283 matching certificate; do not infer whether a hidden one exists.284- Archive with `archive_quarantine_certificates`. Use `sourceDocumentId` for a single visible285 certificate. Only admins may archive by `receiptId`, which archives all visible certificates286 under that receipt ID.287- For downloading originals, call `get_source_document_download_url` with a visible288 `sourceDocumentId`. The result is a 24-hour attachment link; return the link to the employee289 rather than fetching or proxying the file bytes yourself.290291## Official Install Or Update292293An employee may ask in natural language to install, update, or repair SMEDC. The294employee does not need to run these commands personally. Agents should also offer an update when295a self-check reports `recommendedUpdateAvailable: true` (see Tool Discovery). Work only for the296current OS user and only on the invoking agent's configuration.2972981. Confirm the host is macOS or Windows and that the user authorizes this current-user install.299 Run `node --version` and `npm --version`. Require Node.js major version **22 or newer** and a300 working npm. If Node.js is missing or older than 22, install or upgrade Node.js/npm for the301 current user before continuing; do not use administrator privileges or alter unrelated tools.3022. Use the fixed platform directory:303304 | Platform | Launcher directory |305 | -------- | -------------------------------------------------------------- |306 | macOS | `~/Library/Application Support/SMEDC/launcher/versions/0.5.0/` |307 | Windows | `%LOCALAPPDATA%\\SMEDC\\launcher\\versions\\0.5.0\\` |3083093. Install or repair the exact package idempotently. Substitute only the platform directory310 above; do not add credentials or a global install:311312 ```sh313 npm install --prefix "<launcher-directory>" --save-exact smedc-mcp-launcher@0.5.0314 ```3153164. Preserve the existing installation if the same pinned package is already present. For an317 approved update, install the newly approved exact version into its own versioned directory,318 update the one launcher path in the invoking agent's MCP entry, then run the self-check.319 Updating does not delete the secure-store session or unrelated MCP servers.3205. Run the installed launcher's credential-free self-check before changing or declaring an MCP321 configuration healthy:322323 ```sh324 SMEDC_BASE_URL=https://api.smedatacenter.xyz \325 "$HOME/Library/Application Support/SMEDC/launcher/versions/0.5.0/node_modules/.bin/smedc-mcp-launcher" self-check326 ```327328 ```powershell329 $env:SMEDC_BASE_URL = "https://api.smedatacenter.xyz"330 & "$env:LOCALAPPDATA\SMEDC\launcher\versions\0.5.0\node_modules\.bin\smedc-mcp-launcher.cmd" self-check331 ```332333 The stable self-check contract is safe machine-readable JSON with this shape:334335 ```json336 {337 "ok": true,338 "launcherVersion": "0.5.0",339 "serviceOrigin": "https://api.smedatacenter.xyz",340 "platform": "<safe platform>",341 "secureStore": {342 "available": true,343 "durableCredentialPresent": false344 },345 "server": {346 "reachable": true,347 "metadataCompatible": true,348 "minimumLauncherVersion": "<safe version>",349 "recommendedLauncherVersion": "<safe version>",350 "recommendedUpdateAvailable": false351 },352 "mcp": {353 "handshake": "ok"354 }355 }356 ```357358 `mcp.handshake` is `ok`, `not_authenticated`, or `unavailable`. Self-check never performs359 browser login and never returns credential contents. If it reports a typed failure, follow the360 focused recovery below; do not inspect secure storage or repair the remote service.361362Use this exact stdio launch tuple after installation. `SMEDC_BASE_URL` is the only363launcher environment variable; do not add another environment value or any credential.364365| Platform | Command | Arguments | Environment |366| -------- | -------------------------------------------------------------------------------------------------- | --------- | ---------------------------------------------- |367| macOS | `~/Library/Application Support/SMEDC/launcher/versions/0.5.0/node_modules/.bin/smedc-mcp-launcher` | `serve` | `SMEDC_BASE_URL=https://api.smedatacenter.xyz` |368| Windows | `%LOCALAPPDATA%\\SMEDC\\launcher\\versions\\0.5.0\\node_modules\\.bin\\smedc-mcp-launcher.cmd` | `serve` | `SMEDC_BASE_URL=https://api.smedatacenter.xyz` |369370The command, its single `serve` argument, and the one URL-only environment value are the complete371stdio configuration. It must never contain a password, token, header, client secret, or OAuth372setting.373374## Device-Code Login Flow375376Starting with launcher 0.2.2, every login uses the OAuth Device Authorization Grant: the launcher377obtains a first-party SMEDC verification link, opens it automatically when a system378browser is available (desktop agents), or returns it for the agent to surface through the employee379channel (phone-remote-controlled and headless agents). The employee confirms the agent instance380name shown on the page, enters email/password, and the launcher completes sign-in by polling.381382- The employee's only credential input remains email/password on the SMEDC page; never383 ask for, read, or relay verification codes or tokens.384- On macOS/Windows the launcher keeps the durable session in Keychain/Credential Manager exactly as385 before.386- On hosts without a secure store (headless Linux/VPS), the launcher keeps the session in memory387 only; after a launcher or host restart, run the login tool again so the employee can tap a fresh388 link.389- If a business tool reports `authentication_pending`, tell the employee to complete the sign-in390 link and retry the original request once; if it reports `authentication_required`, run391 `smedc_login` to obtain a new link.392393This flow is available in launcher 0.2.2 and later; this document pins launcher 0.5.0.394395## Configure The Invoking Agent396397Always inspect the existing configuration first, create a timestamped backup before modifying it,398then make the smallest idempotent change: one `smedc` stdio MCP entry. Preserve every399unrelated server and setting. Do not configure a direct HTTP/OAuth SMEDC server because400the local launcher owns browser login and credential storage.401402### Codex403404Use the verified Codex CLI MCP registry. On macOS, prefer `codex` from `PATH`; when it is absent,405use the bundled `/Applications/ChatGPT.app/Contents/Resources/codex` fallback. On Windows, resolve406`codex.exe` from `PATH`. Stop if neither verified binary exists.407408Before the first mutation, inspect with `codex mcp list --json` and409`codex mcp get smedc --json`. Back up `~/.codex/config.toml` (Windows:410`%USERPROFILE%\.codex\config.toml`) to a timestamped sibling file when it exists. If the existing411entry already matches the exact command, `serve` argument, and sole BASE_URL environment value, do412nothing.413414For macOS add/repair:415416```sh417CODEX_BIN="$(command -v codex 2>/dev/null || true)"418if [ -z "$CODEX_BIN" ] && [ -x "/Applications/ChatGPT.app/Contents/Resources/codex" ]; then419 CODEX_BIN="/Applications/ChatGPT.app/Contents/Resources/codex"420fi421test -n "$CODEX_BIN"422CODEX_CONFIG="$HOME/.codex/config.toml"423if [ -f "$CODEX_CONFIG" ]; then424 cp -p "$CODEX_CONFIG" "$CODEX_CONFIG.smedc.bak.$(date +%Y%m%d%H%M%S)"425fi426"$CODEX_BIN" mcp list --json427"$CODEX_BIN" mcp get smedc --json428```429430If `get` reports the entry absent, add it. If it is present and exact, stop without mutation. Only431when it is present and mismatched, remove that one entry immediately before running the same add432command:433434```sh435# Mismatched entry only:436"$CODEX_BIN" mcp remove smedc437# Missing or just-removed entry:438"$CODEX_BIN" mcp add \439 --env SMEDC_BASE_URL=https://api.smedatacenter.xyz \440 smedc -- \441 "$HOME/Library/Application Support/SMEDC/launcher/versions/0.5.0/node_modules/.bin/smedc-mcp-launcher" serve442"$CODEX_BIN" mcp get smedc --json443```444445For Windows PowerShell, use the same `list`/`get`/`remove`/`add` sequence:446447```powershell448$CodexBin = (Get-Command codex.exe -ErrorAction Stop).Source449$CodexConfig = Join-Path $env:USERPROFILE ".codex\config.toml"450if (Test-Path $CodexConfig) {451 Copy-Item $CodexConfig "$CodexConfig.smedc.bak.$(Get-Date -Format yyyyMMddHHmmss)"452}453$LauncherBin = "$env:LOCALAPPDATA\SMEDC\launcher\versions\0.5.0\node_modules\.bin\smedc-mcp-launcher.cmd"454& $CodexBin mcp list --json455& $CodexBin mcp get smedc --json456```457458If `get` reports the entry absent, add it. If it is present and exact, stop without mutation. Only459for a present mismatched entry, run:460461```powershell462# Mismatched entry only:463& $CodexBin mcp remove smedc464# Missing or just-removed entry:465& $CodexBin mcp add --env "SMEDC_BASE_URL=https://api.smedatacenter.xyz" smedc -- $LauncherBin serve466& $CodexBin mcp get smedc --json467```468469After add/repair, run the platform self-check above, restart/reload Codex, run470`codex mcp list --json` and `codex mcp get smedc --json`, and confirm the discovered tools.471If add fails after removal, restore the timestamped backup and report the focused failure. For472per-agent removal, back up first, run `codex mcp remove smedc`, then verify473`codex mcp list --json` no longer contains it and `codex mcp get smedc --json` reports it474absent.475476### OpenClaw477478Use OpenClaw's MCP CLI registry for a **stdio** launcher; do not use OpenClaw's direct remote479OAuth store, `openclaw mcp login`, or `openclaw mcp logout` for SMEDC.4804811. Inspect first: `openclaw mcp status --verbose` and, when present,482 `openclaw mcp show smedc --json`.4832. Back up the OpenClaw configuration using its supported current-user mechanism.4843. Add the entry with the platform-specific launcher path from the table, its single `serve`485 argument, and the sole URL-only environment value. On macOS, the verified OpenClaw CLI form is:486487 ```sh488 openclaw mcp add smedc \489 --command "$HOME/Library/Application Support/SMEDC/launcher/versions/0.5.0/node_modules/.bin/smedc-mcp-launcher" \490 --arg serve \491 --env SMEDC_BASE_URL=https://api.smedatacenter.xyz492 ```493494 If the entry already exists, use `openclaw mcp set smedc '<one stdio JSON object>'`495 with exactly `command`, `args: ["serve"]`, and the one `SMEDC_BASE_URL` environment496 value. Do not add an HTTP URL or `auth: oauth` configuration.4974984. Verify with `openclaw mcp doctor smedc --probe`. Reload or restart the owning499 OpenClaw runtime when required by its current setup.500501`openclaw mcp add/set/doctor --probe` are the supported configuration/proof path. The launcher,502not OpenClaw's OAuth store, opens the browser and manages the SMEDC secure session.503504### Other Agents505506Use guarded adaptive discovery. Inspect the installed client's help, current configuration, and507MCP capabilities to confirm that it can start a local stdio server. Back up its configuration,508add only the pinned SMEDC launcher entry, validate its handshake, and preserve every509unrelated server. If its supported configuration mechanism is not clear, report the narrow blocker510instead of editing guessed files or configuring direct remote OAuth.511512## Browser Login And Normal Use513514Call `smedc_auth_status` before beginning work when the authentication state is unknown.515If it reports `authentication_required`, call `smedc_login`. The launcher opens the516system browser; ask the employee to finish login there and never request any credential in chat.517The launcher returns only a safe outcome.518519After successful login, retry the employee's original business tool call exactly once. Do not520retry repeatedly after browser cancellation or an unsuccessful login. Use521`smedc_logout` only when the employee asks to sign out. It clears the shared local522session for SMEDC under the current OS user, so all locally configured agents on that523OS user are signed out.524525When the employee asks which SMEDC account is currently active, call the zero-input526`smedc_get_current_user` tool. Return its `displayName`, `email`, `role`, and `clearance`; do not infer527identity from launcher configuration or `smedc_auth_status`, and do not ask for an account528selector. The tool is self-scoped to the bearer-authenticated employee and never returns internal529IDs or credentials. Follow the normal authentication recovery above if login is required.530531## SMEDC Data Questions532533When the employee asks about资料、SOP、上传过的文件、公司数据、SMEDC 里的表格, or what was534“刚上传/刚传进去/这份表”, answer through SMEDC MCP tools. Do not answer those questions by535reading a local attachment, local CSV/XLSX, previous chat text, cache, or filesystem copy unless536the employee explicitly asks you to inspect a local file outside SMEDC.537538Local files are upload inputs only. After uploading a file, keep the returned service metadata539needed for follow-up questions: document id, import batch id, dataset id, declared confidentiality540level, declared business541date window or `snapshotDate`, enterprise/store name, and status. In a later task, rediscover542available datasets through MCP; if the intended uploaded table/document cannot be543identified safely, ask one short natural clarification instead of querying all visible history.544545For structured-table questions:546547- Call `list_structured_datasets` before constructing a structured query unless you already have a548 fresh compatible registry from the same MCP session.549- Resolve field wording through the registry before every structured query: match user-facing terms550 against `sourceColumn`/`aliases`, then send only `canonicalName` values in `select`, filters,551 sorts, groups, and aggregates. Use `sourceColumn` or the matched alias as the displayed table552 header when that is clearer for the employee.553- Respect registry capabilities for every field. Detail `select` entries must be registered554 canonical fields; filter, sort, group, and aggregate only with fields whose advertised555 capabilities permit that use. Dynamic enrichment fields are selectable detail fields only unless556 discovery says otherwise.557- Use explicit mechanical aggregates only: `count`, `countDistinct`, `sum`, `avg`, `min`, `max`,558 and `weightedAvg`. Group by at most four canonical fields and request at most twelve aggregate559 outputs. Aggregate sort fields must be either a group-by field or a unique aggregate alias from560 the same request.561- For `weightedAvg`, both `field` and `weightField` must be numeric aggregatable canonical fields562 in the same dataset. It represents `SUM(field * weightField) / SUM(weightField)` with a `null`563 result when total weight is zero or missing; do not describe it as a service-generated business564 conclusion.565- Select `source_document_id` on detail-row queries when the employee needs the original uploaded566 file behind a structured row, then pass it to `get_source_document_download_url`. This field is567 not returned by default and is not for filters, sorting, grouping, or aggregates.568- Call `describe_structured_dataset_coverage` before answering whether SMEDC has enough569 readable applied data for a dataset, time window, snapshot, or source-file scope. Coverage shares570 structured-query authorization and returns readable source windows or snapshots; decide and state571 any sufficiency assumptions yourself.572- Scope follow-up questions about a recent upload to that upload's returned import metadata,573 declared business-date window, enterprise/store name, or other explicit service-returned574 metadata. Avoid broad unbounded queries for phrases like “这份表”, “刚才那张表”, or “我刚传的”.575- For `dish_catalog`, scope queries with the discovery-reported `snapshot_date` field. Do not576 infer latest/current catalog state, diffs, or row status across snapshots.577- If the employee asks about a local spreadsheet before it has been uploaded, offer to upload it578 first. Do not compute final SMEDC answers directly from the local spreadsheet unless the579 employee explicitly says they want a local-file-only inspection.580- If a query result contains historical rows outside the intended upload/window, narrow the query581 or ask for clarification before presenting totals as “这份表”的 totals.582583For authorized service tools:584585- Default an upload to confidentiality level `0` when the employee does not explicitly provide a586 level. Never infer or elevate the level from filenames, content, source context, or apparent587 document lineage. If the employee explicitly supplies `0`–`3`, pass it unchanged.588- Prefer `file.encoding:"path"` uploads with the file's absolute local path; the launcher reads589 exact bytes mechanically. Use `file.encoding:"base64"` only for small inline payloads. Do not590 alter business content, schema, headers, or row meaning unless the employee explicitly asks for a591 local file-conversion task before upload.592- Follow Upload Completion And Status Polling after every `202` upload; never start a worker.593- Quarantine-certificate uploads are synchronous `201` operations, not background imports. Call594 `upload_quarantine_certificate` once per JPG/PNG image with exactly one `receiptId`, one595 idempotency key, and declared confidentiality level. A receipt ID may have zero, one, or multiple596 certificates; one certificate upload request contains only one image.597- Reuse a structured-import idempotency key only for the exact same file and metadata. Treat an598 import-status 404 as "not visible or missing" and do not infer hidden metadata.599- Reuse a quarantine-certificate idempotency key only for the exact same image bytes, receipt ID,600 and declared confidentiality level. Use `query_quarantine_certificates` with explicit `receiptIds`; never try to601 query all quarantine certificates. Use `get_source_document_download_url` with a returned602 `sourceDocumentId` when the employee asks to download or view the original source file.603- Treat evidence cursors as opaque, short-lived continuations. Return `page.nextCursor` unchanged604 with the same query, filters, and limit. Restart without it on `INVALID_CURSOR`; on605 `CURSOR_EXPIRED`, explain the expiry and restart only if the employee still wants more results.606- `smedc_list_skills` exposes approved directory metadata only; do not execute an entry.607608## Local File Read Errors609610When a path-mode upload fails because the launcher cannot read the file, report the typed error611and ask the employee, in the employee's language, to provide an accessible file. Do not fabricate612content, do not paste file contents into chat, and do not silently retry with an inline copy.613614- `MCP_LOCAL_FILE_NOT_FOUND`: the file does not exist at the given path.615- `MCP_LOCAL_FILE_PERMISSION_DENIED`: the launcher cannot read the file (file permissions, macOS616 privacy protection, sandbox, or another OS access boundary).617- `MCP_LOCAL_FILE_INVALID`: the path is relative, a directory, or not a regular file.618- `MCP_LOCAL_FILE_TOO_LARGE`: the file exceeds the applicable contract (2 GiB for path-mode619 `business`/`dishes`; 50 MiB for ordinary uploads).620- `MCP_LOCAL_FILE_READ_FAILED`: another read error.621622Example employee-facing reply (Chinese):623624> 您刚才提供的文件企业数据中枢没有足够权限读取,请把文件放到桌面/下载等可访问位置后重新提供,625> 或重新拖入文件。626627For `MCP_LOCAL_FILE_NOT_FOUND` / `MCP_LOCAL_FILE_INVALID`, ask the employee to re-check the file628location or re-attach the file. For `MCP_LOCAL_FILE_TOO_LARGE`, do not split `business`, `dishes`,629or `dish_catalog`; ask the employee for a smaller complete export, a service-supported larger630limit, or operator help.631632## Typed Recovery633634| Condition | Required response |635| --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |636| `authentication_required` | Call `smedc_login`, wait for browser completion, then retry the original business operation once. |637| Browser cancelled, timed out, or login failed | Report the safe outcome. Do not reopen the browser automatically or retry the business operation. |638| `service_unavailable` | Report that the official service cannot be reached. Do not start, repair, or diagnose service infrastructure. |639| `forbidden` or not-found | Treat the resource as unavailable to this employee; do not infer hidden data. |640| `launcher_upgrade641642…(truncated)