iwym-assets-mcp
stdio MCP server that lets a Grok Bot maintain the iwym asset whitelist (assets + asset_venue_codes). It wraps the operator HTTP API. It does not open exchange orders and it does not turn on auto_exec.
The bot is expected to verify one asset at a time (1000SHIB vs SHIB, the same ticker on two venues, Kraken XBT, leveraged tokens) and then write. Catalog diff is the read side of that loop.
Requirements
- Python 3.11+
- uv
- A running iwym API (
IWYM_API_BASE_URL) - An operator API token from Settings → System → OPERATOR API (paste it as
IWYM_OPERATOR_TOKENhere)
1. API token
Log into the iwym console and open Settings → System. The OPERATOR API panel shows whether a token is set and when it was last rotated.
- Generate creates a token when none is stored.
- Reset rotates it. The previous Bearer stops working immediately.
- The plaintext is shown once. Copy it into
IWYM_OPERATOR_TOKEN. It is not written to.envon the API, and the API stores only a SHA-256 digest.
The token acts as the operator who generated it. It has the same power as that logged-in operator. Cookie login is unchanged. This Bearer works in any APP_ENV and does not need a CSRF cookie.
AUTH_ALLOW_BEARER is only for short-lived JWTs in development. Do not use it for this MCP.
2. Connect (Cursor / Grok Bot)
From a local checkout:
{
"mcpServers": {
"iwym-assets": {
"command": "uv",
"args": [
"--directory",
"/ABS/PATH/iwym-next/mcp/iwym-assets",
"run",
"iwym-assets-mcp"
],
"env": {
"IWYM_API_BASE_URL": "http://127.0.0.1:8000",
"IWYM_OPERATOR_TOKEN": "paste-from-settings-system-operator-api"
}
}
}
}
IWYM_API_BASE_URL is the API origin only (no /api/v1 suffix).
cd mcp/iwym-assets
uv sync
export IWYM_API_BASE_URL=http://127.0.0.1:8000
export IWYM_OPERATOR_TOKEN=paste-from-settings-system-operator-api
uv run iwym-assets-mcp
stdio waits for the host. Missing env vars exit 1 with a stderr hint.
3. Tools
| Tool | HTTP | Notes |
|---|---|---|
list_assets |
GET /api/v1/assets |
Includes disabled rows |
get_asset |
GET /api/v1/assets/{id} |
|
catalog_diff |
GET /api/v1/assets/catalog-diffs |
venue optional. Omit it to scan every seeded ticker venue. include_orphans defaults false |
create_or_upsert_asset |
PUT /api/v1/assets/{id} |
Create-or-attach. enabled defaults to false on this tool (the HTTP body default is true, matching Settings create) |
add_venue_code |
POST /api/v1/assets/{id}/venue-codes |
409 if the code is already taken |
soft_disable_asset |
DELETE /api/v1/assets/{id} |
Keeps the row and venue codes |
Re-enable a staged row with PATCH /api/v1/assets/{id} {"enabled": true} (no MCP tool; use the HTTP API or extend the server). auto_exec is not touched.
catalog_diff
Spot and perp legs only. Unique base codes, not BTCUSDT rows. Tradable instruments only.
Each entry:
status:missing(no(venue, code)row),disabled(mapped, assetenabled=false),orphan(whitelist code absent from the catalog; only wheninclude_orphans=trueand that venue's spot and perp reads both succeeded)suggested_asset_id: lowercase slug, or null when the code cannot be an id (1000SHIB)already_mapped_asset_id/mapped_asset_enabledmarket_types:spotand/orperpalias_note: catalog folds (XBT→BTC,XDG→DOGE), multiplier prefixes, leveraged-token suffixes
errors[] means that market was not read. Do not treat orphans as complete for a venue listed there.
create_or_upsert_asset
One asset per call. Pass venue + code, or venue_codes_json as [{"venue":"binance","code":"SHIB"}].
- Asset missing: create it (tool default
enabled=false) and attach codes that are free. Response HTTP 201,created: true. - Asset exists and kind/oracle/anchor match: attach free codes. Codes already on this asset are unchanged. HTTP 200. Scalar fields are not updated (
enabledstays as stored). - Code belongs to another asset, or kind/oracle/anchor differ: HTTP 409, nothing written.
error.details.conflictslists{venue, code, asset_id}.
4. Suggested bot loop
catalog_diff(venue="binance").- Read one
missingentry. Ifalias_notementions a multiplier, leverage suffix, or folded alias, stop and ask. get_asset(suggested_asset_id)when the suggestion is non-null.create_or_upsert_assetwithenabled=falseand that one venue code.- On 409, stop. Do not pick a new id to steal the code.
- Leave the row disabled until a human wants it in the Radar scan set.
5. Security
- Never commit
IWYM_OPERATOR_TOKEN. The API does not readOPERATOR_API_TOKENfrom the environment. - The token is not a trading key. It can still change the whitelist.
- Settings UI CRUD (
POST /assets, PATCH, venue codes, contract paste) is unchanged.
Metadata
Release files for iwym-assets-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iwym_assets_mcp-0.1.0.tar.gz | 6.5 kB | Without provenance | Details for iwym_assets_mcp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iwym_assets_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for iwym_assets_mcp-0.1.0-py3-none-any.whl |
Total release size: 13.9 kB
Release files / iwym_assets_mcp-0.1.0.tar.gz
| Download URL | iwym_assets_mcp-0.1.0.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f39074211df43c7099ea14f9cf055d2fa60dc56934852f3a3e810d1b1b406bcc
|
|
BLAKE2b-256 checksum How to use checksums |
f0d0dbdac601ad9c70a109e64f8a6c327fdf1a343f4aeb7d04248ff64b53f19a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.8
|
Release files / iwym_assets_mcp-0.1.0-py3-none-any.whl
| Download URL | iwym_assets_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe1e4114a7d04e954c1f409c202674af11bd4287b2972292fd04e0350474d7ed
|
|
BLAKE2b-256 checksum How to use checksums |
c85dd1eafedeeadd5623464d0ce4b3dda903037bb99f6a663cb5c7579f7ab613
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.8
|
Security for iwym-assets-mcp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.