Analyzing Stock Portfolios with AI Agents: Zerodha Kite MCP + NSE MCP in Practice

A demo of connecting Zerodha brokerage and NSE market data to an AI agent via MCP for stock analysis.
Based on a YouTube creator's demo, this article walks through connecting Zerodha Kite MCP and NSE MCP servers in Google Antigravity. Kite MCP covers the personal account—login, instrument search, holdings and fund queries—while NSE MCP supplies real-time quotes, individual stock data, and gainers/losers rankings, together forming the "my holdings" and "full market" picture. Setup requires manually adding server entries to the raw config, with all order-placement tools disabled by default for read-only analysis. The demo covers holdings queries, fund sector diversification and risk diagnosis, individual stock technical analysis, index comparison, sector rotation, plus writing results to Markdown and generating a six-month investment plan. The author stresses that MCP turns AI from something that "can chat" into something that "can audit the books," but data completeness, trading permissions, and output disclaimers remain the user's responsibility.
How exhausting is manual stock analysis? Open Kite to check holdings, switch to Coin to look up funds, go to the NSE website to dig through historical prices, then open Excel to apply formulas, run screeners, and scroll through several news sites—by the end of it all, your time is spent on "finding data," and you have no energy left for the judgment calls that actually matter. This article is based on a complete YouTube walkthrough in which a creator connects Zerodha Kite MCP and NSE MCP inside Google Antigravity, outlining this approach to plugging a brokerage account and market data into an AI agent.

Why Connect a Brokerage Account to an AI Agent
The creator's analogy is blunt: if you have a calculator in your pocket, why are you still doing large-number arithmetic by hand on paper? AI is today's "calculator" for handling complex tasks—the problem is that by default it has no access to your holdings, your funds, or your trading account. MCP (Model Context Protocol) solves exactly this connection problem: it lets AI clients call external tools in a standardized way, so brokerage accounts and market data sources become "tools" that an agent can invoke directly.
Interestingly, MCP is not exclusive to Antigravity. At the end, the creator notes that the same two MCP servers can also be connected to Claude Code, ChatGPT, and other MCP-compatible clients; this walkthrough simply chose Antigravity as the host.
MCP was proposed and open-sourced by Anthropic in late 2024 and uses a client–server architecture: an AI application acts as the Host, connecting through an MCP Client to one or more MCP Servers, which expose three categories of capabilities in a structured way—Tools (functions the model can call), Resources (data that can be read), and Prompts (preset prompt templates). The communication layer is based on JSON-RPC 2.0 and supports transports such as stdio and HTTP+SSE, so both local processes and remote services can connect. Compared with the previous situation where every AI application had to write a separate plugin for every external service, MCP's value lies in standardizing "how a model discovers and calls external capabilities," so a single implementation can be reused by multiple compatible clients—which is precisely why the two servers in this article can be mounted on Antigravity, Claude Code, and ChatGPT at the same time.
What Each of the Two MCP Servers Handles
Kite MCP deals with the personal account. Its tools cover logging in to Kite, searching for trading instruments, reading your profile, querying holdings, and looking up the latest funds. The creator calls it the "guidance server" because it can see what is actually in your account.
NSE MCP deals with the public market, and it is actually two sub-servers: CM Market provides about 15 tools, including real-time quotes, individual stock data, and top losers; Bow Copy leans toward aggregate ranking tools, such as volume rankings, top gainers, and instrument lookup. Together, the two cover the two puzzle pieces: "my holdings" and "what the market looks like."
The Actual Steps to Connect Antigravity
Antigravity has a built-in MCP server marketplace, where Google Cloud, PostHog, Lovable, Splunk, and others can be installed with a single click. Zerodha and NSE are not on that list and must be added manually: go to MCP Servers, click Manage MCP Server, and then write the corresponding entries into the raw configuration file. The URL and configuration block can be found in the official Kite MCP documentation, and likewise for the two NSE servers.
One security detail in the configuration deserves special mention: the creator disabled the order-placement, order-modification, position-adding, and order-cancellation tools outright, so the agent can only read and cannot trade. This "read-only by default" setting is the precondition that allows all the subsequent analysis to run with confidence.
The "raw configuration file" usually refers to the JSON configuration a client uses to declare MCP servers, typically containing the server name, launch command or remote URL, transport type, and environment variables (such as API keys). Sensitive credentials should be injected via environment variables rather than hard-coded in the configuration, to avoid leaks when the configuration file is shared or committed to a version repository. In addition, disabling tools is generally declared in the server configuration through a tool allowlist or denylist, and the callable scope can also be restricted on the client side; such restrictions are client-side constraints and do not replace the risk controls of the brokerage account itself, so it is still advisable to use a separate read-only API permission or restricted session on the Zerodha side.
From Holdings Queries to Risk Diagnosis
Verifying the connection is refreshingly simple—first ask in plain English to "show my holdings"; on first use, a Kite login link pops up, and after completing two-step verification the session is established. When holdings are empty, it faithfully returns an empty result, while fund holdings are listed normally.
What follows is a series of natural-language questions. When asked to sort funds by profit percentage and to look at diversification by sector, the MCP has no sector classification data, so the agent searches the web on its own for information about these well-known funds to fill in the gaps, then reports each fund's invested amount, current market value, and profit, along with the weighting of sectors such as financials and healthcare.
A further diversification check reveals that all the funds the creator holds are equity funds, with no bond or hybrid funds. The AI's judgment based on this: returns are decent, but the sources of risk are singular.

