KLinePic MCP Server
Provides sample data templates for Binance trade history, enabling generation of annotated candlestick chart PNGs from Binance fills.
KLinePic MCP Server and Agent API Examples
Turn broker or exchange fills into annotated candlestick review-chart PNGs. AI agents can discover capabilities, validate a request without spending chart quota, and render the finished chart through three MCP tools.
KLinePic is for post-trade review and visualization. It does not provide trading signals, price predictions, investment advice, or order execution.
What is included
Tool | What it does | Quota impact |
| Checks API-key permissions, plan limits, remaining quota, and supported endpoints. | None |
| Validates fills, K-line data, scopes, and estimated cost before rendering. | None |
| Returns an annotated candlestick PNG as native MCP image content. | Uses one chart render |
The repository also includes:
A working JavaScript stdio MCP server.
A small Agent API client used by the MCP tools.
Broker, Binance, US-stock, futures, and MetaTrader sample data.
A complete review-chart request and a no-charge preflight example.
Docker support, an OpenAPI mirror, and machine-readable discovery files.
Related MCP server: TradingView MCP
Verified functionality
Last verified on 2026-07-13 against the current source and the live KLinePic API:
Check | Result | What was proved |
API adapter tests | PASS — 4/4 | Bearer authentication, forced review-chart mode, PNG-to-base64 conversion, and structured error handling. |
Real MCP stdio handshake | PASS — 3 tools | A real MCP client completed initialization and discovered all three tool schemas. |
Live production capabilities | PASS | The MCP server called the production capability endpoint with a scoped Agent API key. |
Live production preflight | PASS | The sample request passed production validation without rendering a chart or consuming chart quota. |
Container build | PASS in CI | GitHub Actions builds the Docker image from a clean checkout. |
Reproduce the local checks:
npm ci
npm testRun the live, no-charge check with your own key:
KLINE_AGENT_API_KEY=kline_agent_xxx npm run test:production-preflightThe live check calls capabilities and preflight only. It does not call the paid render tool.
Quick start
Requirements:
Node.js 20 or newer.
A KLinePic Agent API key. Create one from the account page; the free tier does not require a sales conversation.
Run directly from GitHub:
KLINE_AGENT_API_KEY=kline_agent_xxx \
npx -y github:sher1096/klinepic-agent-api-examplesOr clone the repository:
git clone https://github.com/sher1096/klinepic-agent-api-examples.git
cd klinepic-agent-api-examples
npm ci
KLINE_AGENT_API_KEY=kline_agent_xxx npm startMCP client configuration
Most macOS and Linux clients can run the GitHub package directly:
{
"mcpServers": {
"klinepic": {
"command": "npx",
"args": [
"-y",
"github:sher1096/klinepic-agent-api-examples"
],
"env": {
"KLINE_AGENT_API_KEY": "kline_agent_xxx"
}
}
}
}Some Windows clients need cmd.exe to resolve npx.cmd:
{
"mcpServers": {
"klinepic": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"github:sher1096/klinepic-agent-api-examples"
],
"env": {
"KLINE_AGENT_API_KEY": "kline_agent_xxx"
}
}
}
}Keep the key in the client environment or secret store. Do not commit it.
Docker
Run the published image:
docker run --rm -i \
-e KLINE_AGENT_API_KEY=kline_agent_xxx \
ghcr.io/sher1096/klinepic-mcp-server:0.1.0Or build it locally:
docker build -t klinepic-mcp .
docker run --rm -i \
-e KLINE_AGENT_API_KEY=kline_agent_xxx \
klinepic-mcpThe container can start without a key so a registry can inspect its tool schemas. API calls still require a valid key.
Recommended agent flow
Call
klinepic_get_capabilities.Build a request from the user's fills and K-line data.
Call
klinepic_preflight_review_chart.Fix any validation or permission error.
Ask for confirmation before a quota-consuming render.
Call
klinepic_create_review_chartand return the PNG.
Preflight first: it catches malformed CSV, unsupported sources, missing scopes, IP restrictions, plan state, and quota limits without rendering.
Sample data
File | Use case |
Complete request for preflight or rendering | |
Generic broker exports | |
Binance trade history | |
US-stock journals | |
Futures reviews | |
MetaTrader 4/5 history |
Run the standalone no-charge example:
KLINE_AGENT_API_KEY=kline_agent_xxx node examples/preflight.mjsTroubleshooting
KLINE_AGENT_API_KEY is required— create a key and pass it through the MCP client's environment.HTTP 401 — the key is invalid or revoked.
HTTP 402 — the account or key quota is exhausted; capabilities shows the relevant limit.
HTTP 403 — the key lacks the required scope or its IP allowlist blocks the caller.
HTTP 422 — the request data is invalid; run preflight and inspect the structured details.
Windows cannot find
npx— use thecmd /c npxconfiguration above.
Documentation and discovery
Security and scope
API keys are sent only to
https://klinepic.comunlessKLINEPIC_BASE_URLis explicitly overridden.The server does not store keys, trade records, or generated images locally.
Use a dedicated key with the smallest useful scopes and limits.
Review data-handling requirements before sending real trading records.
License
The MCP adapter and examples in this repository are available under the MIT License. The hosted KLinePic API is a separate service governed by its published terms and privacy policy.
Maintenance
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sher1096/klinepic-agent-api-examples'
If you have feedback or need assistance with the MCP directory API, please join our Discord server