Sarwa Tools
An unofficial, read-only MCP server for Sarwa Odyssey that provides portfolio, holdings, transactions, watchlists, and agent snapshots via deterministic JSON documents.
README
Sarwa Tools
An unofficial, read-only Sarwa CLI, MCP server, and Node API for humans, scripts, and AI agents using Sarwa Odyssey.
It is intentionally small: portfolio, holdings, transactions, curated market lists, and deterministic agent snapshots. There are no trading, funding, raw-request, embedded LLM, or debug commands.
Sarwa does not publish a supported Odyssey developer API. Internal endpoints may change. Use this only with your own account.
Install
Requires Node.js 22.12+ and Chrome, Edge, or Chromium.
npm install -g sarwa-tools
sarwa auth login
Sign-in happens in a dedicated local browser profile. The CLI never asks for,
reads, prints, or stores your password. The browser keeps the Sarwa session and
refreshes short-lived authorization automatically; run sarwa auth login again only
if Sarwa expires the browser session.
If a managed Chrome installation blocks browser automation, install Playwright's compatible Chrome for Testing build. The CLI detects it automatically:
npx playwright-core@1.62.0 install chromium
sarwa auth status
You can instead set SARWA_BROWSER_EXECUTABLE to the absolute path of an
unmanaged Chrome, Edge, or Chromium executable.
Commands
sarwa # portfolio summary (same as `sarwa portfolio`)
sarwa portfolio # value, P&L, deposits, spend, cash, top holdings
sarwa holdings # current positions, largest first
sarwa watchlist # Sarwa's most-popular market list
sarwa transactions # latest portfolio activity
sarwa snapshot # portfolio, holdings, activity, and local watchlist
sarwa monitor --once # changes since the last complete snapshot
sarwa auth login # sign in or refresh the browser session
sarwa auth status # inspect local session state
sarwa auth logout # remove the local browser session
Useful filters:
sarwa holdings --sort pnl --limit 10
sarwa holdings --sort return --asset-class crypto
sarwa watchlist --name top-movers --limit 10
sarwa transactions --symbol BTC --limit 20
sarwa holdings BTC # one-asset deep dive
sarwa portfolio --schema
Manage a private watchlist for your local agent without changing anything in Sarwa:
sarwa watchlist list
sarwa watchlist add NVDA --note "Watch earnings and position sizing"
sarwa watchlist remove NVDA
sarwa watchlist without a subcommand remains Sarwa's curated market list.
Local watchlist writes are stored atomically in the CLI's private configuration
directory with user-only permissions.
If more than one open Trade account exists, the CLI reports the available IDs;
select one with --account ID.
MCP server
The package includes a local stdio MCP server for agents. It uses the same secure browser session and deterministic portfolio documents as the CLI; it does not contain or configure an LLM.
Authenticate once outside MCP:
sarwa auth login
Then configure an MCP host to launch sarwa-mcp:
{
"mcpServers": {
"sarwa": {
"command": "sarwa-mcp"
}
}
}
Headless Linux and VPS hosts
sarwa auth login intentionally opens a visible browser so the user completes
Sarwa sign-in and MFA directly. On a headless server, perform this one-time step
through a temporary trusted VNC or X11 session as the same unprivileged Unix user
that will run the MCP host. Login is not exposed as an MCP tool.
Before logging in, configure a working Secret Service/Libsecret or KWallet
session for that user. Chromium can fall back to
its unencrypted basic password store when no OS credential store is available.
Close the temporary graphical session after login, then verify both
authentication and session persistence:
sarwa auth status --json
sarwa snapshot --json
# Reboot the host, then run both commands again.
For a service-managed MCP host, use absolute paths for Node and
bin/sarwa-mcp.js, set SARWA_CONFIG_DIR explicitly, and keep the configuration
directory private. Do not run the browser or MCP server as root.
The server exposes tools for authentication status, accounts, portfolio, holdings, holding detail, transactions, Sarwa-curated market lists, the private agent watchlist, snapshots, monitor checks, and an explicit destructive monitor reset. It intentionally exposes no login, logout, trading, funding, raw-request, or LLM tools.
Each authenticated tool call owns and closes its browser session, so a
long-running MCP host does not retain the browser-profile lock between calls.
MCP calls are serialized inside the server to keep local profile and monitor
state deterministic. Programmatic Node consumers can import MCP construction
from sarwa-tools/mcp; the default sarwa-tools export remains independent
of the MCP SDK.
Agent output
Output is automatically structured JSON when piped or captured:
sarwa portfolio | jq
sarwa holdings | jq '.holdings[] | {symbol, value, pnl}'
sarwa transactions --symbol SPYM | jq
sarwa snapshot | jq '.snapshot'
sarwa monitor --once | jq '.monitor.events'
Use --json to force formatted JSON or --compact for one-line JSON:
sarwa --json portfolio
sarwa --compact holdings
Successful machine responses include stable schema_version, fetched_at,
source_as_of, partial, and warnings fields plus a resource-specific field
such as portfolio or holdings. Errors include schema_version and error,
and exit with 1 (request/data error) or 2 (authentication required).
Snapshot and monitor
snapshot opens one authenticated browser session and returns a coherent
agent-ready document containing:
- portfolio totals and top positions;
- all current holdings;
- up to 100 recent transactions by default;
- transaction coverage metadata;
- the local watchlist, enriched with matching held positions.
Use sarwa snapshot --all-transactions when the caller needs the complete
available activity history.
monitor --once compares the latest complete snapshot with the previous
successful run for the same Trade account. Account IDs are hashed into private,
account-scoped baseline filenames, so monitoring multiple accounts cannot
compare or overwrite unrelated portfolios. It emits deterministic events for
newly opened or closed positions, quantity changes, new transactions, and local
watchlist additions or removals. Portfolio value, P&L, and cash changes are
included as numeric deltas without creating noisy events.
Each event ID is scoped to the observation that produced it, so repeated real transitions remain distinct while replaying the same observation remains idempotent. If overlapping monitor runs finish out of order, an older or duplicate observation is reported as stale and cannot replace the newer baseline.
The first complete run creates a baseline and intentionally emits no historical
events. A partial or incomplete Sarwa read never advances that baseline. Use
sarwa monitor --reset to deliberately replace it without emitting events.
Version 1.1.0 introduces account-scoped baseline files, so the first monitor run
per account after upgrading initializes a new baseline.
The CLI does not call or configure an LLM. An external agent such as Hermes can
schedule sarwa --compact monitor --once, parse the versioned JSON, and perform
its own analysis or notification logic.
Metric meanings
value,total_pnl,net_deposits,day_pnl, andcashcome from Sarwa's Trade account summary.- Holding value and unrealized P&L come from Sarwa's current positions.
gross_buy_spendsums filled buy orders returned by Odyssey. It is cumulative cash outlay, not current cost basis or realized P&L.sarwa watchlistassets are Sarwa-curated.sarwa watchlist list/add/removemanages a separate, local-only agent list.
Safety
All Sarwa requests are authenticated GET requests. The CLI and MCP server
have no buy, sell, cancel, deposit, withdrawal, or transfer capability. The MCP
server listens only on local stdio; it opens no network port. Configure it only
in agents you trust, and treat terminal, JSON, MCP output, and local
monitor/watchlist state as sensitive financial data.
Run the local checks with:
npm run verify
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。