{"_id":"@363045841yyt/klinechart-ai-runtime","_rev":"5-13c24caad4c338ec1452b434fd3ca49d","name":"@363045841yyt/klinechart-ai-runtime","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@363045841yyt/klinechart-ai-runtime","version":"0.1.0","keywords":["kline","candlestick","chart","mcp","model-context-protocol","ai","agent","websocket","trading","quantitative"],"license":"MIT","_id":"@363045841yyt/klinechart-ai-runtime@0.1.0","maintainers":[{"name":"363045841yyt","email":"161981174@qq.com"}],"dist":{"shasum":"6a7aebdded012f2e6b20739c858ad720bf1e9faf","tarball":"https://registry.npmjs.org/@363045841yyt/klinechart-ai-runtime/-/klinechart-ai-runtime-0.1.0.tgz","fileCount":55,"integrity":"sha512-WFvt0nB/qKrLcJtKPZCdFbmqJnSYpHwmNtTZHKcpDd8DNm7EHUoDNSeES4xHVcSjmQzQGVHw9siufX8mtSIvmw==","signatures":[{"sig":"MEQCIDTGwCqSl3dL6HORmrD+WampNce1iS6m7Y5F0QoTQvdPAiBWcxTpPEendvwUf3yBhm1muyLimipdFwzw4YpI2qDpQQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":127470},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./mcp-server":{"types":"./dist/mcpServer.d.ts","import":"./dist/mcpServer.js"},"./create-with-mcp":{"types":"./dist/createWithMcp.d.ts","import":"./dist/createWithMcp.js"}},"gitHead":"5ae7b99b42d243c6cd7b34235c8b5ddb122c93f7","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","start":"tsx scripts/dev.ts","inspect":"npx @modelcontextprotocol/inspector npx tsx scripts/dev.ts","prepublishOnly":"pnpm build"},"_npmUser":{"name":"363045841yyt","email":"161981174@qq.com"},"_npmVersion":"11.1.0","description":"AI Native runtime for @363045841yyt/klinechart — MCP tool schemas, controller describe() output, chart state serialization.","directories":{},"sideEffects":false,"_nodeVersion":"24.16.0","dependencies":{"ws":"^8","@modelcontextprotocol/sdk":"^1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.5","@types/ws":"^8","typescript":"~6.0.3"},"peerDependencies":{"@363045841yyt/klinechart-core":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/klinechart-ai-runtime_0.1.0_1781616578347_0.9945414525308276","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.1.1":{"name":"@363045841yyt/klinechart-ai-runtime","version":"0.1.1","keywords":["kline","candlestick","chart","mcp","model-context-protocol","ai","agent","websocket","trading","quantitative"],"license":"MIT","_id":"@363045841yyt/klinechart-ai-runtime@0.1.1","maintainers":[{"name":"363045841yyt","email":"161981174@qq.com"}],"dist":{"shasum":"94a13ec30eb6b2ad181f974352f214227cf9ad99","tarball":"https://registry.npmjs.org/@363045841yyt/klinechart-ai-runtime/-/klinechart-ai-runtime-0.1.1.tgz","fileCount":65,"integrity":"sha512-mEBxQblf8TwvGx4+A7PH52svtXo9bBYPk2MT0A7DbF6T4iSGYaTc/OzO5PfZV7VkpgAMLoYUocMlzO2SkKseTQ==","signatures":[{"sig":"MEUCIB2XdyyVxb20fxdOkM707qityRJSQhlHnn/bNab6K2l0AiEA+i9EWrQc5i5g6mZIgaoPjojjBTQJD/Vr2AuN7Gp+nJs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":204688},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.js"},"./mcp-server":{"types":"./dist/mcpServer.d.ts","import":"./dist/mcpServer.js"}},"gitHead":"fe45eef1414a8071252be3ca6476e5acc07549cf","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","start":"tsx scripts/dev.ts","inspect":"npx @modelcontextprotocol/inspector npx tsx scripts/dev.ts","prepublishOnly":"pnpm build"},"_npmUser":{"name":"363045841yyt","email":"161981174@qq.com"},"_npmVersion":"11.1.0","description":"AI Native runtime for @363045841yyt/klinechart — MCP tool schemas, controller describe() output, chart state serialization.","directories":{},"sideEffects":false,"_nodeVersion":"24.16.0","dependencies":{"ws":"^8","@modelcontextprotocol/sdk":"^1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.9","@types/ws":"^8","typescript":"~6.0.3"},"peerDependencies":{"@363045841yyt/klinechart-core":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/klinechart-ai-runtime_0.1.1_1781858425831_0.7801158439433333","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.1.2":{"name":"@363045841yyt/klinechart-ai-runtime","version":"0.1.2","keywords":["kline","candlestick","chart","mcp","model-context-protocol","ai","agent","websocket","trading","quantitative"],"license":"MIT","_id":"@363045841yyt/klinechart-ai-runtime@0.1.2","maintainers":[{"name":"363045841yyt","email":"161981174@qq.com"}],"dist":{"shasum":"99d0c0cc047a20b3c36c8a6b58a2d9e8d9a87b18","tarball":"https://registry.npmjs.org/@363045841yyt/klinechart-ai-runtime/-/klinechart-ai-runtime-0.1.2.tgz","fileCount":65,"integrity":"sha512-N/6a+gxXAG+fZOK1Anv/eb9M5WvEYZ23PJLFL1U29NAqa8glOg+Cl5rgfE1STv5beY8xo9H9cp09+nXMTQAp5g==","signatures":[{"sig":"MEYCIQDP2WqqBebJ365pHit7HTfKKYvzrvwwf40XvUcTuWQD2gIhAOAB/L+4HCPqboyg0VWS7LB0lih0wKetk78PRFQJGtyN","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":209902},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.js"},"./mcp-server":{"types":"./dist/mcpServer.d.ts","import":"./dist/mcpServer.js"}},"gitHead":"d9bbd4daac175843cf4faf12edc5923d5264aa37","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","start":"tsx scripts/dev.ts","inspect":"npx @modelcontextprotocol/inspector node --import tsx scripts/dev.ts","prepublishOnly":"pnpm build"},"_npmUser":{"name":"363045841yyt","email":"161981174@qq.com"},"_npmVersion":"11.1.0","description":"AI Native runtime for @363045841yyt/klinechart — MCP tool schemas, controller describe() output, chart state serialization.","directories":{},"sideEffects":false,"_nodeVersion":"24.16.0","dependencies":{"ws":"^8","effect":"^3.21.4","@modelcontextprotocol/sdk":"^1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.9","@types/ws":"^8","typescript":"~6.0.3"},"peerDependencies":{"@363045841yyt/klinechart-core":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/klinechart-ai-runtime_0.1.2_1782484921526_0.17572896032386143","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.1.3":{"name":"@363045841yyt/klinechart-ai-runtime","version":"0.1.3","keywords":["kline","candlestick","chart","mcp","model-context-protocol","ai","agent","websocket","trading","quantitative"],"license":"MIT","_id":"@363045841yyt/klinechart-ai-runtime@0.1.3","maintainers":[{"name":"363045841yyt","email":"161981174@qq.com"}],"dist":{"shasum":"3e506b853b1eddc22d56ecaad686fcf837f7ac63","tarball":"https://registry.npmjs.org/@363045841yyt/klinechart-ai-runtime/-/klinechart-ai-runtime-0.1.3.tgz","fileCount":65,"integrity":"sha512-67tJhhWyuacvHBTZjzJ8HrIexLiQ819m1TnjdOrmuUb0f0i3RAjW5vmTuktsPZWp/VYmEUZi4UWb6pDuaj08JQ==","signatures":[{"sig":"MEUCIQCZpZnGQ4YZubJ3G1WqrJ6ZtEeKWukoqpYPKBUAofRBmAIgFgl+NcIsapl/JbzCp36aE8NPjyCg6ZLGOQEADzDlUEA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":208245},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.js"},"./mcp-server":{"types":"./dist/mcpServer.d.ts","import":"./dist/mcpServer.js"}},"gitHead":"f713bc5f40e983039ee70e6d9e1732541ccb4ba2","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","start":"tsx scripts/dev.ts","inspect":"npx @modelcontextprotocol/inspector node --import tsx scripts/dev.ts","prepublishOnly":"pnpm build"},"_npmUser":{"name":"363045841yyt","email":"161981174@qq.com"},"_npmVersion":"11.1.0","description":"AI Native runtime for @363045841yyt/klinechart — MCP tool schemas, controller describe() output, chart state serialization.","directories":{},"sideEffects":false,"_nodeVersion":"24.16.0","dependencies":{"ws":"^8","effect":"^3.21.4","@modelcontextprotocol/sdk":"^1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.9","@types/ws":"^8","typescript":"~6.0.3"},"peerDependencies":{"@363045841yyt/klinechart-core":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/klinechart-ai-runtime_0.1.3_1782926291435_0.4542671512024332","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2026-06-16T13:29:38.139Z","modified":"2026-09-20T06:15:53.236Z","0.1.0":"2026-06-16T13:29:38.479Z","0.1.1":"2026-06-19T08:40:25.948Z","0.1.2":"2026-06-26T14:42:01.713Z","0.1.3":"2026-07-01T17:18:11.576Z"},"license":"MIT","keywords":["kline","candlestick","chart","mcp","model-context-protocol","ai","agent","websocket","trading","quantitative"],"description":"AI Native runtime for @363045841yyt/klinechart — MCP tool schemas, controller describe() output, chart state serialization.","maintainers":[{"name":"363045841yyt","email":"161981174@qq.com"}],"readme":"# @363045841yyt/klinechart-ai-runtime\r\n\r\nMCP (Model Context Protocol) server and AI tool schemas for\r\n[@363045841yyt/klinechart-core](https://github.com/363045841/KLineChartQuant/tree/main/packages/core)\r\n([npm](https://www.npmjs.com/package/@363045841yyt/klinechart-core))\r\n/\r\n[@363045841yyt/klinechart](https://github.com/363045841/KLineChartQuant/tree/main/packages/vue)\r\n([npm](https://www.npmjs.com/package/@363045841yyt/klinechart)).\r\n\r\nOptional addon — install only if you need AI agent / MCP control of your charts.\r\n\r\nProvides a WebSocket-bridged MCP server that enables AI agents (via MCP Inspector\r\nor any MCP client) to control K-line chart operations — zoom, pan, add/remove\r\nindicators, change theme, and more.\r\n\r\n## Installation\r\n\r\n```bash\r\npnpm add @363045841yyt/klinechart-ai-runtime\r\n```\r\n\r\nRequires `@363045841yyt/klinechart-core` as a peer dependency.\r\n\r\n## Quick Start\r\n\r\n### Start the MCP server\r\n\r\n```ts\r\nimport { createMcpServer } from '@363045841yyt/klinechart-ai-runtime/mcp-server'\r\n\r\nconst { start, stop } = createMcpServer({\r\n  ws: { port: 8080 },\r\n})\r\n\r\nawait start()\r\n```\r\n\r\n### Integrate with KLineChart (Vue example)\r\n\r\n```vue\r\n<template>\r\n  <div class=\"app-container\">\r\n    <KlineChart ref=\"chartRef\" :mcp=\"mcpConfig\" />\r\n  </div>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\n  import { ref } from 'vue'\r\n  import { KlineChart } from '@363045841yyt/klinechart'\r\n  import { executeTool } from '@363045841yyt/klinechart-ai-runtime'\r\n\r\n  const chartRef = ref<InstanceType<typeof KlineChart> | null>(null)\r\n\r\n  const mcpConfig = {\r\n    wsUrl: 'ws://localhost:8080',\r\n    autoReconnect: true,\r\n    onToolCall: (call) => {\r\n      const ctrl = chartRef.value?.getController?.()\r\n      if (!ctrl) return { success: false, error: 'Controller not ready' }\r\n      return executeTool(ctrl, call)\r\n    },\r\n  }\r\n</script>\r\n\r\n<style>\r\n  .app-container {\r\n    height: 80vh;\r\n  }\r\n</style>\r\n```\r\n\r\n### Connect from MCP Inspector\r\n\r\n```bash\r\ncd packages/ai-runtime\r\npnpm inspect\r\n```\r\n\r\nThen call tools like `chart.zoomToLevel` with `{ \"level\": 5 }`.\r\n\r\n## Exports\r\n\r\n### Main entry (`@363045841yyt/klinechart-ai-runtime`)\r\n\r\n| Export                       | Description                                |\r\n| ---------------------------- | ------------------------------------------ |\r\n| `executeTool`                | Dispatch a tool call to a chart controller |\r\n| `ALL_TOOLS`                  | Array of all supported tool schemas        |\r\n| `TOOL_GROUPS`                | Grouped tool definitions                   |\r\n| `findTool(name)`             | Look up a tool schema by name              |\r\n| `describeVolumeProfileState` | Generate VP state summary                  |\r\n| `describeAnchoredVwap`       | Generate anchored VWAP summary             |\r\n| `describeFootprintLatestBar` | Generate footprint summary                 |\r\n| `describeAlerts`             | Generate alerts summary                    |\r\n| `serialize` / `deserialize`  | Chart state serialization                  |\r\n| `SessionRegistry`            | WebSocket session manager                  |\r\n\r\n### MCP Server (`@363045841yyt/klinechart-ai-runtime/mcp-server`)\r\n\r\n| Export                     | Description                            |\r\n| -------------------------- | -------------------------------------- |\r\n| `createMcpServer(options)` | Create MCP + WebSocket server instance |\r\n\r\n### Create with MCP (`@363045841yyt/klinechart-ai-runtime/create-with-mcp`)\r\n\r\nLegacy helper — prefer `executeTool` + `mcp` prop pattern above.\r\n\r\n## Architecture\r\n\r\n```\r\n┌─────────────────┐        WebSocket          ┌───────────────────┐\r\n│   Browser       │◄─────────────────────────►│  MCP Server       │\r\n│                 │   register / tool:call    │  (Node.js)        │\r\n│  KLineChart     │   tool:result /           │                   │\r\n│  └─ ChartBridge │   state:update            │ ┌─ SessionRegistry│\r\n│       ↓         │                           │ └─ WsSessionHandle│\r\n│  └─ onToolCall ─┼───────────────────────────┼──► executeTool    │\r\n└─────────────────┘                           └────────┬──────────┘\r\n                                                       │ stdio\r\n                                                       ▼\r\n                                               ┌────────────────────┐\r\n                                               │  MCP Client        │\r\n                                               │  (Inspector / AI)  │\r\n                                               └────────────────────┘\r\n```\r\n\r\n## Available Tools\r\n\r\n| Tool                      | Description                        |\r\n| ------------------------- | ---------------------------------- |\r\n| `chart.zoomToLevel`       | Zoom to a specific level           |\r\n| `chart.setTheme`          | Switch between light/dark theme    |\r\n| `indicators.add`          | Add an indicator by definition ID  |\r\n| `indicators.remove`       | Remove an indicator by instance ID |\r\n| `indicators.updateParams` | Update indicator parameters        |\r\n\r\n## License\r\n\r\nMIT\r\n","readmeFilename":"README.md"}