MCPInstall
ContextCraft logo

ContextCraft

by arindhimar 8 stars arindhimar/ContextCraft

ContextCraft is an intelligent stock trading assistant powered by Claude and Zerodha KiteConnect, integrated with powerful tools for automated trading, portfolio risk analysis, and in-depth stock analysis. With seamless integration of MCP (Model Context Protocol), it enables natural language interaction for live trading, portfolio management.

READMEmain

ContextCraft: Claude-Ready Stock Trading MCP Server

Built by Arin Dhimar ✨
Claude-integrated 🧐 • Zerodha-powered 📈 • Python 3.10+ ✨


🚀 Overview

ContextCraft is an intelligent, Claude-compatible MCP (Model Context Protocol) server that lets Claude (or any MCP agent) perform live stock trading through Zerodha KiteConnect.

Speak naturally. Claude understands:

“Buy 10 shares of INFY at market price.”
“Sell 5 SBIN when it hits 780.”


🔧 Features

  • Place Market or Limit orders
  • Query symbols by substring
  • Works seamlessly with Claude Desktop
  • FastMCP-compatible — zero boilerplate
  • Auto-installs kiteconnect
  • Real-time stock data integration (via Zerodha KiteConnect API)
  • Advanced portfolio management (coming soon)
  • Full integration with the Claude platform for hands-free trading
  • Auto Trade Assistant with conditions like price triggers
  • Portfolio Risk Analyzer for better decision-making
  • Earnings Calendar & Predictions for proactive trading strategies
  • Explain This Stock AI Tool to simplify stock information

📂 Project Structure

FilePurpose
server.pyMCP server with trading tools
main.pyMinimal script entrypoint
.envAPI key + token (Git ignored)
pyproject.tomlProject + dependency declarations

📅 Installation

1. Clone the repo

git clone https://github.com/arindhimar/contextcraft.git
cd contextcraft

2. Setup virtual environment

python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

3. Install dependencies

uv pip install -e .

4. Setup .env

API_KEY=your_kiteconnect_key
ACCESS_TOKEN=your_valid_access_token
RAPIDAPI_KEY =your_valid_rapidapi_key
RAPIDAPI_HOST = "indian-stock-exchange-api2.p.rapidapi.com"

▶️ How to Run

🚧 Development

mcp dev server.py

⚛️ Production

uv run python server.py

🧰 Tools Available

trade(symbol, side, quantity, price?)

Place a buy/sell order for a stock.

ParamTypeDescription
symbolstrSubstring or full tradingsymbol
sidestr"buy" or "sell"
quantityintNumber of shares
pricefloat?Leave blank or say "market" for LTP

portfolio_risk_analyzer()

Analyzes your portfolio’s risk by evaluating the stocks you hold, their current prices, and their market volatility.

explain_stock(symbol)

Returns a simplified, AI-generated explanation of a stock, including its market trends, news, and predictions.

ParamTypeDescription
symbolstrSubstring or full tradingsymbol

earnings_calendar()

Fetches the earnings calendar for the current or upcoming quarter, providing predictions on stock movements based on earnings announcements.


🌐 Claude Desktop Integration

"mcpServers": {
  "ContextCraft": {
    "command": "uv",
    "args": [
      "--directory", "C:\\Users\\Arin Dhimar\\Documents\\ContextCraft\\mcp-server-contextcraft",
      "run", "python", "server.py"
    ]
  }
}

Reload config in Claude Desktop. You're live!


🚀 Future Ideas

  • Tool to fetch holdings
  • View order history
  • Fetch current prices on demand
  • Add more financial tools (alerts, watchlists, etc.)

🎓 License

MIT License © Arin Dhimar


Made with coffee, code & context ☕️

More E-commerce Solutions MCP servers

Similar servers from the same category.

Alipay's official MCP Server, allowing you to easily integrate transaction creation, query, refund, and other capabilities offered by the Alipay Open Platform into your LLM applications.

FormQuery+5

Bridges WordPress websites and WooCommerce data with local clients through REST API calls, enabling content access without direct streaming connections.

ConnectDirect
Dodo Payments logo

Dodo Payments

dodopayments

Provides a bridge to the Dodo Payments API for processing payments, managing subscriptions, and handling licensing through over 40 specialized tools for customer and product management.

payment

Integrates with Adfin's financial management platform to enable credit control checks, invoice creation, and document uploads through dynamically generated API tools and specialized file system capabilities.

filesystempayment