angel-one-mcp 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +82 -79
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,56 +2,28 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/angel-one-mcp)](https://www.npmjs.com/package/angel-one-mcp)
4
4
 
5
- A [Model Context Protocol](https://modelcontextprotocol.io) server that exposes [Angel One SmartAPI](https://smartapi.angelone.in/) as tools for LLM clients like Claude Desktop, Claude Code, and other MCP-compatible apps.
5
+ TypeScript [Model Context Protocol](https://modelcontextprotocol.io) server for [Angel One SmartAPI](https://smartapi.angelone.in/).
6
6
 
7
- Trade stocks, track portfolios, analyze markets, and manage orders all through natural language.
7
+ Use it from Claude, Cursor, Copilot, or any MCP client to:
8
+ - place and manage orders
9
+ - read holdings, positions, and funds
10
+ - fetch market data, candles, OI, Greeks, and movers
11
+ - manage GTT rules
12
+ - estimate charges and margin
8
13
 
9
- ## Features
14
+ ## Highlights
10
15
 
11
- - **30+ tools** covering orders, portfolio, market data, GTT rules, and more
12
- - **Auto TOTP** generates login codes automatically, no manual entry
13
- - **Lazy authentication** logs in on first API call, refreshes tokens proactively
14
- - **Safety guards** two-tier soft/hard limits on order quantity and value to prevent fat-finger trades
15
- - **Zero SDK dependency** direct `fetch()` calls to Angel One REST API
16
-
17
- ---
16
+ - Direct `fetch()` integration. No Angel One SDK dependency.
17
+ - Auto TOTP generation from your base32 secret.
18
+ - Lazy login with token refresh in API layer.
19
+ - Safety guard for trading mutations with soft and hard limits.
20
+ - stdio MCP server. Works well with `npx`.
18
21
 
19
22
  ## Quick Start
20
23
 
21
- > Copy the prompt below and paste it into your AI agent. It will handle the rest.
22
-
23
- ```
24
- Install and configure the Angel One MCP server by following the instructions here:
25
- https://raw.githubusercontent.com/ameernoufil/angel-one-mcp/main/docs/llm-setup.md
26
- ```
27
-
28
- ---
29
-
30
- ## Manual Setup
31
-
32
- ### Prerequisites
33
-
34
- - Node.js 18+ (use `nvm use` if you have [nvm](https://github.com/nvm-sh/nvm))
35
- - Angel One trading account
36
- - SmartAPI key from [smartapi.angelone.in](https://smartapi.angelone.in/)
37
- - TOTP authenticator set up on your Angel One account
38
-
39
- ### Option A: Install via npm (Recommended)
40
-
41
- Install globally and create a config directory:
42
-
43
- ```bash
44
- npm install -g angel-one-mcp
45
- mkdir -p ~/.config/angel-one-mcp
46
- cat > ~/.config/angel-one-mcp/.env << 'EOF'
47
- ANGEL_API_KEY=your_smartapi_key
48
- ANGEL_CLIENT_ID=your_client_id
49
- ANGEL_PASSWORD=your_mpin
50
- ANGEL_TOTP_SECRET=your_base32_totp_secret
51
- EOF
52
- ```
24
+ ### Option A: Use with `npx` (recommended)
53
25
 
54
- Then add to your MCP client config:
26
+ Add this to your MCP client config:
55
27
 
56
28
  ```json
57
29
  {
@@ -71,65 +43,96 @@ Then add to your MCP client config:
71
43
  }
72
44
  ```
73
45
 
74
- ### Option B: Clone from source
46
+ ### Option B: Run from source
75
47
 
76
48
  ```bash
77
49
  git clone https://github.com/ameernoufil/angel-one-mcp.git
78
50
  cd angel-one-mcp
79
51
  npm install
80
52
  cp .env.example .env
81
- ```
82
-
83
- Edit `.env` with your credentials, then build and run:
84
-
85
- ```bash
86
53
  npm run build
87
54
  npm start
88
55
  ```
89
56
 
90
- Add to MCP client config (use absolute path to `build/index.js`):
57
+ If running from source, point your MCP client to `build/index.js`.
91
58
 
92
- ```json
93
- {
94
- "mcpServers": {
95
- "angel-one": {
96
- "type": "stdio",
97
- "command": "node",
98
- "args": ["/absolute/path/to/angel-one-mcp/build/index.js"],
99
- "env": {
100
- "ANGEL_API_KEY": "your_smartapi_key",
101
- "ANGEL_CLIENT_ID": "your_client_id",
102
- "ANGEL_PASSWORD": "your_mpin",
103
- "ANGEL_TOTP_SECRET": "your_base32_totp_secret"
104
- }
105
- }
106
- }
107
- }
59
+ ## Environment Variables
60
+
61
+ Required:
62
+ - `ANGEL_API_KEY`
63
+ - `ANGEL_CLIENT_ID`
64
+ - `ANGEL_PASSWORD`
65
+ - `ANGEL_TOTP_SECRET`
66
+
67
+ Optional safety limits:
68
+ - `SOFT_MAX_ORDER_QTY` default `25`
69
+ - `HARD_MAX_ORDER_QTY` default `100`
70
+ - `SOFT_MAX_ORDER_VALUE` default `10000`
71
+ - `HARD_MAX_ORDER_VALUE` default `100000`
72
+
73
+ Example `.env`:
74
+
75
+ ```env
76
+ ANGEL_API_KEY=your_smartapi_key
77
+ ANGEL_CLIENT_ID=your_client_id
78
+ ANGEL_PASSWORD=your_mpin
79
+ ANGEL_TOTP_SECRET=your_base32_totp_secret
108
80
  ```
109
81
 
110
- Or if using `.env`, omit the `env` block — the server loads `.env` automatically.
82
+ ## Safety Model
83
+
84
+ Trading mutations are guarded.
85
+
86
+ Soft limits block by default and can be overridden with `force: true`.
87
+ Hard limits cannot be bypassed without changing env vars and restarting the server.
88
+
89
+ Guarded operations include:
90
+ - `place_order`
91
+ - `modify_order`
92
+ - `create_gtt_rule`
93
+ - `modify_gtt_rule`
94
+ - `convert_position`
111
95
 
112
- ### Safety Limits Configuration
96
+ For MARKET orders, the server attempts LTP-based value checks before allowing the request.
113
97
 
114
- **Soft limits** (bypassable with `force: true`):
98
+ ## Tool Coverage
115
99
 
116
- - Max order quantity: 25 (`SOFT_MAX_ORDER_QTY`)
117
- - Max order value: ₹10,000 (`SOFT_MAX_ORDER_VALUE`)
100
+ - **Auth:** login and logout
101
+ - **Portfolio:** holdings, positions, funds, conversion
102
+ - **Orders:** place, modify, cancel, book lookup, trade lookup
103
+ - **Market:** search, LTP, quotes, candles, OI, Greeks, movers, PCR
104
+ - **GTT:** create, modify, cancel, list, inspect
105
+ - **Calculator:** margin and brokerage estimates
106
+ - **User:** profile
118
107
 
119
- **Hard limits** (env var change + restart):
108
+ For an agent-focused onboarding prompt, see [`docs/llm-setup.md`](docs/llm-setup.md).
120
109
 
121
- - Max order quantity: 100 (`HARD_MAX_ORDER_QTY`)
122
- - Max order value: ₹1,00,000 (`HARD_MAX_ORDER_VALUE`)
110
+ ## Development
123
111
 
124
- ### Development
112
+ Requirements:
113
+ - Node.js 18+
114
+
115
+ Commands:
125
116
 
126
117
  ```bash
127
- npm run dev # Watch mode
128
- npm run lint # ESLint
129
- npm run lint:fix # ESLint with auto-fix
130
- npm run format # Prettier
118
+ npm install
119
+ npm run build
120
+ npm run lint
121
+ npm run lint:fix
122
+ npm run format
123
+ npm run dev
124
+ npm start
131
125
  ```
132
126
 
127
+ ## Architecture Notes
128
+
129
+ - Entry point: `src/index.ts`
130
+ - API client and auth flow: `src/api.ts`
131
+ - Config and safety limits: `src/config.ts`
132
+ - Order guard: `src/guards.ts`
133
+ - Tool registration: `src/tools/index.ts`
134
+ - Tool implementations: `src/tools/*.ts`
135
+
133
136
  ## License
134
137
 
135
138
  [MIT](LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angel-one-mcp",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "MCP server for Angel One SmartAPI — trade stocks, track portfolio, analyze markets & manage orders via LLM clients like Claude, Cursor & Copilot",
5
5
  "type": "module",
6
6
  "bin": {