@levitating/tensor-mcp 5.3.1 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +367 -25
- package/dist/index.js +1792 -1003
- package/package.json +3 -2
- package/skills/tensor/SKILL.md +166 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@levitating/tensor-mcp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Tensor MCP — Model Context Protocol server for the Tensor wealth management API. Exposes the Tensor API as tools for Claude, Cursor, Codex, and any MCP-aware client.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
|
+
"skills",
|
|
12
13
|
"README.md"
|
|
13
14
|
],
|
|
14
15
|
"scripts": {
|
|
@@ -35,7 +36,7 @@
|
|
|
35
36
|
"license": "UNLICENSED",
|
|
36
37
|
"dependencies": {
|
|
37
38
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
38
|
-
"zod": "^
|
|
39
|
+
"zod": "^4.6.7"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"esbuild": "^0.24.0",
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tensor
|
|
3
|
+
description: Use when working with Tensor, the family-office workbench, through its MCP server (tools such as search_records, get_portfolio_summary, create_transaction, list_todos) — recording transactions, importing statements, reviewing the portfolio, or managing todos, ideas, files and bookmarks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- Generated from mcp-server/guide.ts by `npm run mcp:skill`. Edit that file, not this one. -->
|
|
7
|
+
|
|
8
|
+
# Using Tensor
|
|
9
|
+
|
|
10
|
+
This skill needs the Tensor MCP server connected: hosted at https://tensor.levitating.org/mcp, or run locally with the `@levitating/tensor-mcp` npm package. The server serves the same guidance itself (its initialize instructions, the `get_guide` tool and `tensor://guide/<topic>` resources), so this file only helps an agent that loads skills before it connects.
|
|
11
|
+
|
|
12
|
+
Tensor is a private family-office workbench. Two halves share one graph:
|
|
13
|
+
- The ledger: entities (people, trusts, companies), accounts, an asset catalog, positions, an append-only transaction ledger, valuations, loans and fund LP capital accounts.
|
|
14
|
+
- The work: todos, ideas (a capture inbox), files, bookmarks and parked tab groups, linked to ledger records and to each other.
|
|
15
|
+
|
|
16
|
+
How to work well here:
|
|
17
|
+
1. Orient first. search_records finds any record by name or by its reference id (E007 entity, A012 account, P031 position, AS021 asset, T042 transaction, TSK-12 todo, IDEA-7, FILE-12, BMK-3, TAB-5); the other tools take the numeric id it returns, get_entity, get_account, get_position and get_transaction read one record by that id, and get_entity_overview and get_position_overview answer "everything about this one" in a single call. For net worth, cost basis or P/L call get_portfolio_summary and check its coverage field; never add up list_positions yourself.
|
|
18
|
+
2. The ledger is append-only. A transaction can never be edited or deleted; a mistake is fixed with a compensating entry. Confirm types, amounts and dates with the user before posting, post oldest first, and pass an idempotencyKey on every create_transaction (and any other write that takes one) so a retry cannot write twice.
|
|
19
|
+
3. More than a handful of ledger writes go through data_dry_run, then the user reviews the preview, then data_apply.
|
|
20
|
+
4. Todos, ideas, files, bookmarks and tab groups delete into a 60-day Trash and have restore_ tools. An idea the user is done with but wants to keep is archived (archive_idea), not deleted: Archive never expires. list_trash shows what is waiting in every Trash you can read. Ledger and reference deletes (delete_position, delete_entity, delete_account, delete_asset and the catalog deletes), delete_entity_group, delete_bookmark_folder and delete_todo_tag are permanent and take two calls: the first deletes nothing and returns a preview and a confirmToken; show the user, and only after they agree call again with the token. Closing a holding is sell_all_position, not a delete. Only a person can empty a Trash.
|
|
21
|
+
5. You see what this connection's scopes allow, and only the tools it can use are listed. whoami says who you are connected as (its user id is the assigneeId behind "my todos") and which scopes it holds. A 403 names the missing scope: tell the user instead of working around it. Answers that mix record types (search, links, list_changes) leave out the types you cannot read, so an empty answer can mean "none you can see". Linking or attaching a record also needs that record type's read scope. No connection can reach memos or browsing history, and FX rates, loan terms and fund terms are read-only.
|
|
22
|
+
6. Lists answer {items, hasMore, nextOffset}: 100 rows unless you pass limit (at most 1000); pass nextOffset as offset for the next page. Filter on the server (filters combine with AND; a value Tensor cannot parse is ignored, which widens the answer) and catch up with list_changes(since) instead of re-reading everything. Times are epoch milliseconds.
|
|
23
|
+
7. A body you send (todos, ideas, comments) is plain text, one paragraph per line; Tensor stores a document and returns the text as body or bodyText. Sending body replaces the whole body. You can edit only your own comments, and none can be deleted.
|
|
24
|
+
8. A download or media URL is a bearer link to a private file and stays in this conversation: mint one only right before fetching, and never repost it. Each one is logged.
|
|
25
|
+
|
|
26
|
+
Before an unfamiliar job, call get_guide with a topic: ledger, imports, work, files or safety.
|
|
27
|
+
|
|
28
|
+
The server also offers these prompts:
|
|
29
|
+
- **Record a statement** (`record_statement`): Turn a brokerage, bank or fund statement into ledger entries, checked against what is already recorded and confirmed before anything is written.
|
|
30
|
+
- **Review the portfolio** (`portfolio_review`): A read-only review: totals, concentrations, recent changes and stale or unpriced holdings.
|
|
31
|
+
- **Triage the inbox** (`triage_inbox`): Go through recent ideas and open todos and propose what to file, link, turn into a todo, archive or move to Trash.
|
|
32
|
+
|
|
33
|
+
## The ledger
|
|
34
|
+
|
|
35
|
+
### The shape
|
|
36
|
+
An **entity** (person, trust, company) owns **accounts** at institutions. A **position** is one holding: an entity's interest in an **asset**, usually inside an account. Every position has a **transaction ledger**, and the position's quantity, average cost, cost basis and realized gain are FOLDED from that ledger in insert order. Valuations (prices and dated marks) are a separate append-only history.
|
|
37
|
+
|
|
38
|
+
Find things before creating them. search_records answers names and reference ids at once; get_entity, get_account, get_position and get_transaction read one by id. Entity groups (list_entity_groups) are named sets of entities, such as a family branch. list_positions filters by entityId, accountId, assetId, assetClass and status; list_assets by symbol, assetClass, linked and q.
|
|
39
|
+
|
|
40
|
+
### Two kinds of position, chosen at create time
|
|
41
|
+
- **Unitized**: shares, units, coins, a cash balance. Send quantity and averageCost.
|
|
42
|
+
- **Capital account**: a fund LP interest, where the GP reports a balance and there are no units. Send costBasis; that is the only switch. A capital account accepts only the fund transaction types, and fund performance (paid-in, DPI/TVPI, IRR) exists only for one.
|
|
43
|
+
Getting this wrong cannot be fixed by editing later. If you are unsure which a holding is, ask.
|
|
44
|
+
|
|
45
|
+
### Cost basis and the mark are two numbers
|
|
46
|
+
Cost basis is what was paid; the mark (currentPrice, currentValue) is what it is worth now. Never set a cost field from a market price, and never treat one as the other when reporting.
|
|
47
|
+
|
|
48
|
+
### Recording activity
|
|
49
|
+
- A trade, income, a fee, a capital call: create_transaction on the position it belongs to. The transactionType sets the direction; quantity and amount are positive magnitudes. Its transactionType and settlement inputs describe every type and the rule for dividends, interest and coupons. Read them before your first post.
|
|
50
|
+
- Entries must go in date order per position. When backfilling, post the oldest first; an entry dated before the position's latest activity is refused.
|
|
51
|
+
- Check for duplicates first: list_transactions with positionId and since, and compare with what you are about to post.
|
|
52
|
+
- An exit is sell_all_position, which keeps the history and books the realized gain. delete_position destroys the position and its whole ledger and is only for a position that should never have existed.
|
|
53
|
+
- Restating totals (the statement says 120 shares and Tensor says 100) is update_position: it appends one adjustment row recording the difference, so history still explains the figure. Prefer a real transaction when you know what happened.
|
|
54
|
+
|
|
55
|
+
### Correcting a mistake
|
|
56
|
+
There is no edit and no delete for a transaction. Post a compensating entry of the opposite type (a wrong buy is offset by a sell, a wrong capital_call by a return_of_capital) and tell the user both rows will stay visible.
|
|
57
|
+
|
|
58
|
+
### Prices
|
|
59
|
+
- To make an asset price itself, find the symbol with search_market_quotes (never guess a ticker), then create_asset or update_asset with tickerSymbol, verifyQuote and syncPrice. verify_market_quote checks a symbol without writing.
|
|
60
|
+
- sync_prices and sync_asset_price fetch quotes and WRITE a price row for each asset, repricing its positions. Ask before running them on the whole catalog.
|
|
61
|
+
- update_asset_price records a manual mark for an asset with no feed.
|
|
62
|
+
|
|
63
|
+
### Reading the totals
|
|
64
|
+
get_portfolio_summary computes net worth, assets, liabilities, cost basis and unrealized P/L in USD, the same way the Tensor dashboard does, optionally grouped by entity, account, assetClass or currency. Its coverage field says how much of the portfolio the figures cover; say so when it is not complete. Liabilities (loans you owe) are positions with liability set.
|
|
65
|
+
|
|
66
|
+
For a fund LP interest, get_fund_performance (or list_fund_performance for every fund) returns paid-in, distributions, unfunded commitment, DPI/TVPI and IRR or time-weighted return, folded the same way as Tensor's fund card. Quote those; do not compute IRR from transactions. They are in the position's currency: convert with list_fx_rates (multiply by rateToUsd). A stale NAV (freshness.stale) and reconciliation.matches false are worth saying.
|
|
67
|
+
|
|
68
|
+
## Importing a batch
|
|
69
|
+
|
|
70
|
+
Use the batch pipeline when there are more than about ten ledger writes, or whenever the user should see the whole change before anything is written.
|
|
71
|
+
|
|
72
|
+
### The flow
|
|
73
|
+
1. Gather the source (a statement, a CSV the user pasted, a list they dictated). Resolve every account, position and asset it names with search_records and the list_ tools. Note what is missing.
|
|
74
|
+
2. Remove what is already in Tensor: list_transactions per position with since set just before the source's first date.
|
|
75
|
+
3. Build operations. Each op is one of asset.upsert, asset_price.record, position.open, transaction.record, account.upsert, entity.upsert; data_dry_run's op input lists each one's fields. Up to 500 per batch. Records can be named rather than numbered (accountName, assetSymbol), and the preview tells you when a name is ambiguous.
|
|
76
|
+
4. Call data_dry_run with a new batchId (for example "stmt-2026-10-schwab-a") and source "mcp". Nothing is written.
|
|
77
|
+
5. Show the user the preview: what will be created, what will change, every error and needsClarification. Fix problems by running a NEW dry run under a NEW batchId; a batchId is bound to its payload.
|
|
78
|
+
6. Only after the user says yes, call data_apply with the batchId and the requestHash the dry run returned. It replays exactly the previewed batch and nothing else. Replaying a finished apply returns the stored result, so a retry is safe. If the connection dropped, get_data_batch(batchId) reads the stored preview or result back; do not dry-run again under the same batchId.
|
|
79
|
+
7. Confirm the result with get_portfolio_summary or list_positions for the accounts touched.
|
|
80
|
+
|
|
81
|
+
### Small jobs
|
|
82
|
+
A few entries can go straight through create_transaction, oldest first, each with its own idempotencyKey (a stable string such as the statement line's id). Still show the user the list before posting.
|
|
83
|
+
|
|
84
|
+
### Things that go wrong
|
|
85
|
+
- Signs: amounts and quantities are positive; the type says which way money moved.
|
|
86
|
+
- Dates: epoch milliseconds, and per position in ascending order.
|
|
87
|
+
- Income: say whether it was paid in cash or in units (settlement).
|
|
88
|
+
- Funds: capital accounts take quantity 0 and the money in amount.
|
|
89
|
+
|
|
90
|
+
## The work surfaces
|
|
91
|
+
|
|
92
|
+
### Todos
|
|
93
|
+
- Call list_todo_states first: a todo's stateId must name an existing state, and the state's category (backlog, unstarted, started, completed, canceled) is what "open" and "done" mean. Filter with category, not with a state's name, which each organisation can rename.
|
|
94
|
+
- body is plain text in and is stored as a document; sending body on update_todo replaces the whole body. Read the todo before rewriting a body you did not write.
|
|
95
|
+
- Todos nest (a checklist is sub-todos). Move with set_todo_parent and reorder with reorder_todo. Before deleting a todo with children, call get_todo_subtree and tell the user how many sub-tasks go with it. delete_todo moves the whole branch to Trash; restore_todo brings it back.
|
|
96
|
+
- Tags come from the Todo tag catalog (list_todo_tags); set_todo_tags replaces the whole set.
|
|
97
|
+
- Comments can be edited but not deleted through the API, so write them as you mean them.
|
|
98
|
+
|
|
99
|
+
### Ideas
|
|
100
|
+
The capture inbox: links, notes and media. create_idea needs at least one of url, body or media. A URL saved before is still created and the answer names the earlier capture in duplicateOf; offer that to the user. Pictures go in the gallery through create_idea_upload_url and the media field, never as an image link typed into body. Sending body on update_idea replaces the whole document.
|
|
101
|
+
An idea that has been handled but is worth keeping is archived with archive_idea, not moved to Trash: it leaves list_ideas (and the tag and site counts), stays readable with get_idea and findable with search_records, keeps its tags, links and media, and never expires. list_ideas with archived true reads the archived ones; unarchive_idea puts one back. Both are idempotent, and an idea in Trash must be restored first. Archiving is its own tool, never an update_idea field.
|
|
102
|
+
|
|
103
|
+
### Bookmarks
|
|
104
|
+
Leaving folderId off files a bookmark as Unfiled, which is a normal resting place; do not invent a folder for it. Keep the order list_bookmarks and list_bookmark_folders return; the owner arranged it by hand. move_bookmark and move_bookmark_folder change a folder and a place in that order in one call. delete_bookmark is soft, delete_bookmark_folder is not (the bookmarks inside survive, the folder does not).
|
|
105
|
+
|
|
106
|
+
### Tab groups
|
|
107
|
+
Tab groups are personal: a connection sees only its own person's groups. Park a whole set of tabs in one create_tab_group call, and add more to the end with add_tabs_to_group. Only name, locked and starred are editable. delete_tab removes one tab for good; delete_tab_group is soft.
|
|
108
|
+
|
|
109
|
+
### Links between records
|
|
110
|
+
attach_todo_link, attach_idea_link and attach_file_link join a record to any ledger record or to another work record; each list_ call returns linkIds for the matching detach_. A link to a record type your connection cannot read is refused when you write it and left out when you read, so an empty list means "none you can see". Links of kind "mention" come from @mentions in prose; remove the mention from the text rather than detaching the link.
|
|
111
|
+
|
|
112
|
+
### Search
|
|
113
|
+
search_records is one ranked search over every type you can read. It resolves reference ids directly (TSK-12, IDEA-7, AS021). Types your scopes do not cover are left out silently. For market tickers use search_market_quotes instead.
|
|
114
|
+
|
|
115
|
+
### Keeping up to date
|
|
116
|
+
list_changes(since) returns creates, updates and deletes across everything your scopes can read, kept for 90 days. Resume from the until it returns. When coverage.complete is false, do a full read instead.
|
|
117
|
+
|
|
118
|
+
## Files
|
|
119
|
+
|
|
120
|
+
### Finding
|
|
121
|
+
browse_files is the Files page: folders, search by title, files attached to a record (targetType + targetId, and with withDescendants the records beneath it, each row marked with via), or the Trash. list_files is the flat export manifest for backup and mirroring, with checksums. get_file returns one file's metadata and its links. None of these return bytes.
|
|
122
|
+
|
|
123
|
+
### Uploading (three steps)
|
|
124
|
+
1. create_file_upload_url with filename, mimeType and sizeBytes. It answers with a presigned PUT URL, a storageKey and the encryption terms.
|
|
125
|
+
2. PUT the raw bytes to that URL with exactly the approved size.
|
|
126
|
+
3. confirm_file_upload with the storageKey, plus title, folderId and links to records if wanted. Nothing exists until this step.
|
|
127
|
+
If the presign answers envelopeVersion 1, this server stores files encrypted and the PUT body must be an encrypted envelope built on the client with your own key. If you cannot build one, stop and ask the user to upload the file in the Tensor app, then attach it by id.
|
|
128
|
+
|
|
129
|
+
### Attaching
|
|
130
|
+
attach_file_link files an existing file against a ledger record, a todo or an idea. attach_todo_file is the todo's own Files pane. An upload can carry links at confirm time.
|
|
131
|
+
|
|
132
|
+
### Downloading
|
|
133
|
+
get_file_download_url mints a short-lived link that anyone holding it can use, and every one is recorded in the file access log. Request one only when you are about to fetch the bytes, never paste it back to the user unasked, and never request links for a whole library to "check" it. For an encrypted file the answer also releases its decryption key permanently, so the same care applies twice.
|
|
134
|
+
|
|
135
|
+
### Deleting
|
|
136
|
+
delete_file moves a file to Trash; restore_file brings it back for 60 days. Folders: delete_file_folder refuses a non-empty folder.
|
|
137
|
+
|
|
138
|
+
## Safety, permissions and errors
|
|
139
|
+
|
|
140
|
+
### Ask the user before
|
|
141
|
+
- any create_transaction or sell_all_position (the ledger cannot be edited afterwards);
|
|
142
|
+
- data_apply (show the dry-run preview first);
|
|
143
|
+
- every permanent delete: delete_position (takes its whole ledger), delete_entity, delete_account, delete_asset, delete_institution and the other catalog deletes, delete_entity_group, delete_bookmark_folder, delete_tab, delete_todo_tag, delete_todo_state;
|
|
144
|
+
- sync_prices over the whole catalog;
|
|
145
|
+
- minting download links for more than the file the user asked about.
|
|
146
|
+
Tensor enforces the first list's deletes itself: the call answers NOT DELETED with what would go and a confirmToken. Show the user that preview in plain words and pass the token back only after they say yes; never confirm on your own. A refused delete names what still uses the record: tell the user, do not work around it.
|
|
147
|
+
Soft deletes (todos, ideas, files, bookmarks, tab groups) are recoverable for 60 days with the restore_ tools (list_trash finds them), but still say what you are moving to Trash, including a todo's sub-tasks. Trash empties itself after those 60 days; for an idea the user wants to keep but no longer see, archive_idea is the right verb, because Archive never expires.
|
|
148
|
+
|
|
149
|
+
### Retrying
|
|
150
|
+
Every write a retry could duplicate takes an optional idempotencyKey. Use a fresh unique value per intended write and the SAME value when you retry that write after a timeout or a network error; Tensor then returns the first result instead of writing again. Never reuse a key for a different write.
|
|
151
|
+
|
|
152
|
+
### What this connection can do
|
|
153
|
+
Each connection carries scopes (portfolio, reference, files, todos, ideas, bookmarks, tabs, each read or write, plus the data pipeline). Only the tools its scopes reach are listed, and a 403 names a missing scope. Some things no connection can do, by design: read memos or browsing history; change FX rates, loan terms or fund terms (they are read-only); empty a Trash or permanently purge; create API keys or change its own access. When you cannot do something, tell the user which scope or which part of the Tensor app it needs.
|
|
154
|
+
|
|
155
|
+
### Errors
|
|
156
|
+
- 400: the input was refused; the message says which field and why. Fix it rather than retrying as is.
|
|
157
|
+
- 401: the credential is revoked, expired or wrong. The user must reconnect Tensor.
|
|
158
|
+
- 403: a missing scope (named in the message) or something no connection may do. Do not retry.
|
|
159
|
+
- 404: no such record for this connection. Check the id with search_records or a list_ call.
|
|
160
|
+
- 409: a conflict with the record's current state (a cycle, a state still in use, a stale update), an idempotencyKey problem, or delete_blocked (other records still use this one). The message says which.
|
|
161
|
+
- 428: not an error. A permanent delete is waiting for the user's yes; see "Ask the user before".
|
|
162
|
+
- 429: rate limited (an API key allows 120 requests a minute). Wait as told, then continue. Batch work instead of looping single calls.
|
|
163
|
+
- 5xx: Tensor failed. One retry is fine; then report it with the errorId.
|
|
164
|
+
|
|
165
|
+
### Being a good guest
|
|
166
|
+
Results are compact JSON. Ask for what you need: filter server-side, page with limit and nextOffset, and prefer get_portfolio_summary and list_changes over pulling whole tables.
|