Skip to content

Commit a065c7c

Browse files
committed
fix(jira): enhance environment variable handling in JiraConfig
Updated the JiraConfig class to support optional prefixes for environment variables, allowing for more flexible configuration. This change includes: - Added a `prefix` argument to the `from_env` method to customize environment variable names. - Updated environment variable retrieval to use the specified prefix where applicable. - Improved error messages for missing required variables, ensuring clarity on which variables are needed. This enhancement facilitates better integration in environments with multiple configurations, such as testing or deployment scenarios. Fixes sooperset#769
1 parent ca05d51 commit a065c7c

28 files changed

+24046
-880
lines changed

CURSOR_MCP_CONFIG.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Cursor MCP Configuration for mcp-atlassian
2+
3+
## Local Installation Configuration
4+
5+
Since you're running the server locally (not via Docker), use this configuration in Cursor:
6+
7+
1. Open Cursor Settings → MCP → + Add new global MCP server
8+
9+
2. Use this JSON configuration:
10+
11+
```json
12+
{
13+
"mcpServers": {
14+
"mcp-atlassian": {
15+
"command": "uv",
16+
"args": [
17+
"run",
18+
"--directory",
19+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross",
20+
"mcp-atlassian"
21+
],
22+
"env": {
23+
"JIRA_URL": "https://your-company.atlassian.net",
24+
"JIRA_USERNAME": "[email protected]",
25+
"JIRA_API_TOKEN": "your_jira_api_token",
26+
"CONFLUENCE_URL": "https://your-company.atlassian.net/wiki",
27+
"CONFLUENCE_USERNAME": "[email protected]",
28+
"CONFLUENCE_API_TOKEN": "your_confluence_api_token"
29+
}
30+
}
31+
}
32+
}
33+
```
34+
35+
## Alternative: Using .env File
36+
37+
If you prefer to use a `.env` file (recommended for security):
38+
39+
1. Create a `.env` file in this directory with your credentials
40+
2. Use this configuration:
41+
42+
```json
43+
{
44+
"mcpServers": {
45+
"mcp-atlassian": {
46+
"command": "uv",
47+
"args": [
48+
"run",
49+
"--directory",
50+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross",
51+
"mcp-atlassian",
52+
"--env-file",
53+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross/.env"
54+
]
55+
}
56+
}
57+
}
58+
```
59+
60+
## Testing the Server
61+
62+
To test if the server works correctly, you can use the MCP Inspector:
63+
64+
```bash
65+
cd /Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross
66+
npx @modelcontextprotocol/inspector uv run --directory . mcp-atlassian
67+
```
68+
69+
## Notes
70+
71+
- Replace the placeholder URLs and credentials with your actual Atlassian instance details
72+
- For Server/Data Center, use `JIRA_PERSONAL_TOKEN` and `CONFLUENCE_PERSONAL_TOKEN` instead of username/token
73+
- The server will automatically start when Cursor needs it - you don't need to run it manually
74+
75+
76+
77+

Jira (1).xml

Lines changed: 12503 additions & 0 deletions
Large diffs are not rendered by default.

