Skip to content

Commit 1d8d374

Browse files
add mcp-atlassian to runner for jira use (#365)
Signed-off-by: Michael Clifford <mcliffor@redhat.com>
1 parent f6639ac commit 1d8d374

File tree

3 files changed

+30
-58
lines changed

3 files changed

+30
-58
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"mcpServers": {
3+
"mcp-atlassian": {
4+
"command": "mcp-atlassian",
5+
"args": [],
6+
"env": {
7+
"JIRA_URL": "${JIRA_URL}",
8+
"JIRA_PERSONAL_TOKEN": "${JIRA_API_TOKEN}",
9+
"JIRA_SSL_VERIFY": "true",
10+
"READ_ONLY_MODE": "true"
11+
}
12+
}
13+
}
14+
}

components/runners/claude-code-runner/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dependencies = [
1414
"anthropic[vertex]>=0.68.0",
1515
"claude-agent-sdk>=0.1.4",
1616
"langfuse>=3.0.0",
17+
"mcp-atlassian>=0.11.9",
1718
]
1819

1920
[tool.uv]
@@ -31,4 +32,3 @@ py-modules = ["wrapper", "observability", "security_utils"]
3132
[build-system]
3233
requires = ["setuptools>=61.0"]
3334
build-backend = "setuptools.build_meta"
34-

components/runners/claude-code-runner/wrapper.py

Lines changed: 15 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,72 +1968,30 @@ def _filter_mcp_servers(self, servers: dict) -> dict:
19681968
return allowed_servers
19691969

19701970
def _load_mcp_config(self, cwd_path: str) -> dict | None:
1971-
"""Load MCP server configuration from .mcp.json file in the workspace.
1971+
"""Load MCP server configuration from the ambient runner's .mcp.json file.
19721972
1973-
Searches for .mcp.json in the following locations:
1974-
1. MCP_CONFIG_PATH environment variable (if set)
1975-
2. cwd_path/.mcp.json (main working directory)
1976-
3. workspace root/.mcp.json (for multi-repo setups)
1973+
Only loads MCP servers from the centrally-controlled configuration file
1974+
in the runner's own directory. Does NOT load from user workspace repos
1975+
for security reasons.
19771976
1978-
Only allows http and sse type MCP servers.
1977+
The .mcp.json file should be located at:
1978+
/app/claude-runner/.mcp.json (in the container)
19791979
19801980
Returns the parsed MCP servers configuration dict, or None if not found.
19811981
"""
19821982
try:
1983-
# Check if MCP discovery is disabled
1984-
if os.getenv('MCP_CONFIG_SEARCH', '').strip().lower() in ('0', 'false', 'no'):
1985-
logging.info("MCP config search disabled by MCP_CONFIG_SEARCH env var")
1986-
return None
1987-
1988-
# Option 1: Explicit path from environment
1989-
explicit_path = os.getenv('MCP_CONFIG_PATH', '').strip()
1990-
if explicit_path:
1991-
mcp_file = Path(explicit_path)
1992-
if mcp_file.exists() and mcp_file.is_file():
1993-
logging.info(f"Loading MCP config from MCP_CONFIG_PATH: {mcp_file}")
1994-
with open(mcp_file, 'r') as f:
1995-
config = _json.load(f)
1996-
all_servers = config.get('mcpServers', {})
1997-
filtered_servers = self._filter_mcp_servers(all_servers)
1998-
if filtered_servers:
1999-
logging.info(f"MCP servers loaded: {list(filtered_servers.keys())}")
2000-
return filtered_servers
2001-
logging.info("No valid MCP servers found after filtering")
2002-
return None
2003-
else:
2004-
logging.warning(f"MCP_CONFIG_PATH specified but file not found: {explicit_path}")
1983+
# Only load from the runner's own directory
1984+
runner_mcp_file = Path("/app/claude-runner/.mcp.json")
20051985

2006-
# Option 2: Look in cwd_path (main working directory)
2007-
mcp_file = Path(cwd_path) / ".mcp.json"
2008-
if mcp_file.exists() and mcp_file.is_file():
2009-
logging.info(f"Found .mcp.json in working directory: {mcp_file}")
2010-
with open(mcp_file, 'r') as f:
1986+
if runner_mcp_file.exists() and runner_mcp_file.is_file():
1987+
logging.info(f"Loading MCP config from runner directory: {runner_mcp_file}")
1988+
with open(runner_mcp_file, 'r') as f:
20111989
config = _json.load(f)
20121990
all_servers = config.get('mcpServers', {})
2013-
filtered_servers = self._filter_mcp_servers(all_servers)
2014-
if filtered_servers:
2015-
logging.info(f"MCP servers loaded from {mcp_file}: {list(filtered_servers.keys())}")
2016-
return filtered_servers
2017-
logging.info("No valid MCP servers found after filtering")
2018-
return None
2019-
2020-
# Option 3: Look in workspace root (for multi-repo setups)
2021-
if self.context and self.context.workspace_path != cwd_path:
2022-
workspace_mcp_file = Path(self.context.workspace_path) / ".mcp.json"
2023-
if workspace_mcp_file.exists() and workspace_mcp_file.is_file():
2024-
logging.info(f"Found .mcp.json in workspace root: {workspace_mcp_file}")
2025-
with open(workspace_mcp_file, 'r') as f:
2026-
config = _json.load(f)
2027-
all_servers = config.get('mcpServers', {})
2028-
filtered_servers = self._filter_mcp_servers(all_servers)
2029-
if filtered_servers:
2030-
logging.info(f"MCP servers loaded from {workspace_mcp_file}: {list(filtered_servers.keys())}")
2031-
return filtered_servers
2032-
logging.info("No valid MCP servers found after filtering")
2033-
return None
2034-
2035-
logging.info("No .mcp.json file found in any search location")
2036-
return None
1991+
return all_servers
1992+
else:
1993+
logging.info("No .mcp.json file found in runner directory")
1994+
return None
20371995

20381996
except _json.JSONDecodeError as e:
20391997
logging.error(f"Failed to parse .mcp.json: {e}")

0 commit comments

Comments
 (0)