Skip to content

Commit 6131bba

Browse files
committed
mcp server
1 parent 162c8f5 commit 6131bba

File tree

17 files changed

+1742
-768
lines changed

17 files changed

+1742
-768
lines changed

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
long_description_content_type='text/markdown',
2222
packages=find_packages(exclude=["tests"]),
2323
author='TigerBrokers',
24-
author_email='openapi@tigerbrokers.com',
24+
author_email='openapi@itiger.com',
2525
license='Apache License v2',
2626
package_data={'': ['*.*']},
2727
url='https://github.com/tigerbrokers/openapi-python-sdk',
@@ -37,5 +37,7 @@
3737
'Programming Language :: Python :: 3.9',
3838
'Programming Language :: Python :: 3.10',
3939
'Programming Language :: Python :: 3.11',
40+
'Programming Language :: Python :: 3.12',
41+
'Programming Language :: Python :: 3.13',
4042
],
4143
)

tests/test_quote_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def test_get_market_status(self):
9494
self.assertIn(item.trading_status, ['NOT_YET_OPEN', 'TRADING'])
9595
self.assertTrue(isinstance(item.open_time, datetime))
9696
else:
97-
result = self.client.get_market_status()
97+
result = self.client.get_market_status(market=Market.US)
9898
logger.debug(f"Market Status: {result}")
9999

100100
def test_get_symbol_names(self):
@@ -572,9 +572,9 @@ def test_get_bars(self):
572572
self.assertEqual(last_row['low'], 224.76)
573573
self.assertEqual(last_row['volume'], 61806132)
574574
else:
575-
result = self.client.get_bars(symbols=['AAPL'],
575+
result = self.client.get_bars(symbols=['AAPL', 'MSFT'],
576576
period=BarPeriod.DAY,
577-
limit=5,
577+
limit=10,
578578
page_token='')
579579
logger.debug(f"Bars (real):\n {result}")
580580

tigeropen/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
55
@author: gaoan
66
"""
7-
__VERSION__ = '3.4.4'
7+
__VERSION__ = '3.4.5'

tigeropen/common/consts/params.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,11 @@
2020
COMMON_PARAM_KEYS = {P_TIGER_ID, P_METHOD, P_CHARSET, P_SIGN_TYPE, P_SIGN, P_TIMESTAMP, P_VERSION, P_NOTIFY_URL,
2121
P_DEVICE_ID}
2222
P_BIZ_CONTENT = "biz_content"
23+
TIGER_ID = "tiger_id"
24+
ACCOUNT = "account"
25+
SECRET_KEY = "secret_key"
26+
LICENSE = "license"
27+
PRIVATE_KEY = "private_key"
28+
TOKEN = "token"
29+
ENV = "env"
30+
DATA = "data"

tigeropen/examples/ai/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include README.md
2+
recursive-include tigermcp *
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Tiger MCP Server
2+
3+
Tiger MCP Server
4+
5+
## Quickstart
6+
7+
### Install
8+
```shell
9+
mkdir demo
10+
cd demo
11+
12+
# Create virtual environment and activate it
13+
python -m venv .venv
14+
source .venv/bin/activate
15+
# or windows
16+
# .venv\Scripts\activate
17+
18+
pip install tigermcp
19+
```
20+
21+
### Configure TigerOpen API credentials environment variables
22+
23+
Method 1: Specify the configuration file
24+
```bash
25+
export TIGEROPEN_PROPS_PATH="path/to/your/tiger_openapi_config.properties"
26+
```
27+
28+
Method 2: Specify tiger_id/private_key/account directly
29+
```bash
30+
export TIGEROPEN_TIGER_ID="your Tiger ID"
31+
export TIGEROPEN_PRIVATE_KEY="your private key"
32+
export TIGEROPEN_ACCOUNT="your trading account"
33+
```
34+
35+
Set `TIGERMCP_READONLY` to true if you want to run the server in read-only mode (no trading actions allowed).
36+
37+
38+
39+
### Run
40+
```shell
41+
tigermcp
42+
```
43+
44+
### Run with Cursor/Claude/Trae
45+
46+
47+
```json
48+
{
49+
"mcpServers": {
50+
"tigermcp": {
51+
"command": "/path/to/tigermcp",
52+
"env": {
53+
"TIGEROPEN_PROPS_PATH": "/path/to/your/tiger_openapi_config.properties"
54+
}
55+
}
56+
}
57+
}
58+
```
59+
60+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
Tiger MCP Server package
3+
"""
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
4+
from setuptools import setup, find_packages
5+
6+
with open("README.md", "r", encoding="utf-8") as fh:
7+
long_description = fh.read()
8+
9+
setup(
10+
name="tigermcp",
11+
version="0.1.0",
12+
author='TigerBrokers',
13+
author_email='[email protected]',
14+
description="Tiger Broker API MCP Server",
15+
long_description=long_description,
16+
long_description_content_type="text/markdown",
17+
url="https://github.com/tigerfintech/openapi-python-sdk",
18+
packages=find_packages(),
19+
classifiers=[
20+
"Programming Language :: Python :: 3",
21+
"Operating System :: OS Independent",
22+
],
23+
license='Apache License v2',
24+
python_requires=">=3.9",
25+
install_requires=[
26+
"tigeropen>=3.4.5",
27+
"mcp[cli]>=1.13.0",
28+
],
29+
entry_points={
30+
"console_scripts": [
31+
"tigermcp=tigermcp.server:main",
32+
],
33+
},
34+
)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
from .server import server, QuoteApi, TradeApi
3+
4+
__all__ = ['server', 'QuoteApi', 'TradeApi']

0 commit comments

Comments
 (0)