Skip to content

Commit e4293bc

Browse files
authored
Merge pull request #4 from sridhar-daxa/main
Add support for pebblo mcp-server api-key
2 parents b2226de + 17b5ad7 commit e4293bc

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

atlassian_langgraph_app/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,27 @@ The application follows a clean modular design:
9898
## Configuration
9999

100100
### Environment Variables
101-
The application uses environment variables for configuration. Create a `.env` file in the project root with the following variables:
101+
The application uses environment variables for configuration. Create a `.env` file in the project root with the following variables:
102102

103103
```bash
104104
# OpenAI API Configuration
105105
OPENAI_API_KEY=your-api-key
106106

107107
# MCP Server Configuration
108108
MCP_SERVER_URL=your-server-url
109+
# Optional: API key for MCP server (sent as Authorization: Bearer <key>)
110+
MCP_SERVER_API_KEY=your-mcp-api-key
109111
```
110112

111113
### Required Environment Variables
112114

113115
1. **OPENAI_API_KEY**: Your OpenAI API key for accessing GPT models
114116
2. **MCP_SERVER_URL**: The URL of your Atlassian MCP server (e.g., `http://localhost:9003/mcp`)
115117

118+
### Optional Environment Variables
119+
120+
- **MCP_SERVER_API_KEY**: If set, the app will add `Authorization: Bearer <MCP_SERVER_API_KEY>` to requests to the MCP server.
121+
116122
### Security Notes
117123
- Never commit your `.env` file to version control
118124
- Use different API keys for development and production

atlassian_langgraph_app/main.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,36 @@
1414
# Get environment variables
1515
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
1616
MCP_SERVER_URL = os.getenv("MCP_SERVER_URL")
17+
MCP_SERVER_API_KEY = os.getenv("MCP_SERVER_API_KEY")
1718

1819
# Validate required environment variables
1920
if not OPENAI_API_KEY:
2021
raise ValueError("OPENAI_API_KEY environment variable is required")
2122
if not MCP_SERVER_URL:
2223
raise ValueError("MCP_SERVER_URL environment variable is required")
24+
if not MCP_SERVER_API_KEY:
25+
raise ValueError("MCP_SERVER_API_KEY environment variable is required")
2326

2427
# Load chat model
2528
chat_model = ChatOpenAI(model="gpt-4o-mini")
2629

2730
async def setup_langgraph():
2831
"""Setup and return the LangGraph with Atlassian MCP tools"""
2932
# Connect to Atlassian MCP server via Docker
30-
mcp_client = MultiServerMCPClient(
31-
{
32-
"mcp-atlassian": {
33-
"url": MCP_SERVER_URL,
34-
"transport": "streamable_http"
35-
}
33+
server_config = {
34+
"url": MCP_SERVER_URL,
35+
"transport": "streamable_http",
36+
}
37+
38+
# Optionally pass Authorization header if MCP_SERVER_API_KEY is set
39+
if MCP_SERVER_API_KEY:
40+
server_config["headers"] = {
41+
"Authorization": f"Bearer {MCP_SERVER_API_KEY}"
3642
}
37-
)
43+
44+
mcp_client = MultiServerMCPClient({
45+
"mcp-atlassian": server_config
46+
})
3847

3948
# Get tools from the client
4049
tools = await mcp_client.get_tools()

0 commit comments

Comments
 (0)