finta-aurora-mcp 1.0.0__tar.gz
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.
- finta_aurora_mcp-1.0.0/MANIFEST.in +2 -0
- finta_aurora_mcp-1.0.0/PKG-INFO +216 -0
- finta_aurora_mcp-1.0.0/README.md +171 -0
- finta_aurora_mcp-1.0.0/finta_aurora_mcp/__init__.py +3 -0
- finta_aurora_mcp-1.0.0/finta_aurora_mcp/auth.py +105 -0
- finta_aurora_mcp-1.0.0/finta_aurora_mcp/fix_org_info.py +44 -0
- finta_aurora_mcp-1.0.0/finta_aurora_mcp/mcp.py +498 -0
- finta_aurora_mcp-1.0.0/finta_aurora_mcp.egg-info/PKG-INFO +216 -0
- finta_aurora_mcp-1.0.0/finta_aurora_mcp.egg-info/SOURCES.txt +24 -0
- finta_aurora_mcp-1.0.0/finta_aurora_mcp.egg-info/dependency_links.txt +1 -0
- finta_aurora_mcp-1.0.0/finta_aurora_mcp.egg-info/requires.txt +31 -0
- finta_aurora_mcp-1.0.0/finta_aurora_mcp.egg-info/top_level.txt +2 -0
- finta_aurora_mcp-1.0.0/pyproject.toml +46 -0
- finta_aurora_mcp-1.0.0/setup.cfg +4 -0
- finta_aurora_mcp-1.0.0/setup.py +45 -0
- finta_aurora_mcp-1.0.0/tools/__init__.py +23 -0
- finta_aurora_mcp-1.0.0/tools/addInvestorToTrackerTool.py +114 -0
- finta_aurora_mcp-1.0.0/tools/contactSupportTool.py +7 -0
- finta_aurora_mcp-1.0.0/tools/editInvestorTool.py +653 -0
- finta_aurora_mcp-1.0.0/tools/getInvestorTool.py +109 -0
- finta_aurora_mcp-1.0.0/tools/imageTool.py +77 -0
- finta_aurora_mcp-1.0.0/tools/pdfScraperTool.py +31 -0
- finta_aurora_mcp-1.0.0/tools/pineconeKnowledgeTool.py +35 -0
- finta_aurora_mcp-1.0.0/tools/pineconeResourceTool.py +27 -0
- finta_aurora_mcp-1.0.0/tools/serpAPITool.py +16 -0
- finta_aurora_mcp-1.0.0/tools/webScraperTool.py +30 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: finta-aurora-mcp
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Aurora AI Agent for Finta
|
|
5
|
+
Home-page: https://github.com/finta/aurora
|
|
6
|
+
Author: Finta
|
|
7
|
+
Author-email: support@trustfinta.com
|
|
8
|
+
Requires-Python: >=3.8
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: pydantic>=2.0.0
|
|
11
|
+
Requires-Dist: langchain-core
|
|
12
|
+
Requires-Dist: langchain-community
|
|
13
|
+
Requires-Dist: langchain-openai>=0.1.0
|
|
14
|
+
Requires-Dist: langchain
|
|
15
|
+
Requires-Dist: beautifulsoup4
|
|
16
|
+
Requires-Dist: openai
|
|
17
|
+
Requires-Dist: langgraph
|
|
18
|
+
Requires-Dist: langgraph-cli
|
|
19
|
+
Requires-Dist: langgraph-api>=0.2.3
|
|
20
|
+
Requires-Dist: langgraph-sdk>=0.1.61
|
|
21
|
+
Requires-Dist: langchain-mcp-adapters
|
|
22
|
+
Requires-Dist: tavily-python
|
|
23
|
+
Requires-Dist: google-search-results
|
|
24
|
+
Requires-Dist: requests
|
|
25
|
+
Requires-Dist: pinecone
|
|
26
|
+
Requires-Dist: langchain-pinecone
|
|
27
|
+
Requires-Dist: playwright
|
|
28
|
+
Requires-Dist: flask
|
|
29
|
+
Requires-Dist: tiktoken
|
|
30
|
+
Requires-Dist: PyPDF2
|
|
31
|
+
Requires-Dist: python-dotenv
|
|
32
|
+
Requires-Dist: python-decouple
|
|
33
|
+
Requires-Dist: flask_cors
|
|
34
|
+
Requires-Dist: langchain-google-genai
|
|
35
|
+
Requires-Dist: langchain-anthropic
|
|
36
|
+
Requires-Dist: langchain-google-vertexai
|
|
37
|
+
Requires-Dist: google-cloud-aiplatform>=1.84
|
|
38
|
+
Requires-Dist: httpx>=0.27.0
|
|
39
|
+
Requires-Dist: langchainhub
|
|
40
|
+
Requires-Dist: mcp>=0.1.0
|
|
41
|
+
Dynamic: author
|
|
42
|
+
Dynamic: author-email
|
|
43
|
+
Dynamic: home-page
|
|
44
|
+
Dynamic: requires-python
|
|
45
|
+
|
|
46
|
+
# Aurora
|
|
47
|
+
|
|
48
|
+
## Running Aurora locally:
|
|
49
|
+
|
|
50
|
+
Pre-requisite: Ensure you have Docker installed on your system and you are logged in. If not, download and install it from the [official website](https://www.docker.com/products/docker-desktop/).
|
|
51
|
+
|
|
52
|
+
### LangGraph CLI (Recommended)
|
|
53
|
+
|
|
54
|
+
Pre-requisite: Set up a virtual environment and install dependencies:
|
|
55
|
+
|
|
56
|
+
1. Run `python3 -m venv .venv`
|
|
57
|
+
2. Run `.venv/bin/pip install -r requirements.txt`
|
|
58
|
+
3. Get the .env file contents from Kevin or someone on the team. Aurora will not run via docker without this file.
|
|
59
|
+
|
|
60
|
+
To run Aurora:
|
|
61
|
+
|
|
62
|
+
1. Run `langgraph up` in the terminal from the aurora directory. This will start the Aurora server on `localhost:8123`.
|
|
63
|
+
2. IMPORTANT: Before prompting Aurora, you will need to press the `+` button on the Chatbot UI in order to create a new thread.
|
|
64
|
+
|
|
65
|
+
- Note: Langgraph up will start a build before running the container, so it may take a while to start
|
|
66
|
+
|
|
67
|
+
### LangGraph Cloud Desktop GUI (For Graph UI)
|
|
68
|
+
|
|
69
|
+
- Note:
|
|
70
|
+
- Apple Silicon only, as of 09/2024
|
|
71
|
+
- You will need to manually update the endpoint in equity-token-webapp/src/api/fintaAI/aurora
|
|
72
|
+
|
|
73
|
+
Pre-requisite: Install [LangGraph Studio for Desktop](https://github.com/langchain-ai/langgraph-studio)
|
|
74
|
+
|
|
75
|
+
1. Log in with LangSmith credentials
|
|
76
|
+
2. Navigate to the cloned Aurora repo folder location
|
|
77
|
+
3. When Aurora has finished building, find the 'localhost:xxxxx' endpoint to use in equity-token-webapp
|
|
78
|
+
4. Update the client endpoint in equity-token-webapp/src/api/fintaAI/aurora.js to the 'localhost:xxxxx' endpoint
|
|
79
|
+
`const client = new Client({
|
|
80
|
+
apiUrl: [YOUR ENDPOINT HERE],
|
|
81
|
+
defaultHeaders: {
|
|
82
|
+
'X-API-KEY': LANGSMITH_API_KEY,
|
|
83
|
+
},
|
|
84
|
+
});`
|
|
85
|
+
|
|
86
|
+
## Using Aurora MCP (for Cursor/Claude Desktop/ChatGPT)
|
|
87
|
+
|
|
88
|
+
The Aurora MCP allows you to chat with Aurora directly from Cursor, Claude Desktop, or ChatGPT, with automatic injection of your CRM contacts and deal information.
|
|
89
|
+
|
|
90
|
+
**✅ Compatible with:**
|
|
91
|
+
- **Cursor** - IDE with built-in MCP support
|
|
92
|
+
- **Claude Desktop** - Anthropic's desktop app
|
|
93
|
+
- **Any MCP-compatible client** - Uses standard stdio protocol
|
|
94
|
+
|
|
95
|
+
### Installation
|
|
96
|
+
|
|
97
|
+
Install the Aurora MCP package via pip:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pip install finta-aurora-mcp
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Or if you have the repo:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
cd aurora
|
|
107
|
+
pip install -e .
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Step 1: Authenticate (one-time)
|
|
111
|
+
|
|
112
|
+
Run the authentication command:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
aurora-authenticate
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
This will:
|
|
119
|
+
- Open your browser for Finta OAuth login
|
|
120
|
+
- Store your authentication token in `~/.cursor/aurora_token.json`
|
|
121
|
+
- Store your organization info in `~/.cursor/aurora_org_info.json`
|
|
122
|
+
|
|
123
|
+
**Note:** By default, authentication uses the **staging** environment. To use production, set `FINTA_STAGING=false` before running:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
FINTA_STAGING=false aurora-authenticate
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Step 2: Add to MCP config
|
|
130
|
+
|
|
131
|
+
**For Cursor:**
|
|
132
|
+
Add this to your `~/.cursor/mcp.json` (create the file if it doesn't exist):
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"mcpServers": {
|
|
137
|
+
"aurora": {
|
|
138
|
+
"command": "python3",
|
|
139
|
+
"args": ["-m", "finta_aurora_mcp.mcp"]
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**For Claude Desktop:**
|
|
146
|
+
Add this to your `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"mcpServers": {
|
|
151
|
+
"aurora": {
|
|
152
|
+
"command": "python3",
|
|
153
|
+
"args": ["-m", "finta_aurora_mcp.mcp"]
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**For ChatGPT/OpenAI:**
|
|
160
|
+
If OpenAI supports MCP servers, configure it similarly. Check OpenAI's documentation for their MCP configuration format.
|
|
161
|
+
|
|
162
|
+
**Note:** This references the installed package, so no file paths needed! The same package works with all MCP clients.
|
|
163
|
+
|
|
164
|
+
### Step 3: Restart Your Application
|
|
165
|
+
|
|
166
|
+
**Restart your application completely** (quit and reopen) for the MCP changes to take effect:
|
|
167
|
+
- **Cursor**: Quit and reopen Cursor
|
|
168
|
+
- **Claude Desktop**: Quit and reopen Claude Desktop
|
|
169
|
+
- **ChatGPT**: Follow OpenAI's instructions for reloading MCP servers
|
|
170
|
+
|
|
171
|
+
### Step 4: Use Aurora
|
|
172
|
+
|
|
173
|
+
Once set up, you can use Aurora by:
|
|
174
|
+
|
|
175
|
+
**In Cursor:**
|
|
176
|
+
1. Type `@aurora_chat` followed by your question
|
|
177
|
+
2. Example: `@aurora_chat Who are the investors in my CRM?`
|
|
178
|
+
|
|
179
|
+
**In Claude Desktop:**
|
|
180
|
+
1. Use the `aurora_chat` tool in Claude's tool picker
|
|
181
|
+
2. Or mention it in conversation: "Use aurora_chat to tell me about my CRM"
|
|
182
|
+
|
|
183
|
+
**In ChatGPT (if supported):**
|
|
184
|
+
1. Follow OpenAI's MCP tool usage instructions
|
|
185
|
+
2. The `aurora_chat` tool will be available in ChatGPT's tool list
|
|
186
|
+
|
|
187
|
+
Aurora will automatically have access to:
|
|
188
|
+
- Your CRM contacts (investors, status, emails)
|
|
189
|
+
- Your deal information (terms, industry, deal notes, etc.)
|
|
190
|
+
- All of Aurora's tools (search, add contacts, etc.)
|
|
191
|
+
|
|
192
|
+
### Troubleshooting
|
|
193
|
+
|
|
194
|
+
- **"Invalid or expired token"**: Run `aurora-authenticate` again to refresh your token
|
|
195
|
+
- **"Unknown tool: aurora_chat"**: Make sure you restarted Cursor after adding the MCP config
|
|
196
|
+
- **"Module not found: finta_aurora_mcp"**: Make sure you installed the package with `pip install finta-aurora-mcp`
|
|
197
|
+
- **No CRM/deal info in responses**: Check that your organization handle is correct and you have a default deal set up in Finta
|
|
198
|
+
|
|
199
|
+
## Deploying Aurora to LangGraph Cloud:
|
|
200
|
+
|
|
201
|
+
Pre-requisites:
|
|
202
|
+
|
|
203
|
+
1. Ensure you have access to [LangSmith](https://smith.langchain.com/)
|
|
204
|
+
2. Ensure your changes are pushed to the respective branch of the Aurora repo:
|
|
205
|
+
- Production: `main`
|
|
206
|
+
- Staging: `develop-Oct-2025`
|
|
207
|
+
|
|
208
|
+
#### On LangSmith:
|
|
209
|
+
|
|
210
|
+
1. Click on the `Deployments` tab
|
|
211
|
+
2. Find respective project:
|
|
212
|
+
- Production: `aurora-v1-production`
|
|
213
|
+
- Staging: `aurora-v1-staging`
|
|
214
|
+
3. Click on the `+ New Revision` button on the top right
|
|
215
|
+
4. Update environment variables as needed
|
|
216
|
+
5. Click Submit to redeploy your changes
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Aurora
|
|
2
|
+
|
|
3
|
+
## Running Aurora locally:
|
|
4
|
+
|
|
5
|
+
Pre-requisite: Ensure you have Docker installed on your system and you are logged in. If not, download and install it from the [official website](https://www.docker.com/products/docker-desktop/).
|
|
6
|
+
|
|
7
|
+
### LangGraph CLI (Recommended)
|
|
8
|
+
|
|
9
|
+
Pre-requisite: Set up a virtual environment and install dependencies:
|
|
10
|
+
|
|
11
|
+
1. Run `python3 -m venv .venv`
|
|
12
|
+
2. Run `.venv/bin/pip install -r requirements.txt`
|
|
13
|
+
3. Get the .env file contents from Kevin or someone on the team. Aurora will not run via docker without this file.
|
|
14
|
+
|
|
15
|
+
To run Aurora:
|
|
16
|
+
|
|
17
|
+
1. Run `langgraph up` in the terminal from the aurora directory. This will start the Aurora server on `localhost:8123`.
|
|
18
|
+
2. IMPORTANT: Before prompting Aurora, you will need to press the `+` button on the Chatbot UI in order to create a new thread.
|
|
19
|
+
|
|
20
|
+
- Note: Langgraph up will start a build before running the container, so it may take a while to start
|
|
21
|
+
|
|
22
|
+
### LangGraph Cloud Desktop GUI (For Graph UI)
|
|
23
|
+
|
|
24
|
+
- Note:
|
|
25
|
+
- Apple Silicon only, as of 09/2024
|
|
26
|
+
- You will need to manually update the endpoint in equity-token-webapp/src/api/fintaAI/aurora
|
|
27
|
+
|
|
28
|
+
Pre-requisite: Install [LangGraph Studio for Desktop](https://github.com/langchain-ai/langgraph-studio)
|
|
29
|
+
|
|
30
|
+
1. Log in with LangSmith credentials
|
|
31
|
+
2. Navigate to the cloned Aurora repo folder location
|
|
32
|
+
3. When Aurora has finished building, find the 'localhost:xxxxx' endpoint to use in equity-token-webapp
|
|
33
|
+
4. Update the client endpoint in equity-token-webapp/src/api/fintaAI/aurora.js to the 'localhost:xxxxx' endpoint
|
|
34
|
+
`const client = new Client({
|
|
35
|
+
apiUrl: [YOUR ENDPOINT HERE],
|
|
36
|
+
defaultHeaders: {
|
|
37
|
+
'X-API-KEY': LANGSMITH_API_KEY,
|
|
38
|
+
},
|
|
39
|
+
});`
|
|
40
|
+
|
|
41
|
+
## Using Aurora MCP (for Cursor/Claude Desktop/ChatGPT)
|
|
42
|
+
|
|
43
|
+
The Aurora MCP allows you to chat with Aurora directly from Cursor, Claude Desktop, or ChatGPT, with automatic injection of your CRM contacts and deal information.
|
|
44
|
+
|
|
45
|
+
**✅ Compatible with:**
|
|
46
|
+
- **Cursor** - IDE with built-in MCP support
|
|
47
|
+
- **Claude Desktop** - Anthropic's desktop app
|
|
48
|
+
- **Any MCP-compatible client** - Uses standard stdio protocol
|
|
49
|
+
|
|
50
|
+
### Installation
|
|
51
|
+
|
|
52
|
+
Install the Aurora MCP package via pip:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install finta-aurora-mcp
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or if you have the repo:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
cd aurora
|
|
62
|
+
pip install -e .
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Step 1: Authenticate (one-time)
|
|
66
|
+
|
|
67
|
+
Run the authentication command:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
aurora-authenticate
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This will:
|
|
74
|
+
- Open your browser for Finta OAuth login
|
|
75
|
+
- Store your authentication token in `~/.cursor/aurora_token.json`
|
|
76
|
+
- Store your organization info in `~/.cursor/aurora_org_info.json`
|
|
77
|
+
|
|
78
|
+
**Note:** By default, authentication uses the **staging** environment. To use production, set `FINTA_STAGING=false` before running:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
FINTA_STAGING=false aurora-authenticate
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Step 2: Add to MCP config
|
|
85
|
+
|
|
86
|
+
**For Cursor:**
|
|
87
|
+
Add this to your `~/.cursor/mcp.json` (create the file if it doesn't exist):
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"mcpServers": {
|
|
92
|
+
"aurora": {
|
|
93
|
+
"command": "python3",
|
|
94
|
+
"args": ["-m", "finta_aurora_mcp.mcp"]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**For Claude Desktop:**
|
|
101
|
+
Add this to your `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"mcpServers": {
|
|
106
|
+
"aurora": {
|
|
107
|
+
"command": "python3",
|
|
108
|
+
"args": ["-m", "finta_aurora_mcp.mcp"]
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**For ChatGPT/OpenAI:**
|
|
115
|
+
If OpenAI supports MCP servers, configure it similarly. Check OpenAI's documentation for their MCP configuration format.
|
|
116
|
+
|
|
117
|
+
**Note:** This references the installed package, so no file paths needed! The same package works with all MCP clients.
|
|
118
|
+
|
|
119
|
+
### Step 3: Restart Your Application
|
|
120
|
+
|
|
121
|
+
**Restart your application completely** (quit and reopen) for the MCP changes to take effect:
|
|
122
|
+
- **Cursor**: Quit and reopen Cursor
|
|
123
|
+
- **Claude Desktop**: Quit and reopen Claude Desktop
|
|
124
|
+
- **ChatGPT**: Follow OpenAI's instructions for reloading MCP servers
|
|
125
|
+
|
|
126
|
+
### Step 4: Use Aurora
|
|
127
|
+
|
|
128
|
+
Once set up, you can use Aurora by:
|
|
129
|
+
|
|
130
|
+
**In Cursor:**
|
|
131
|
+
1. Type `@aurora_chat` followed by your question
|
|
132
|
+
2. Example: `@aurora_chat Who are the investors in my CRM?`
|
|
133
|
+
|
|
134
|
+
**In Claude Desktop:**
|
|
135
|
+
1. Use the `aurora_chat` tool in Claude's tool picker
|
|
136
|
+
2. Or mention it in conversation: "Use aurora_chat to tell me about my CRM"
|
|
137
|
+
|
|
138
|
+
**In ChatGPT (if supported):**
|
|
139
|
+
1. Follow OpenAI's MCP tool usage instructions
|
|
140
|
+
2. The `aurora_chat` tool will be available in ChatGPT's tool list
|
|
141
|
+
|
|
142
|
+
Aurora will automatically have access to:
|
|
143
|
+
- Your CRM contacts (investors, status, emails)
|
|
144
|
+
- Your deal information (terms, industry, deal notes, etc.)
|
|
145
|
+
- All of Aurora's tools (search, add contacts, etc.)
|
|
146
|
+
|
|
147
|
+
### Troubleshooting
|
|
148
|
+
|
|
149
|
+
- **"Invalid or expired token"**: Run `aurora-authenticate` again to refresh your token
|
|
150
|
+
- **"Unknown tool: aurora_chat"**: Make sure you restarted Cursor after adding the MCP config
|
|
151
|
+
- **"Module not found: finta_aurora_mcp"**: Make sure you installed the package with `pip install finta-aurora-mcp`
|
|
152
|
+
- **No CRM/deal info in responses**: Check that your organization handle is correct and you have a default deal set up in Finta
|
|
153
|
+
|
|
154
|
+
## Deploying Aurora to LangGraph Cloud:
|
|
155
|
+
|
|
156
|
+
Pre-requisites:
|
|
157
|
+
|
|
158
|
+
1. Ensure you have access to [LangSmith](https://smith.langchain.com/)
|
|
159
|
+
2. Ensure your changes are pushed to the respective branch of the Aurora repo:
|
|
160
|
+
- Production: `main`
|
|
161
|
+
- Staging: `develop-Oct-2025`
|
|
162
|
+
|
|
163
|
+
#### On LangSmith:
|
|
164
|
+
|
|
165
|
+
1. Click on the `Deployments` tab
|
|
166
|
+
2. Find respective project:
|
|
167
|
+
- Production: `aurora-v1-production`
|
|
168
|
+
- Staging: `aurora-v1-staging`
|
|
169
|
+
3. Click on the `+ New Revision` button on the top right
|
|
170
|
+
4. Update environment variables as needed
|
|
171
|
+
5. Click Submit to redeploy your changes
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Aurora MCP Authentication
|
|
4
|
+
Simple OAuth login - opens browser and stores token.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
import sys
|
|
9
|
+
import webbrowser
|
|
10
|
+
import http.server
|
|
11
|
+
import socketserver
|
|
12
|
+
import urllib.parse
|
|
13
|
+
import json
|
|
14
|
+
import requests
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
FINTA_API_URL_STAGING = "https://us-central1-equity-token-stage.cloudfunctions.net"
|
|
18
|
+
FINTA_API_URL_PRODUCTION = "https://us-central1-equity-token.cloudfunctions.net"
|
|
19
|
+
|
|
20
|
+
def get_api_url():
|
|
21
|
+
"""Get API URL based on environment."""
|
|
22
|
+
use_staging = os.getenv("FINTA_STAGING", "true").lower() == "true"
|
|
23
|
+
return FINTA_API_URL_STAGING if use_staging else FINTA_API_URL_PRODUCTION
|
|
24
|
+
|
|
25
|
+
def get_token_path():
|
|
26
|
+
"""Get path to store token."""
|
|
27
|
+
return Path.home() / ".cursor" / "aurora_token.json"
|
|
28
|
+
|
|
29
|
+
def main():
|
|
30
|
+
print("Aurora MCP Authentication")
|
|
31
|
+
print("=" * 40)
|
|
32
|
+
print("Opening browser for login...\n")
|
|
33
|
+
|
|
34
|
+
api_url = get_api_url()
|
|
35
|
+
auth_url = (
|
|
36
|
+
f"{api_url}/auroraOAuthAuthorize?"
|
|
37
|
+
f"response_type=code&"
|
|
38
|
+
f"client_id=cursor&"
|
|
39
|
+
f"redirect_uri=http://localhost:8765/callback"
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
webbrowser.open(auth_url)
|
|
43
|
+
|
|
44
|
+
class CallbackHandler(http.server.SimpleHTTPRequestHandler):
|
|
45
|
+
def do_GET(self):
|
|
46
|
+
query = urllib.parse.urlparse(self.path).query
|
|
47
|
+
params = urllib.parse.parse_qs(query)
|
|
48
|
+
|
|
49
|
+
if 'code' in params:
|
|
50
|
+
code = params['code'][0]
|
|
51
|
+
api_url = get_api_url()
|
|
52
|
+
|
|
53
|
+
try:
|
|
54
|
+
resp = requests.post(
|
|
55
|
+
f"{api_url}/auroraOAuthToken",
|
|
56
|
+
json={
|
|
57
|
+
"grant_type": "authorization_code",
|
|
58
|
+
"code": code,
|
|
59
|
+
"redirect_uri": "http://localhost:8765/callback"
|
|
60
|
+
},
|
|
61
|
+
timeout=10
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
if resp.status_code == 200:
|
|
65
|
+
token_data = resp.json()
|
|
66
|
+
access_token = token_data.get("access_token")
|
|
67
|
+
|
|
68
|
+
token_path = get_token_path()
|
|
69
|
+
token_path.parent.mkdir(exist_ok=True)
|
|
70
|
+
with open(token_path, 'w') as f:
|
|
71
|
+
json.dump(token_data, f, indent=2)
|
|
72
|
+
|
|
73
|
+
self.send_response(200)
|
|
74
|
+
self.send_header('Content-type', 'text/html; charset=utf-8')
|
|
75
|
+
self.end_headers()
|
|
76
|
+
html = """<html><body style="font-family: system-ui; padding: 40px; text-align: center;"><h1>Authentication Successful!</h1><p>Token has been stored.</p><p>You can close this window and restart Cursor.</p></body></html>"""
|
|
77
|
+
self.wfile.write(html.encode('utf-8'))
|
|
78
|
+
print("\n✓ Authentication successful!")
|
|
79
|
+
print(f"✓ Token stored at: {token_path}")
|
|
80
|
+
print("\nRestart Cursor to use Aurora MCP.")
|
|
81
|
+
return
|
|
82
|
+
else:
|
|
83
|
+
print(f"\n✗ Failed to get token: {resp.status_code} - {resp.text}")
|
|
84
|
+
except Exception as e:
|
|
85
|
+
print(f"\n✗ Error: {e}")
|
|
86
|
+
|
|
87
|
+
self.send_response(200)
|
|
88
|
+
self.send_header('Content-type', 'text/html')
|
|
89
|
+
self.end_headers()
|
|
90
|
+
self.wfile.write(b"<h1>Processing...</h1>")
|
|
91
|
+
|
|
92
|
+
def log_message(self, *args):
|
|
93
|
+
pass
|
|
94
|
+
|
|
95
|
+
with socketserver.TCPServer(("", 8765), CallbackHandler) as httpd:
|
|
96
|
+
print("Waiting for authentication callback...")
|
|
97
|
+
print("(Press Ctrl+C to cancel)\n")
|
|
98
|
+
try:
|
|
99
|
+
httpd.handle_request()
|
|
100
|
+
except KeyboardInterrupt:
|
|
101
|
+
print("\n\n✗ Authentication cancelled.")
|
|
102
|
+
sys.exit(1)
|
|
103
|
+
|
|
104
|
+
if __name__ == "__main__":
|
|
105
|
+
main()
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Fix org_info file to add missing founderId field."""
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
import sys
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
ORG_INFO_PATH = Path.home() / ".cursor" / "aurora_org_info.json"
|
|
9
|
+
|
|
10
|
+
def fix_org_info():
|
|
11
|
+
"""Add founderId to org_info if missing."""
|
|
12
|
+
if not ORG_INFO_PATH.exists():
|
|
13
|
+
print("Error: org_info file does not exist. Please run: aurora-authenticate")
|
|
14
|
+
return False
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
with open(ORG_INFO_PATH) as f:
|
|
18
|
+
org_info = json.load(f)
|
|
19
|
+
|
|
20
|
+
print(f"Current org_info: {json.dumps(org_info, indent=2)}")
|
|
21
|
+
|
|
22
|
+
# Add founderId if missing
|
|
23
|
+
if not org_info.get("founderId"):
|
|
24
|
+
founder_id = org_info.get("user_id") or org_info.get("userId")
|
|
25
|
+
if founder_id:
|
|
26
|
+
org_info["founderId"] = founder_id
|
|
27
|
+
with open(ORG_INFO_PATH, 'w') as f:
|
|
28
|
+
json.dump(org_info, f, indent=2)
|
|
29
|
+
print(f"\n✅ Updated org_info with founderId: {founder_id}")
|
|
30
|
+
print(f"Updated org_info: {json.dumps(org_info, indent=2)}")
|
|
31
|
+
return True
|
|
32
|
+
else:
|
|
33
|
+
print("\n❌ Error: No user_id found in org_info. Please re-authenticate with: aurora-authenticate")
|
|
34
|
+
return False
|
|
35
|
+
else:
|
|
36
|
+
print(f"\n✅ org_info already has founderId: {org_info.get('founderId')}")
|
|
37
|
+
return True
|
|
38
|
+
except Exception as e:
|
|
39
|
+
print(f"Error fixing org_info: {e}", file=sys.stderr)
|
|
40
|
+
return False
|
|
41
|
+
|
|
42
|
+
if __name__ == "__main__":
|
|
43
|
+
success = fix_org_info()
|
|
44
|
+
sys.exit(0 if success else 1)
|