[{"data":1,"prerenderedAt":890},["ShallowReactive",2],{"docs-page-mcp":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"body":10,"_type":884,"_id":885,"_source":886,"_file":887,"_stem":888,"_extension":889},"\u002Fdocs\u002Fmcp","docs",false,"","MCP 接入","在 Cursor 等 AI 客户端通过 MCP 接入 KlineShare A 股行情；配置 X-API-Key，用自然语言查实时、分时与 K 线。",{"type":11,"children":12,"toc":875},"root",[13,22,36,55,61,103,137,142,147,191,197,202,337,342,415,420,535,540,864,869],{"type":14,"tag":15,"props":16,"children":18},"element","h2",{"id":17},"mcpai-客户端-mcp",[19],{"type":20,"value":21},"text","MCP（AI 客户端） {#mcp}",{"type":14,"tag":23,"props":24,"children":25},"p",{},[26,28,34],{"type":20,"value":27},"MCP 用于在",{"type":14,"tag":29,"props":30,"children":31},"strong",{},[32],{"type":20,"value":33},"你自己使用的 AI 客户端",{"type":20,"value":35},"里直接查行情（实时、K 线、涨停等）。配置写在客户端本地或设置页，不是写在我们服务器上；调用仍走同一套 API Key、scope、限流。",{"type":14,"tag":23,"props":37,"children":38},{},[39,44,46,53],{"type":14,"tag":29,"props":40,"children":41},{},[42],{"type":20,"value":43},"远程端点：",{"type":20,"value":45}," ",{"type":14,"tag":47,"props":48,"children":50},"code",{"className":49},[],[51],{"type":20,"value":52},"https:\u002F\u002Fmarket-api.cn\u002Fmcp",{"type":20,"value":54},"（Streamable HTTP）",{"type":14,"tag":56,"props":57,"children":59},"h3",{"id":58},"配置步骤",[60],{"type":20,"value":58},{"type":14,"tag":62,"props":63,"children":64},"ol",{},[65,79,91],{"type":14,"tag":66,"props":67,"children":68},"li",{},[69,71,77],{"type":20,"value":70},"在用户中心签发 API Key（",{"type":14,"tag":47,"props":72,"children":74},{"className":73},[],[75],{"type":20,"value":76},"tg_...",{"type":20,"value":78},"）",{"type":14,"tag":66,"props":80,"children":81},{},[82,84,89],{"type":20,"value":83},"在 MCP 客户端中添加远程服务（见下方 JSON；各产品入口见门户 ",{"type":14,"tag":47,"props":85,"children":87},{"className":86},[],[88],{"type":20,"value":4},{"type":20,"value":90}," 页的「兼容客户端」表）",{"type":14,"tag":66,"props":92,"children":93},{},[94,96,101],{"type":20,"value":95},"保存并",{"type":14,"tag":29,"props":97,"children":98},{},[99],{"type":20,"value":100},"刷新 MCP 连接",{"type":20,"value":102},"，在对话中提问，例如「查 600519.SS 最近 20 根日 K」",{"type":14,"tag":23,"props":104,"children":105},{},[106,111,113,122,124,135],{"type":14,"tag":29,"props":107,"children":108},{},[109],{"type":20,"value":110},"说明：",{"type":20,"value":112}," 只有支持 MCP 的客户端才能接入。无法安装 MCP 时，请用 ",{"type":14,"tag":114,"props":115,"children":119},"a",{"href":116,"rel":117},"https:\u002F\u002Fmarket-api.cn\u002Fdocs\u002Fskills",[118],"nofollow",[120],{"type":20,"value":121},"Agent Skill",{"type":20,"value":123},"（教 Agent 走 REST），或 REST API，或将 ",{"type":14,"tag":114,"props":125,"children":128},{"href":126,"rel":127},"https:\u002F\u002Fmarket-api.cn\u002Fllms-full.txt",[118],[129],{"type":14,"tag":47,"props":130,"children":132},{"className":131},[],[133],{"type":20,"value":134},"llms-full.txt",{"type":20,"value":136}," 作为上下文交给模型阅读。",{"type":14,"tag":56,"props":138,"children":140},{"id":139},"鉴权",[141],{"type":20,"value":139},{"type":14,"tag":23,"props":143,"children":144},{},[145],{"type":20,"value":146},"与 REST 相同，任选其一：",{"type":14,"tag":148,"props":149,"children":150},"ul",{},[151,162,172],{"type":14,"tag":66,"props":152,"children":153},{},[154,156],{"type":20,"value":155},"Header：",{"type":14,"tag":47,"props":157,"children":159},{"className":158},[],[160],{"type":20,"value":161},"X-API-Key: tg_xxx",{"type":14,"tag":66,"props":163,"children":164},{},[165,166],{"type":20,"value":155},{"type":14,"tag":47,"props":167,"children":169},{"className":168},[],[170],{"type":20,"value":171},"Authorization: Bearer tg_xxx",{"type":14,"tag":66,"props":173,"children":174},{},[175,177,183,185],{"type":20,"value":176},"Query：",{"type":14,"tag":47,"props":178,"children":180},{"className":179},[],[181],{"type":20,"value":182},"?token=tg_xxx",{"type":20,"value":184}," 或 ",{"type":14,"tag":47,"props":186,"children":188},{"className":187},[],[189],{"type":20,"value":190},"?api_key=tg_xxx",{"type":14,"tag":56,"props":192,"children":194},{"id":193},"配置-json",[195],{"type":20,"value":196},"配置 JSON",{"type":14,"tag":23,"props":198,"children":199},{},[200],{"type":20,"value":201},"Header 传 Key（推荐）：",{"type":14,"tag":203,"props":204,"children":208},"pre",{"className":205,"code":206,"language":207,"meta":7,"style":7},"language-json shiki shiki-themes github-dark","{\n  \"mcpServers\": {\n    \"klineshare\": {\n      \"url\": \"https:\u002F\u002Fmarket-api.cn\u002Fmcp\",\n      \"headers\": { \"X-API-Key\": \"tg_你的密钥\" }\n    }\n  }\n}\n","json",[209],{"type":14,"tag":47,"props":210,"children":211},{"__ignoreMap":7},[212,224,239,252,277,310,319,328],{"type":14,"tag":213,"props":214,"children":217},"span",{"class":215,"line":216},"line",1,[218],{"type":14,"tag":213,"props":219,"children":221},{"style":220},"--shiki-default:#E1E4E8",[222],{"type":20,"value":223},"{\n",{"type":14,"tag":213,"props":225,"children":227},{"class":215,"line":226},2,[228,234],{"type":14,"tag":213,"props":229,"children":231},{"style":230},"--shiki-default:#79B8FF",[232],{"type":20,"value":233},"  \"mcpServers\"",{"type":14,"tag":213,"props":235,"children":236},{"style":220},[237],{"type":20,"value":238},": {\n",{"type":14,"tag":213,"props":240,"children":242},{"class":215,"line":241},3,[243,248],{"type":14,"tag":213,"props":244,"children":245},{"style":230},[246],{"type":20,"value":247},"    \"klineshare\"",{"type":14,"tag":213,"props":249,"children":250},{"style":220},[251],{"type":20,"value":238},{"type":14,"tag":213,"props":253,"children":255},{"class":215,"line":254},4,[256,261,266,272],{"type":14,"tag":213,"props":257,"children":258},{"style":230},[259],{"type":20,"value":260},"      \"url\"",{"type":14,"tag":213,"props":262,"children":263},{"style":220},[264],{"type":20,"value":265},": ",{"type":14,"tag":213,"props":267,"children":269},{"style":268},"--shiki-default:#9ECBFF",[270],{"type":20,"value":271},"\"https:\u002F\u002Fmarket-api.cn\u002Fmcp\"",{"type":14,"tag":213,"props":273,"children":274},{"style":220},[275],{"type":20,"value":276},",\n",{"type":14,"tag":213,"props":278,"children":280},{"class":215,"line":279},5,[281,286,291,296,300,305],{"type":14,"tag":213,"props":282,"children":283},{"style":230},[284],{"type":20,"value":285},"      \"headers\"",{"type":14,"tag":213,"props":287,"children":288},{"style":220},[289],{"type":20,"value":290},": { ",{"type":14,"tag":213,"props":292,"children":293},{"style":230},[294],{"type":20,"value":295},"\"X-API-Key\"",{"type":14,"tag":213,"props":297,"children":298},{"style":220},[299],{"type":20,"value":265},{"type":14,"tag":213,"props":301,"children":302},{"style":268},[303],{"type":20,"value":304},"\"tg_你的密钥\"",{"type":14,"tag":213,"props":306,"children":307},{"style":220},[308],{"type":20,"value":309}," }\n",{"type":14,"tag":213,"props":311,"children":313},{"class":215,"line":312},6,[314],{"type":14,"tag":213,"props":315,"children":316},{"style":220},[317],{"type":20,"value":318},"    }\n",{"type":14,"tag":213,"props":320,"children":322},{"class":215,"line":321},7,[323],{"type":14,"tag":213,"props":324,"children":325},{"style":220},[326],{"type":20,"value":327},"  }\n",{"type":14,"tag":213,"props":329,"children":331},{"class":215,"line":330},8,[332],{"type":14,"tag":213,"props":333,"children":334},{"style":220},[335],{"type":20,"value":336},"}\n",{"type":14,"tag":23,"props":338,"children":339},{},[340],{"type":20,"value":341},"Query 传 Key：",{"type":14,"tag":203,"props":343,"children":345},{"className":205,"code":344,"language":207,"meta":7,"style":7},"{\n  \"mcpServers\": {\n    \"klineshare\": {\n      \"url\": \"https:\u002F\u002Fmarket-api.cn\u002Fmcp?token=tg_你的密钥\"\n    }\n  }\n}\n",[346],{"type":14,"tag":47,"props":347,"children":348},{"__ignoreMap":7},[349,356,367,378,394,401,408],{"type":14,"tag":213,"props":350,"children":351},{"class":215,"line":216},[352],{"type":14,"tag":213,"props":353,"children":354},{"style":220},[355],{"type":20,"value":223},{"type":14,"tag":213,"props":357,"children":358},{"class":215,"line":226},[359,363],{"type":14,"tag":213,"props":360,"children":361},{"style":230},[362],{"type":20,"value":233},{"type":14,"tag":213,"props":364,"children":365},{"style":220},[366],{"type":20,"value":238},{"type":14,"tag":213,"props":368,"children":369},{"class":215,"line":241},[370,374],{"type":14,"tag":213,"props":371,"children":372},{"style":230},[373],{"type":20,"value":247},{"type":14,"tag":213,"props":375,"children":376},{"style":220},[377],{"type":20,"value":238},{"type":14,"tag":213,"props":379,"children":380},{"class":215,"line":254},[381,385,389],{"type":14,"tag":213,"props":382,"children":383},{"style":230},[384],{"type":20,"value":260},{"type":14,"tag":213,"props":386,"children":387},{"style":220},[388],{"type":20,"value":265},{"type":14,"tag":213,"props":390,"children":391},{"style":268},[392],{"type":20,"value":393},"\"https:\u002F\u002Fmarket-api.cn\u002Fmcp?token=tg_你的密钥\"\n",{"type":14,"tag":213,"props":395,"children":396},{"class":215,"line":279},[397],{"type":14,"tag":213,"props":398,"children":399},{"style":220},[400],{"type":20,"value":318},{"type":14,"tag":213,"props":402,"children":403},{"class":215,"line":312},[404],{"type":14,"tag":213,"props":405,"children":406},{"style":220},[407],{"type":20,"value":327},{"type":14,"tag":213,"props":409,"children":410},{"class":215,"line":321},[411],{"type":14,"tag":213,"props":412,"children":413},{"style":220},[414],{"type":20,"value":336},{"type":14,"tag":56,"props":416,"children":418},{"id":417},"四种接入方式对比",[419],{"type":20,"value":417},{"type":14,"tag":421,"props":422,"children":423},"table",{},[424,443],{"type":14,"tag":425,"props":426,"children":427},"thead",{},[428],{"type":14,"tag":429,"props":430,"children":431},"tr",{},[432,438],{"type":14,"tag":433,"props":434,"children":435},"th",{},[436],{"type":20,"value":437},"方式",{"type":14,"tag":433,"props":439,"children":440},{},[441],{"type":20,"value":442},"作用",{"type":14,"tag":444,"props":445,"children":446},"tbody",{},[447,467,490,519],{"type":14,"tag":429,"props":448,"children":449},{},[450,462],{"type":14,"tag":451,"props":452,"children":453},"td",{},[454,460],{"type":14,"tag":47,"props":455,"children":457},{"className":456},[],[458],{"type":20,"value":459},"\u002Fv1\u002F*",{"type":20,"value":461}," REST",{"type":14,"tag":451,"props":463,"children":464},{},[465],{"type":20,"value":466},"程序、脚本、用户中心沙箱",{"type":14,"tag":429,"props":468,"children":469},{},[470,478],{"type":14,"tag":451,"props":471,"children":472},{},[473],{"type":14,"tag":47,"props":474,"children":476},{"className":475},[],[477],{"type":20,"value":134},{"type":14,"tag":451,"props":479,"children":480},{},[481,483,488],{"type":20,"value":482},"让模型",{"type":14,"tag":29,"props":484,"children":485},{},[486],{"type":20,"value":487},"读懂",{"type":20,"value":489},"接口与参数（@Docs、粘贴上下文）",{"type":14,"tag":429,"props":491,"children":492},{},[493,502],{"type":14,"tag":451,"props":494,"children":495},{},[496],{"type":14,"tag":47,"props":497,"children":499},{"className":498},[],[500],{"type":20,"value":501},"\u002Fmcp",{"type":14,"tag":451,"props":503,"children":504},{},[505,507,512,514],{"type":20,"value":506},"让",{"type":14,"tag":29,"props":508,"children":509},{},[510],{"type":20,"value":511},"已配置 MCP 的客户端",{"type":20,"value":513},"自动调工具",{"type":14,"tag":29,"props":515,"children":516},{},[517],{"type":20,"value":518},"查数据",{"type":14,"tag":429,"props":520,"children":521},{},[522,530],{"type":14,"tag":451,"props":523,"children":524},{},[525],{"type":14,"tag":114,"props":526,"children":528},{"href":116,"rel":527},[118],[529],{"type":20,"value":121},{"type":14,"tag":451,"props":531,"children":532},{},[533],{"type":20,"value":534},"不支持 MCP 时，教 Agent 用 REST 查数（可与 MCP 并存）",{"type":14,"tag":56,"props":536,"children":538},{"id":537},"可用工具",[539],{"type":20,"value":537},{"type":14,"tag":23,"props":541,"children":542},{},[543,549,551,557,558,564,565,571,572,578,580,586,588,594,595,601,602,608,609,615,616,622,623,629,630,636,637,643,644,650,651,657,658,664,665,671,672,678,679,685,686,692,693,699,700,706,707,713,714,720,721,727,728,734,735,741,742,748,749,755,756,762,763,769,770,776,777,783,784,790,791,797,798,804,805,811,813,819,820,826,827,833,834,840,841,847,848,854,856,862],{"type":14,"tag":47,"props":544,"children":546},{"className":545},[],[547],{"type":20,"value":548},"get_health",{"type":20,"value":550},"、",{"type":14,"tag":47,"props":552,"children":554},{"className":553},[],[555],{"type":20,"value":556},"get_my_permissions",{"type":20,"value":550},{"type":14,"tag":47,"props":559,"children":561},{"className":560},[],[562],{"type":20,"value":563},"get_realtime",{"type":20,"value":550},{"type":14,"tag":47,"props":566,"children":568},{"className":567},[],[569],{"type":20,"value":570},"get_trend",{"type":20,"value":550},{"type":14,"tag":47,"props":573,"children":575},{"className":574},[],[576],{"type":20,"value":577},"get_kline_v2",{"type":20,"value":579},"（K 线 v2）、",{"type":14,"tag":47,"props":581,"children":583},{"className":582},[],[584],{"type":20,"value":585},"get_kline",{"type":20,"value":587},"（过时）、",{"type":14,"tag":47,"props":589,"children":591},{"className":590},[],[592],{"type":20,"value":593},"get_index_realtime",{"type":20,"value":550},{"type":14,"tag":47,"props":596,"children":598},{"className":597},[],[599],{"type":20,"value":600},"get_index_trend",{"type":20,"value":550},{"type":14,"tag":47,"props":603,"children":605},{"className":604},[],[606],{"type":20,"value":607},"get_index_kline_v2",{"type":20,"value":579},{"type":14,"tag":47,"props":610,"children":612},{"className":611},[],[613],{"type":20,"value":614},"get_index_kline",{"type":20,"value":587},{"type":14,"tag":47,"props":617,"children":619},{"className":618},[],[620],{"type":20,"value":621},"get_stock",{"type":20,"value":550},{"type":14,"tag":47,"props":624,"children":626},{"className":625},[],[627],{"type":20,"value":628},"search_stocks",{"type":20,"value":550},{"type":14,"tag":47,"props":631,"children":633},{"className":632},[],[634],{"type":20,"value":635},"list_stocks",{"type":20,"value":550},{"type":14,"tag":47,"props":638,"children":640},{"className":639},[],[641],{"type":20,"value":642},"get_corp",{"type":20,"value":550},{"type":14,"tag":47,"props":645,"children":647},{"className":646},[],[648],{"type":20,"value":649},"get_finance_report",{"type":20,"value":550},{"type":14,"tag":47,"props":652,"children":654},{"className":653},[],[655],{"type":20,"value":656},"get_calendar",{"type":20,"value":550},{"type":14,"tag":47,"props":659,"children":661},{"className":660},[],[662],{"type":20,"value":663},"get_limit_up",{"type":20,"value":550},{"type":14,"tag":47,"props":666,"children":668},{"className":667},[],[669],{"type":20,"value":670},"get_limit_up_break",{"type":20,"value":550},{"type":14,"tag":47,"props":673,"children":675},{"className":674},[],[676],{"type":20,"value":677},"get_limit_down_pool",{"type":20,"value":550},{"type":14,"tag":47,"props":680,"children":682},{"className":681},[],[683],{"type":20,"value":684},"get_yesterday_limit_up",{"type":20,"value":550},{"type":14,"tag":47,"props":687,"children":689},{"className":688},[],[690],{"type":20,"value":691},"get_limit_up_ladder",{"type":20,"value":550},{"type":14,"tag":47,"props":694,"children":696},{"className":695},[],[697],{"type":20,"value":698},"get_limit_up_plates_trending",{"type":20,"value":550},{"type":14,"tag":47,"props":701,"children":703},{"className":702},[],[704],{"type":20,"value":705},"get_limit_up_plates_industry",{"type":20,"value":550},{"type":14,"tag":47,"props":708,"children":710},{"className":709},[],[711],{"type":20,"value":712},"get_limit_up_plates_concept",{"type":20,"value":550},{"type":14,"tag":47,"props":715,"children":717},{"className":716},[],[718],{"type":20,"value":719},"get_limit_up_plates_style",{"type":20,"value":550},{"type":14,"tag":47,"props":722,"children":724},{"className":723},[],[725],{"type":20,"value":726},"get_lhb",{"type":20,"value":550},{"type":14,"tag":47,"props":729,"children":731},{"className":730},[],[732],{"type":20,"value":733},"get_lhb_daily",{"type":20,"value":550},{"type":14,"tag":47,"props":736,"children":738},{"className":737},[],[739],{"type":20,"value":740},"get_lhb_stock",{"type":20,"value":550},{"type":14,"tag":47,"props":743,"children":745},{"className":744},[],[746],{"type":20,"value":747},"get_lhb_dates",{"type":20,"value":550},{"type":14,"tag":47,"props":750,"children":752},{"className":751},[],[753],{"type":20,"value":754},"get_lhb_stats",{"type":20,"value":550},{"type":14,"tag":47,"props":757,"children":759},{"className":758},[],[760],{"type":20,"value":761},"get_hot_money",{"type":20,"value":550},{"type":14,"tag":47,"props":764,"children":766},{"className":765},[],[767],{"type":20,"value":768},"get_hot_money_by_seat",{"type":20,"value":550},{"type":14,"tag":47,"props":771,"children":773},{"className":772},[],[774],{"type":20,"value":775},"get_moneyflow_daily_trend",{"type":20,"value":550},{"type":14,"tag":47,"props":778,"children":780},{"className":779},[],[781],{"type":20,"value":782},"get_moneyflow_stage",{"type":20,"value":550},{"type":14,"tag":47,"props":785,"children":787},{"className":786},[],[788],{"type":20,"value":789},"get_moneyflow_distribution",{"type":20,"value":550},{"type":14,"tag":47,"props":792,"children":794},{"className":793},[],[795],{"type":20,"value":796},"get_market_indices",{"type":20,"value":550},{"type":14,"tag":47,"props":799,"children":801},{"className":800},[],[802],{"type":20,"value":803},"search_indices",{"type":20,"value":550},{"type":14,"tag":47,"props":806,"children":808},{"className":807},[],[809],{"type":20,"value":810},"get_public_catalog",{"type":20,"value":812},"，及 ETF 系列 ",{"type":14,"tag":47,"props":814,"children":816},{"className":815},[],[817],{"type":20,"value":818},"get_etf",{"type":20,"value":550},{"type":14,"tag":47,"props":821,"children":823},{"className":822},[],[824],{"type":20,"value":825},"search_etfs",{"type":20,"value":550},{"type":14,"tag":47,"props":828,"children":830},{"className":829},[],[831],{"type":20,"value":832},"get_etf_realtime",{"type":20,"value":550},{"type":14,"tag":47,"props":835,"children":837},{"className":836},[],[838],{"type":20,"value":839},"get_etf_trend",{"type":20,"value":550},{"type":14,"tag":47,"props":842,"children":844},{"className":843},[],[845],{"type":20,"value":846},"get_etf_kline_v2",{"type":20,"value":579},{"type":14,"tag":47,"props":849,"children":851},{"className":850},[],[852],{"type":20,"value":853},"get_etf_kline",{"type":20,"value":855},"（过时）（开通状态见 ",{"type":14,"tag":47,"props":857,"children":859},{"className":858},[],[860],{"type":20,"value":861},"GET \u002Fv1\u002Fme",{"type":20,"value":863},"）。",{"type":14,"tag":23,"props":865,"children":866},{},[867],{"type":20,"value":868},"配置后在对话中直接提问即可触发工具；调用计入与普通 REST 相同的 scope 与限流。",{"type":14,"tag":870,"props":871,"children":872},"style",{},[873],{"type":20,"value":874},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":7,"searchDepth":226,"depth":226,"links":876},[877],{"id":17,"depth":226,"text":21,"children":878},[879,880,881,882,883],{"id":58,"depth":241,"text":58},{"id":139,"depth":241,"text":139},{"id":193,"depth":241,"text":196},{"id":417,"depth":241,"text":417},{"id":537,"depth":241,"text":537},"markdown","content:docs:mcp.md","content","docs\u002Fmcp.md","docs\u002Fmcp","md",1787299860395]