Risk analysis produces an executive summary and an overall risk score, and lists specific evidence such as standard deviation and market sensitivity. When subsequently asked for fund and stock recommendations, the AI first states that this does not constitute investment advice, then combines current market conditions, technical indicators, and news to offer allocation ideas.
The standard deviation, market sensitivity, maximum drawdown, and annualized volatility mentioned in the article are common quantitative risk metrics: standard deviation measures the magnitude of return fluctuations; market sensitivity, i.e., Beta, characterizes an instrument's systematic risk exposure relative to a benchmark index; maximum drawdown refers to the largest decline from peak to trough within a period, reflecting potential losses in extreme scenarios; and annualized volatility converts fluctuations from different periods into an annual basis for horizontal comparison. These metrics can only describe historical risk characteristics; they cannot predict the future, nor do they cover structural risks such as liquidity and concentration. Therefore, the risk scores produced by the AI are better used as leads for investigation rather than as final conclusions.
Three Levels of Drill-Down: Individual Stocks, Indices, and Sectors
When asked about a particular stock's performance over the past six months, the workflow runs like this: first use Kite MCP's search tool to get the trading symbol, then retrieve price history through NSE Bow Copy. The output includes the starting price, period return (the stock showed a negative return in the demo), moving averages and other indicators, as well as immediate support, major support, and major resistance. At the conclusion level, it offers a principle-based statement—long-term investors can build positions in batches during deep drawdown ranges rather than buying all at once.

In the index comparison segment, the creator asks for a comparison of the Nifty 50, Nifty Midcap 150, Nifty Smallcap 250, and the sector index matching their thematic fund over 24 months. The AI calls NSE Bow Copy to output a two-year snapshot covering returns, annualized volatility, maximum drawdown, P/E ratio, P/B ratio, and dividend yield, and ties it back to the holdings: whichever index fell the most corresponds to the part of the portfolio that is the largest contributor to risk.
Sector analysis then lists the leading and lagging sector indices over one-month and three-month windows, and answers whether the sector funds the creator holds are in the leading or lagging camp.
Turning Analysis Results into Files
One practical move in the demo: directly ask the AI to write the analysis results and risk analysis into Markdown files saved to the workspace. The agent generates a separate analysis file and risk file, and later sector analysis is appended to the same report. This solves the "gone once the chat ends" problem of AI conversations, letting the analysis settle into reusable material.

Finally, the creator provides a monthly budget and asks for an investment plan for the next six months. The AI outputs the total amount to deploy, the allocation ratio across funds and blue-chip stocks, the month-by-month execution pace of SIPs and individual stock purchases, portfolio-level coverage and safety buffer arrangements, and a portfolio projection based on this execution, with a disclaimer at the end.
The Value and Boundaries of This Approach
With multi-source information cross-validated, the core conclusion of this case is consistent: MCP turns AI from something that "can chat" into something that "can audit the books." But the boundaries are equally clear—
- Data completeness depends on the MCP toolset: information such as sector classification and funds' underlying holdings is not in the MCP, so the AI can only fill it in from the web, and accuracy is not guaranteed by the MCP.
- Trading permissions must be actively tightened: the creator's approach is to disable all order-placement tools by default, completely separating "can read" from "can buy"—a security practice that can be copied directly.
- Output is not advice: whether it is a risk score or an allocation plan, the AI attaches a disclaimer, and the final strategic judgment remains your own responsibility.
The creator's framing at the end is also restrained: this demo showcases Antigravity's ability to do stock analysis with MCP, and the point is to save time on finding and shuttling data, not to replace your own investment logic.
One-line Summary
A demo of how to connect a Zerodha brokerage account and NSE market data to an AI agent via MCP for stock analysis.
Paragraph Summary
Based on a YouTube creator's demo, this article introduces the complete process of connecting Zerodha Kite MCP and NSE MCP servers inside Google Antigravity. Kite MCP targets the personal account, enabling login, instrument search, and queries of holdings and funds; NSE MCP provides public market information such as real-time quotes, individual stock data, and gainers/losers rankings. Together they form the two puzzle pieces: "my holdings" and "the full market picture." Connecting them requires manually adding server entries to the raw configuration file, and it is recommended to disable all order-placement tools by default for read-only analysis. The demo covers holdings queries, fund sector diversification and risk diagnosis, individual stock technical analysis, index comparison, sector rotation, and writing results into Markdown files and generating a six-month investment plan. The author emphasizes that MCP turns AI from something that "can chat" into something that "can audit the books," but data completeness, trading permissions, and output disclaimers remain the user's responsibility to manage.
Related articles

Why Does Self-Play AI Always Get Crushed by Cheap Units? An RTS Developer's Account of the Dilemma
An independent developer trained an RTS commander AI with pure self-play, only to find it dominated historical versions but was crushed by human players using cheap tier-1 units. This article analyzes the causes of self-play strategy collapse, explores solutions such as exploiters, diversity rewards, and reward design, and introduces the open Bot Kit and AI league plan.

Which Multi-Agent Platform Wins? A Small Team's Battle Scars and Selection Considerations
A 27-person startup's ops lead tried two multi-agent platforms in four months and both failed. This article analyzes why small-team deployments break down, and offers selection guidance on integration depth, observability, and progressive rollout.

Thrive Holdings Takes ADT Private in $7.6 Billion Deal
Thrive Holdings acquires ADT for $7.6 billion in an all-cash take-private deal expected to close in Q1 2027. Analysis of the deal structure, ADT's asset value, and impact on the smart home security industry.