File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,10 +8,6 @@ RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
88COPY . /app
99WORKDIR /app
1010
11- # Provide empty MCP config as default; mount your own at runtime:
12- # docker run -v /path/to/servers_config.json:/app/servers_config.json ...
13- COPY dummy_servers_config.json /app/servers_config.json
14-
1511# Sync the project into a new environment, asserting the lockfile is up to date
1612RUN uv sync --locked
1713
Original file line number Diff line number Diff line change @@ -65,9 +65,9 @@ Optional HTTP proxy for outbound requests:
6565export HTTP_PROXY=""
6666```
6767
68- ## MCP Server Configuration
68+ ## MCP Server Configuration (Optional)
6969
70- Edit ` servers_config.json ` to add your MCP servers:
70+ Create a ` servers_config.json ` file to add your MCP servers. If this file is not provided, the bot starts with no MCP servers configured.
7171
7272``` json
7373{
@@ -81,6 +81,21 @@ Edit `servers_config.json` to add your MCP servers:
8181}
8282```
8383
84+ For HTTP-based MCP servers (Streamable HTTP), use ` httpUrl ` :
85+
86+ ``` json
87+ {
88+ "mcpServers" : {
89+ "my-server" : {
90+ "httpUrl" : " https://mcp.example.com/mcp" ,
91+ "headers" : {
92+ "Accept" : " application/json, text/event-stream"
93+ }
94+ }
95+ }
96+ }
97+ ```
98+
8499For local MCP servers, use ` uv --directory ` :
85100
86101``` json
@@ -106,6 +121,18 @@ uv run bot
106121``` bash
107122docker build -t agentic-slackbot .
108123
124+ docker run -d \
125+ --name slackbot \
126+ -e SLACK_BOT_TOKEN=" " \
127+ -e SLACK_APP_TOKEN=" " \
128+ -e OPENAI_API_KEY=" " \
129+ -e OPENAI_MODEL=" gpt-4.1" \
130+ agentic-slackbot
131+ ```
132+
133+ To use MCP servers, mount your config file:
134+
135+ ``` bash
109136docker run -d \
110137 --name slackbot \
111138 -e SLACK_BOT_TOKEN=" " \
Original file line number Diff line number Diff line change 11import json
2+ import logging
23import os
34from typing import Any
45
56from dotenv import find_dotenv
67from dotenv import load_dotenv
78
9+ logger = logging .getLogger (__name__ )
10+
811
912class Configuration :
1013 """Manages configuration and environment variables for the MCP Slackbot."""
@@ -22,19 +25,27 @@ def load_env() -> None:
2225 """Load environment variables from .env file."""
2326 load_dotenv (find_dotenv ())
2427
28+ _DEFAULT_CONFIG : dict [str , Any ] = {"mcpServers" : {}}
29+
2530 @staticmethod
2631 def load_config (file_path : str ) -> dict [str , Any ]:
2732 """Load server configuration from JSON file.
2833
34+ Returns a default empty config when the file does not exist,
35+ allowing the application to start without a config file.
36+
2937 Args:
3038 file_path: Path to the JSON configuration file.
3139
3240 Returns:
3341 Dict containing server configuration.
3442
3543 Raises:
36- FileNotFoundError: If configuration file doesn't exist.
3744 JSONDecodeError: If configuration file is invalid JSON.
3845 """
39- with open (file_path ) as f :
40- return json .load (f )
46+ try :
47+ with open (file_path ) as f :
48+ return json .load (f )
49+ except FileNotFoundError :
50+ logger .warning ("Config file %s not found, using default empty config" , file_path )
51+ return dict (Configuration ._DEFAULT_CONFIG )
Load diff This file was deleted.
Original file line number Diff line number Diff line change @@ -55,9 +55,9 @@ def test_loads_valid_json(self, tmp_path):
5555 result = Configuration .load_config (str (config_file ))
5656 assert result == config_data
5757
58- def test_raises_on_missing_file (self ):
59- with pytest . raises ( FileNotFoundError ):
60- Configuration . load_config ( "/nonexistent/config.json" )
58+ def test_returns_default_on_missing_file (self ):
59+ result = Configuration . load_config ( "/nonexistent/config.json" )
60+ assert result == { "mcpServers" : {}}
6161
6262 def test_raises_on_invalid_json (self , tmp_path ):
6363 config_file = tmp_path / "bad.json"
You can’t perform that action at this time.
0 commit comments