MULTIPLE_ACCOUNTS_SETUP.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Multiple Accounts Setup Guide
2+
3+
You can configure multiple Atlassian accounts by creating separate `.env` files. There are two approaches:
4+
5+
## Approach 1: Single MCP Server (Recommended)
6+
7+
Use **one MCP server** and switch between accounts by changing the `.env` file path in the configuration. This avoids duplicate tools.
8+
9+
### Setup:
10+
11+
1. **Create separate .env files:**
12+
- `.env` - Account 1 (default)
13+
- `.env.account2` - Account 2
14+
- `.env.account3` - Account 3 (if needed)
15+
16+
2. **Configure ONE MCP server in Cursor:**
17+
18+
```json
19+
{
20+
"mcpServers": {
21+
"mcp-atlassian": {
22+
"command": "uv",
23+
"args": [
24+
"run",
25+
"--directory",
26+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross",
27+
"mcp-atlassian",
28+
"--env-file",
29+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross/.env"
30+
]
31+
}
32+
}
33+
}
34+
```
35+
36+
3. **To switch accounts:**
37+
- Change the `--env-file` path in Cursor settings
38+
- Or rename your `.env` files (e.g., rename `.env.account2` to `.env`)
39+
- Restart/reload the MCP server in Cursor
40+
41+
### Pros:
42+
- ✅ No duplicate tools
43+
- ✅ Cleaner interface
44+
- ✅ One set of tools
45+
46+
### Cons:
47+
- ⚠️ Can only use one account at a time
48+
- ⚠️ Need to manually switch when changing accounts
49+
50+
---
51+
52+
## Approach 2: Multiple MCP Servers (Advanced)
53+
54+
Use **multiple MCP servers** if you need to access both accounts simultaneously. This will create duplicate tools (one set per server).
55+
56+
### Setup:
57+
58+
1. **Create separate .env files** (same as Approach 1)
59+
60+
2. **Configure MULTIPLE MCP servers in Cursor:**
61+
62+
```json
63+
{
64+
"mcpServers": {
65+
"mcp-atlassian-account1": {
66+
"command": "uv",
67+
"args": [
68+
"run",
69+
"--directory",
70+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross",
71+
"mcp-atlassian",
72+
"--env-file",
73+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross/.env"
74+
]
75+
},
76+
"mcp-atlassian-account2": {
77+
"command": "uv",
78+
"args": [
79+
"run",
80+
"--directory",
81+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross",
82+
"mcp-atlassian",
83+
"--env-file",
84+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross/.env.account2"
85+
]
86+
}
87+
}
88+
}
89+
```
90+
91+
### Pros:
92+
- ✅ Can use both accounts simultaneously
93+
- ✅ Tools are prefixed with server name (e.g., `mcp-atlassian-account1_jira_get_issue`)
94+
95+
### Cons:
96+
- ⚠️ Duplicate tools (one set per account)
97+
- ⚠️ More cluttered interface
98+
- ⚠️ Need to specify which server to use
99+
100+
---
101+
102+
## Approach 3: Environment Variables (No .env files)
103+
104+
Pass credentials directly in the MCP configuration (not recommended for security, but useful for quick switching):
105+
106+
```json
107+
{
108+
"mcpServers": {
109+
"mcp-atlassian": {
110+
"command": "uv",
111+
"args": [
112+
"run",
113+
"--directory",
114+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross",
115+
"mcp-atlassian"
116+
],
117+
"env": {
118+
"JIRA_URL": "https://account1.atlassian.net",
119+
"JIRA_USERNAME": "[email protected]",
120+
"JIRA_API_TOKEN": "token1"
121+
}
122+
}
123+
}
124+
}
125+
```
126+
127+
To switch, just change the `env` values in Cursor settings.
128+
129+
---
130+
131+
## Recommendation
132+
133+
**Use Approach 1** (Single MCP Server) if you typically work with one account at a time. It's cleaner and avoids tool duplication.
134+
135+
**Use Approach 2** (Multiple MCP Servers) only if you need to access both accounts simultaneously in the same session.
136+
137+
## Security Note
138+
139+
- Never commit `.env` files to version control (already in `.gitignore`)
140+
- Keep each account's credentials in separate files
141+
- Use descriptive names for your `.env` files

cursor-mcp-config.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"mcpServers": {
3+
"mcp-atlassian": {
4+
"command": "uv",
5+
"args": [
6+
"run",
7+
"--directory",
8+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross",
9+
"mcp-atlassian",
10+
"--env-file",
11+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross/.env"
12+
]
13+
}
14+
}
15+
}
16+
17+
18+
19+

cursor-mcp-multiple-accounts.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"mcpServers": {
3+
"mcp-atlassian-account1": {
4+
"command": "uv",
5+
"args": [
6+
"run",
7+
"--directory",
8+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross",
9+
"mcp-atlassian",
10+
"--env-file",
11+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross/.env"
12+
]
13+
},
14+
"mcp-atlassian-account2": {
15+
"command": "uv",
16+
"args": [
17+
"run",
18+
"--directory",
19+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross",
20+
"mcp-atlassian",
21+
"--env-file",
22+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross/.env.account2"
23+
]
24+
}
25+
}
26+
}
27+

cursor-mcp-single-server.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"mcpServers": {
3+
"mcp-atlassian": {
4+
"command": "uv",
5+
"args": [
6+
"run",
7+
"--directory",
8+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross",
9+
"mcp-atlassian",
10+
"--env-file",
11+
"/Users/jose.ugaldevivo/Dev/RYU/Farmacia_Macross/.env"
12+
]
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)