File tree Expand file tree Collapse file tree 2 files changed +23
-8
lines changed Expand file tree Collapse file tree 2 files changed +23
-8
lines changed Original file line number Diff line number Diff 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
105105OPENAI_API_KEY=your-api-key
106106
107107# MCP Server Configuration
108108MCP_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
1131151 . ** OPENAI_API_KEY** : Your OpenAI API key for accessing GPT models
1141162 . ** 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
Original file line number Diff line number Diff line change 1414# Get environment variables
1515OPENAI_API_KEY = os .getenv ("OPENAI_API_KEY" )
1616MCP_SERVER_URL = os .getenv ("MCP_SERVER_URL" )
17+ MCP_SERVER_API_KEY = os .getenv ("MCP_SERVER_API_KEY" )
1718
1819# Validate required environment variables
1920if not OPENAI_API_KEY :
2021 raise ValueError ("OPENAI_API_KEY environment variable is required" )
2122if 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
2528chat_model = ChatOpenAI (model = "gpt-4o-mini" )
2629
2730async 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 ()
You can’t perform that action at this time.
0 commit comments