使用说明
T-Invest MCP服务器
MCP服务器与Claude和其他LLM客户的T-Investment API(Tinkoff Investment)一起工作。
港口 t-invest-mcp服务器 关于Node.js
工具(30)
账户管理
工具参数描述
|---|---|---|
| get_accounts 经纪账户列表
| get_bank_accounts 银行账户列表
| get_user_info –用户配置文件(费率,Qual.Investor)→
| get_user_tariff –API限制(请求/分钟,流媒体)→
| get_portfolio | accountId, tickers#22312;票过滤账户的公文包。
| get_positions | accountId 账户头寸(货币、证券、期货)→
| get_withdraw_limits | accountId*取款限额。
| get_margin_attributes | accountId*^保证金属性(流动投资组合,初始保证金)→
| get_account_values | accountIds更多账户指标
| pay_in | fromAccountId, toAccountId, amount, currency!从银行存款。
| currency_transfer | fromAccountId, toAccountId, amount, currency#21518;经纪账户之间的转账。
分析和工具
工具参数描述
|---|---|---|
| get_asset_fundamentals | tickers*基本面:P/E、ROE、息税折旧摊销前利润等。(最多100张)
| get_last_prices | tickers*当前市场价格(最多100张票)..
| get_candles | ticker, from, to, interval?|ИсторическиесвечиOHLCV(1分钟、5分钟、15分钟、小时、天、周、月)|
| get_dividends | tickers, from?, to股息日历(最多50张)
| get_bond_coupons | tickers, from?, to债券息票支付(最多50张票)!
| get_consensus_forecasts | tickers –分析师共识预测(最多50个Ticker)→
| get_order_book | ticker, depth?一杯申请(深度1-50,默认为10)!
| get_trading_status | tickers #21518;牌交易状态(高达50)
| get_trading_schedules | exchange?, from, to –交易时间表(默认MOEX)→
| get_tech_analysis | ticker, indicator, from, to, interval?, length技术分析:BB、EMA、RSI、MACD、SMA
| get_signals | tickers?, from?, to?, direction?, limit#22269;贸易信号?
| get_max_lots | accountId, ticker, price#22312;的最大购买/销售数量。
业务历史
工具参数描述
|---|---|---|
| get_operations | accountId*, from?, to?, limit交易历史:交易、股息、佣金。
贸易业务
工具参数描述
|---|---|---|
| get_orders | accountId*活跃的股票交易
| post_order | accountId, ticker, direction, quantity, orderType, price申请(买入/卖出)
| cancel_order | accountId, orderId*取消股票交易。
| get_stop_orders | accountId*主动停止申请
| post_stop_order | accountId, ticker, direction, quantity, orderType, stopPrice, limitPrice?, expirationType?, expireDate#22312;申请停止。
| cancel_stop_order | accountId, stopOrderId 取消停止申请
* -必填参数, ? -可选
工作流程: 代理先呼叫
get_accounts记住accountId并在随后的请求中使用它。
环境变量
变种必备描述
|---|---|---|
| APP_T_INVEST_BASE_URL |да|URL API T-Invest|
| APP_T_INVEST_TOKEN 是的,token api(获得) |
| APP_T_INVEST_ALLOW_TRADING 没有 true -允许交易和转账。默认情况下,服务器处于只读模式›
销售URL: https://invest-public-api.tinkoff.ru/rest/
沙盒URL: https://sandbox-invest-public-api.tinkoff.ru/rest/
安全
服务器通过API处理真实货币。一些大大降低风险的规则:
- 默认情况下,禁止交易。 如果
APP_T_INVEST_ALLOW_TRADING未指定,服务器以只读模式启动。在这种模式下,只记录读取工具,6个操作可以移动您的钱(post_order,cancel_order,post_stop_order,cancel_stop_order,pay_in,currency_transfer)一般不提供LLM。这对于分析、报告和投资组合监控来说已经足够了。 - 仅通过有意识的方式启用交易
APP_T_INVEST_ALLOW_TRADING=true. 任何由LLM调用的交易, 不可逆转交易确认已委托给MCP客户端(Claude Desktop在调用工具之前会询问您),但这是最后一道防线,而不是第一道防线。如果你今天不打算通过助手交易,不要给他这样的机会。 - 创建具有最低权限的单独令牌 的 developer.tbank.ru如果不需要交易-只读令牌。不要“以防万一”使用具有完全权限的主令牌。
- 仅在环境变量中存储令牌 或者秘密经理。不要把它复制到
claude_desktop_config.json直接,如果文件进入云备份/git/shared机器。在macOS上,配置令牌可以看到用户的所有进程。 - 仅使用HTTPS URL 为了
APP_T_INVEST_BASE_URL服务器拒绝从http://这是故意的。 - 永远不要发货
.env不要将代币插入issue/pr/chat。检查一下.gitignore覆盖.env和*.log.
服务器本身不记录令牌,也不将令牌包含在MCP响应中,但通过环境、配置或shell历史记录的任何泄漏都由用户控制。
Claude Desktop中的配置
配置文件: ~/Library/Application Support/Claude/claude_desktop_config.json
通过NPX
{
"mcpServers": {
"t-invest": {
"command": "npx",
"args": ["t-invest-mcp-server"],
"env": {
"APP_T_INVEST_BASE_URL": "https://invest-public-api.tinkoff.ru/rest/",
"APP_T_INVEST_TOKEN": "your_token"
}
}
}
}
添加
"APP_T_INVEST_ALLOW_TRADING": "true"只有当你有意识地想给LLM机会下订单和转移资金。
通过Docker
{
"mcpServers": {
"t-invest": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "APP_T_INVEST_BASE_URL=https://invest-public-api.tinkoff.ru/rest/",
"-e", "APP_T_INVEST_TOKEN=your_token",
"t-invest-mcp-server"
]
}
}
}
发射
npx
APP_T_INVEST_BASE_URL=https://invest-public-api.tinkoff.ru/rest/ \
APP_T_INVEST_TOKEN=your_token \
npx t-invest-mcp-server
码头工人
docker build -t t-invest-mcp-server .
docker run -i --rm \
-e APP_T_INVEST_BASE_URL=https://invest-public-api.tinkoff.ru/rest/ \
-e APP_T_INVEST_TOKEN=your_token \
t-invest-mcp-server
源代码
npm install
npm run build
npm start
显示器
这个项目是一个非官方的工具,与T银行(Tinkoff)无关。服务器通过公共T-Investment API与财务数据和交易操作交互。用户对自己的行为完全负责。在交易所交易会带来资金损失的风险。
许可证
麻省理工学院