tossinvest-mcp is a local MCP server used to connect the Toss Securities Open API (the open interface of the Korean brokerage Toss Securities) to AI clients that support MCP, such as OpenAI services, Claude Desktop, Cursor, and others. After users register this server with an MCP client, they can use natural language to have the AI call Toss Securities' market data query and trading functions.
Purpose
The core purpose of this tool is to enable AI assistants to access Toss Securities' account and market data, and to execute order placement, modification, and cancellation operations after the user explicitly enables them. It itself does not provide investment advice or return guarantees; it is only a connection layer.
Main Capabilities
Query Functions (Enabled by Default)
- Real-time market data queries for Korean/US stocks (current price)
- Korean/US market operating hours queries
- Account-related queries such as order book, candlestick chart, positions, and buying power (requires accountSeq)
Trading Functions (Disabled by Default, Must Be Manually Enabled)
toss_create_order: create an ordertoss_modify_order: modify an order (the Toss API handles this by replacing the original order and returns a new orderId; subsequent operations must use the new orderId)toss_cancel_order: cancel an order
Runtime Features
- Started via
npx tossinvest-mcp, no separate installation required - API Key and Secret Key are passed in via environment variables
- OAuth Token is issued automatically and refreshed automatically 60 seconds before expiration
- Functions that require an account use accountSeq account 1 by default, and this can be changed via
TOSSINVEST_ACCOUNT- Order API requests are automatically interrupted after 20 seconds if there is no response clientOrderIdIf not provided, it is automatically generated with the prefixtossinvest-mcp-YYYYMMDD-, and Toss uses it as a 10-minute deduplication key
How to Use
1. Environment Preparation
- Confirm that Node.js v20 or later is installed
- Obtain the API Key and Secret Key from the Open API settings in Toss Securities WTS
- Add this machine's public IP to the allowed IP list of the Toss Securities Open API (if not registered, an "IP address not allowed" error will occur)
2. Register with an MCP Client
Add the server configuration to the MCP client's configuration file, and pass the API Key and Secret Key in as environment variables. After configuration, fully close and restart the MCP client. On first startup, npm will automatically download the tossinvest-mcp package.
3. Multi-Account Setup
If there is more than one account, you can obtain the accountSeq by querying the account list, and set TOSSINVEST_ACCOUNT to specify the default account. If not set, 1 is used by default.
4. Enable Trading
Add TOSSINVEST_ENABLE_TRADING=true to the MCP configuration's env to register the order tools. Even if enabled, by default each order placement still requires entering confirmOrderAction: true in the request before the Toss API is actually called.
Trading Guardrails
All checks are enforced server-side before calling the Toss order API; guardrails that are not enabled do not take effect. The main environment variables include:
TOSSINVEST_REQUIRE_ORDER_CONFIRMATION: set tofalseto disable theconfirmOrderActionrequirement, but other guardrails still take effectTOSSINVEST_MAX_ORDER_AMOUNT_KRW/TOSSINVEST_MAX_ORDER_AMOUNT_USD: maximum amount per single KRW/USD transactionTOSSINVEST_DAILY_AMOUNT_LIMIT_KRW/TOSSINVEST_DAILY_AMOUNT_LIMIT_USD: maximum cumulative amount per dayTOSSINVEST_DAILY_ORDER_COUNT_LIMIT: maximum number of orders per dayTOSSINVEST_ALLOWED_SYMBOLS: whitelist of instruments allowed for trading (comma-separated; use a 6-digit code for Korea and a ticker for the US)TOSSINVEST_ALLOW_SELL_ORDERS: whether selling is allowed (default false)TOSSINVEST_ALLOW_MARKET_ORDERS: whether market orders are allowed (default false)TOSSINVEST_MARKET_ORDER_BUFFER_PERCENT: buffer percentage used when estimating the amount for market buy ordersTOSSINVEST_LOCK_ACCOUNT: Whether to lock the account (requests are blocked if the order accountSeq differs from the default account)TOSSINVEST_GUARD_STATE_PATH: Path to the daily limit statistics file
The daily limit only counts orders successfully submitted through this MCP, and both creations and modifications are counted (a modification is counted as 1 new order); cancellations are not counted and are always allowed. When the daily amount limit is enabled, before each order the day's unfilled orders are queried again and the executed amount plus the unfilled remaining amount is calculated; if the query fails, it is treated as unverifiable and new orders are blocked.
Applicable scenarios and limitations
Applicable scenarios
- Querying Korean/US stock quotes, positions, and buying power in an AI client
- Executing orders, modifying orders, and canceling orders with AI assistance under strict guardrails
- For users who want to connect the Toss Securities API to local automation workflows
Limitations and notes
- The Toss Securities Open API has no sandbox or paper trading environment; once trading is enabled, real orders are executed on a real account
- This program does not provide investment advisory services, investment recommendations, buy/sell advice, or return guarantees
- Queried information, AI-generated answers, and order content suggested by AI may be inaccurate, delayed, or inconsistent with the user's intent
- The user bears ultimate responsibility for all investment decisions and order execution
- This project is under development; the developer and publisher are not liable for investment losses, order errors, API failures, data errors, client exceptions, incorrect AI answers, etc.
- Modifying an order returns a new orderId; subsequent queries, further modifications, and cancellations must use the new orderId
- If
_guardStateWarningappears in the response, it indicates that the order was successfully submitted, but the internal limit record may be partially missing, and another order should not be placed
Toss Securities Open API official documentation:https://developers.tossinvest.com/docs