摘要
从 Korea Investment & Securities(韩国投资证券)的 KIS Developers Open API 读取韩国和海外市场数据:股票和 ETF 行情、日 K 线和分钟 K 线、盘口、按投资者类型的资金流向、KOSPI 和 KOSDAQ 指数,以及美国、日本、香港和中国股票价格。只读,不能交易。
引导式设置
2 分钟将 Korea Investment & Securities 连接到 Cursor
开始 AnythingMCP Cloud 免费试用,在引导式设置中连接 Korea Investment & Securities,再把你的 MCP URL 添加到 Cursor。无需代码,也无需自行运行服务器。
无需信用卡 · 7 天试用 · 提供自托管方案
试试这样问
Korea Investment & Securities 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Korea Investment & Securities、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
Korea Investment & Securities + Cursor
从 Korea Investment & Securities(韩国投资证券)的 KIS Developers Open API 读取韩国和海外市场数据:股票和 ETF 行情、日 K 线和分钟 K 线、盘口、按投资者类型的资金流向、KOSPI 和 KOSDAQ 指数,以及美国、日本、香港和中国股票价格。只读,不能交易。
前提条件
完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:
KIS_APP_KEY, KIS_APP_SECRET
步骤 1 — 获取凭证
设置只需几分钟。你需要一个 Korea Investment & Securities(한국투자증권)的证券账户,并为该账户开通 KIS Developers 的 Open API 服务,开通后会得到 App Key 和 App Secret。
仅限行情数据:连接器读取行情、K 线、盘口、按投资者类型的资金流向、指数和证券基本资料。它不能下单、改单或撤单,也不读取账户余额、持仓或存款。WebSocket 实时推送、期货和期权以及债券交易同样不在支持范围内。
- 在 apiportal.koreainvestment.com(KIS Developers,API 신청)申请 Open API 服务,并选择用于 实盘交易(실전투자) 的账户。
- 把 App Key 复制到
KIS_APP_KEY,把显示在它旁边的 App Secret 复制到KIS_APP_SECRET。App Key 由 20 到 64 个字母和数字组成;App Secret 是一串约 180 个字符的长字符串:请完整粘贴,不要带空格或换行。 - 安装连接器。用
korea_investment_get_stock_price和代码005930(Samsung Electronics)检查连接。
只能使用实盘交易的密钥:模拟交易(모의투자)的密钥只能在 KIS 的另一个主机 openapivts.koreainvestment.com:29443 上使用,而本连接器不使用该主机。用实盘密钥读取行情不会产生任何交易。
令牌:连接器用 App Key 和 App Secret 换取访问令牌(POST /oauth2/tokenP),并在每次调用时连同 KIS 要求的请求头一起发送。KIS 令牌有效期为 24 小时,KIS 大约每分钟只允许申请一次令牌;6 小时内再次申请会返回同一个令牌,而且每发放一个新令牌,KIS 都可能发送一条 KakaoTalk 通知。连接器会保存令牌,只在快到期时才申请新令牌。
Cloud 和自托管的方式相同:两者都使用你自己的 App Key 和 App Secret。自托管服务器必须允许向 openapi.koreainvestment.com 的 9443 端口发起出站连接。
限流和分页:使用实盘密钥时,KIS 允许每个账户每秒约 20 次调用;EGW00201 表示调用过多,请放慢速度。K 线和历史数据工具每次调用返回约 100 行,分钟 K 线最多 30 根:要查更早的数据,请用更早的结束日期或时间再次调用。
代码:韩国股票、ETF 和 ETN 使用六位短代码(005930 Samsung Electronics、000660 SK hynix、035420 NAVER、069500 KODEX 200);ETN 前面加 Q。行情默认来自 KRX,也可按需来自 Nextrade(NXT)或两者合并。韩国指数为四位数字:0001 KOSPI、1001 KOSDAQ、2001 KOSPI 200。海外股票需要交易所代码加股票代码,例如 NAS + AAPL、NYS + KO、TSE + 7203、HKS + 00700。海外指数、汇率、债券和黄金的代码(如 SPX 或 .DJI)见 KIS 的海外指数主文件。
日期、时间和价格:日期格式为 YYYYMMDD,时间格式为 HHMMSS,均为韩国时间(KST,UTC+9)。韩国价格以 KRW 计,海外价格以当地货币计。KIS 返回的字段名是韩文缩写,例如 stck_prpr(当前价)、prdy_vrss(较前收盘价的涨跌)、prdy_ctrt(涨跌幅,百分比)和 acml_vol(成交量)。
美股行情可能有延迟:美股实时行情需要在 KIS 应用中另行订阅。未订阅时,美股价格有延迟。
常见错误:每个响应都带有 rt_cd(0 表示成功)以及说明问题的 msg_cd 和 msg1。App Key 或 App Secret 被拒绝(401)通常表示密钥复制不完整,或属于模拟交易账户。403 表示该账户未开通 Open API 服务、App Key 已被重新发放,或距上次申请令牌不到一分钟:等一分钟再试。如果无法连接 openapi.koreainvestment.com:9443,说明到 9443 端口的出站连接被阻止。
可读取的内容:韩国股票、ETF 和 ETN 的当前行情,包括涨跌、成交量、成交额、涨跌停价、52 周最高和最低价、PER、PBR、EPS、BPS、市值和外资持股比例;日、周、月、年 K 线以及当天的分钟 K 线;逐笔成交;十档盘口和预期竞价价格;个人、外资和机构的净买入;韩国上市产品的基本资料;KOSPI、KOSDAQ、KOSPI 200 和行业指数的点位与历史;美国、日本、香港、中国和越南股票的行情、详细行情、历史、盘口和基本资料;海外指数、汇率、国债和黄金期货的 K 线。
只读:全部 16 个工具都只读取行情数据,因此安装时没有工具被关闭。行情数据仅供参考,不构成投资建议。
步骤 2 — 安装 adapter
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
步骤 3 — 在 Cursor 中添加连接器
你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(
https://cloud.anythingmcp.com/mcp/…)。本指南中出现YOUR_SERVER_ID的地方都用它替换。
Cursor 从 ~/.cursor/mcp.json 读取 MCP 服务器。添加以下条目:
{
"mcpServers": {
"anythingmcp": {
"url": "https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID",
"headers": { "X-API-Key": "YOUR_MCP_API_KEY" }
}
}
}
- 在 AnythingMCP 的 MCP Servers → 你的服务器 → API keys 中创建 MCP API 密钥,并用它替换
YOUR_MCP_API_KEY。 - 保存文件并重启 Cursor。
- 打开 Cursor → Settings → MCP,确认
anythingmcp已列出并处于已连接状态。 - 开始对话 — 智能体现在可以调用
Korea Investment & Securities的工具。
可用工具
| Tool | What it does |
|---|---|
korea_investment_get_stock_price | Current quote of one Korean stock, ETF or ETN: last price (stck_prpr), change and change rate against the previous close (prdy_vrss… |
korea_investment_get_daily_prices | Last 30 trading days (or 30 weeks or 30 months) of one Korean stock: per row the date (stck_bsop_date), open, high, low, close, change… |
korea_investment_get_price_chart | Daily, weekly, monthly or yearly candles (OHLCV) of one Korean stock between two dates, at most 100 candles per call: output1 is the… |
korea_investment_get_minute_chart | One-minute candles of one Korean stock for today, up to 30 per call, ending at a given time: output1 is the quote summary, output2 the… |
korea_investment_get_orderbook | Order book of one Korean stock: the ten best ask and bid prices with their remaining quantities (askp1..10, bidp1..10, askp_rsqn1..10… |
korea_investment_get_trades_by_time | Time-and-sales of one Korean stock today: executions at or before a given time with price, change, volume per print and execution strength… |
korea_investment_get_investor_flows | Net buying by investor type for one Korean stock over the recent trading days: individuals (prsn_ntby_qty), foreigners (frgn_ntby_qty) and… |
korea_investment_get_stock_info | Basic master data of a Korean listed product: Korean and English names (prdt_name, prdt_eng_name), listing market, sector classification… |
korea_investment_get_index_price | Current level of a Korean market or sector index: index value (bstp_nmix_prpr), change and change rate, open, high, low, volume and traded… |
korea_investment_get_index_daily_prices | History of a Korean market or sector index up to a given date, one row per day, week or month (about 100 rows per call): date, close… |
korea_investment_get_overseas_price | Current quote of a foreign stock (US, Japan, Hong Kong, China, Vietnam): last price (last), previous close (base), change and change rate… |
korea_investment_get_overseas_price_detail | Detailed quote of a foreign stock: open, high, low, previous close, 52-week high and low with their dates, PER, PBR, EPS, BPS, market… |
korea_investment_get_overseas_daily_prices | Daily, weekly or monthly history of a foreign stock up to a given date, about 100 rows per call: date (xymd), close (clos), change, open… |
korea_investment_get_overseas_orderbook | Order book of a foreign stock: best ask and bid prices with quantities (ten levels for US stocks, one level elsewhere) and the current… |
korea_investment_get_overseas_index_chart | Daily, weekly, monthly or yearly candles of a foreign index, exchange rate, government bond or gold future between two dates (about 100… |
korea_investment_get_overseas_stock_info | Master data of a foreign stock as KIS lists it: Korean and English names, exchange, currency, listing status, tick size, minimum order… |
示例提示
- “Samsung Electronics(005930)现在走势如何?它的 PER、PBR 和外资持股比例是多少?”
- “给我看 SK hynix 最近三个月的日 K 线,以及这段时间的最高收盘价。”
- “最近几个交易日,外资或机构是否净买入了 NAVER?”
- “今天 KOSPI 和 KOSDAQ 在什么点位?KOSPI 有多少只股票上涨、多少只下跌?”
- “比较 Apple 和丰田:最新价格、今日涨跌,以及 52 周最高和最低价。”
FAQ
Cursor 免费套餐支持自定义 MCP 服务器吗? 支持 — Hobby、Pro 和 Business 套餐均可使用 MCP。
下一步
这份指南对你有帮助吗?