Skip to content

Commit 72576b0

Browse files
committed
use env vars instead
Signed-off-by: Richard Gebhardt <[email protected]>
1 parent 5073fcd commit 72576b0

File tree

84 files changed

+972
-176
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+972
-176
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,26 @@ For macOS/Linux:
5555
}
5656
```
5757

58+
To connect to an MCP server running in HTTP steaming mode:
59+
Assuming you started the server by running:
60+
```bash
61+
MCP_HOST=localhost MCP_PORT=8888 uvx oracle.oci-api-mcp-server
62+
```
63+
then place the following in your MCP client configuration:
64+
:warning: NOTE: the `type` attribute may be client-specific. Some MCP clients
65+
use `http` as the transport value while others (like Cline) will expect `streamableHttp`.
66+
67+
```json
68+
{
69+
"mcpServers": {
70+
"oracle-oci-api-mcp-server": {
71+
"type": "streamableHttp",
72+
"url": "http://localhost:8888/mcp"
73+
}
74+
}
75+
}
76+
```
77+
5878
## Authentication
5979

6080
For OCI MCP servers, you'll need to install and authenticate using the OCI CLI.
@@ -309,6 +329,17 @@ update it as needed. For instance:
309329
where `<absolute path to your server code>` is the absolute path to the server code, for instance
310330
`/Users/myuser/dev/oci-mcp/src/oci-identity-mcp-server/oracle/oci_identity_mcp_server`.
311331

332+
To build and test servers running in HTTP transport mode:
333+
```bash
334+
make build
335+
make install
336+
```
337+
338+
then start the server:
339+
```bash
340+
VIRTUAL_ENV=$(pwd)/.venv MCP_HOST=0.0.0.0 MCP_PORT=8888 uv run oracle.oci-api-mcp-server
341+
```
342+
312343
### Inspector
313344

314345
The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction)

src/database-mcp-server/oracle/database_mcp_server/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"""
66

77
__project__ = "oracle.database-mcp-server"
8-
__version__ = "1.0.0"
8+
__version__ = "1.0.1"

src/oci-api-mcp-server/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,18 @@ It includes tools to help with OCI command execution and provide helpful informa
77

88
## Running the server
99

10+
### STDIO transport mode
11+
12+
```sh
13+
uvx oracle.oci-api-mcp-server
14+
```
15+
16+
### HTTP streaming transport mode
17+
1018
```sh
11-
uv run oracle.oci-api-mcp-server
19+
MCP_HOST=<hostname/IP address> MCP_PORT=<port number> uvx oracle.oci-api-mcp-server
1220
```
21+
1322
## Tools
1423

1524
| Tool Name | Description |

src/oci-api-mcp-server/oracle/oci_api_mcp_server/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"""
66

77
__project__ = "oracle.oci-api-mcp-server"
8-
__version__ = "1.0.3"
8+
__version__ = "1.1.0"

src/oci-api-mcp-server/oracle/oci_api_mcp_server/server.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
https://oss.oracle.com/licenses/upl.
55
"""
66

7-
import argparse
87
import json
98
import os
109
import subprocess
@@ -209,13 +208,11 @@ def run_oci_command(
209208

210209
def main():
211210

212-
parser = argparse.ArgumentParser()
213-
parser.add_argument("--port", type=int, help="Port to use for HTTP mode")
214-
parser.add_argument("--host", type=str, help="Hostname or IP address to bind to")
215-
args = parser.parse_args()
211+
host = os.getenv("MCP_HOST")
212+
port = os.getenv("MCP_PORT")
216213

217-
if args.port and args.host:
218-
mcp.run(transport="http", host=args.host, port=args.port)
214+
if host and port:
215+
mcp.run(transport="http", host=host, port=int(port))
219216
else:
220217
mcp.run()
221218

src/oci-api-mcp-server/oracle/oci_api_mcp_server/tests/test_oci_api_tools.py

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,56 @@ async def test_run_oci_command_denied(self, mock_json_loads, mock_run):
205205
)
206206
).data
207207

208-
print(type(result))
209208
assert "error" in result
210209
assert any("denied by denylist" in value for value in result.values())
210+
211+
212+
class TestServer:
213+
@patch("oracle.oci_api_mcp_server.server.mcp.run")
214+
@patch("os.getenv")
215+
def test_main_with_host_and_port(self, mock_getenv, mock_mcp_run):
216+
mock_env = {
217+
"MCP_HOST": "1.2.3.4",
218+
"MCP_PORT": 8888,
219+
}
220+
221+
mock_getenv.side_effect = lambda x: mock_env.get(x)
222+
import oracle.oci_api_mcp_server.server as server
223+
224+
server.main()
225+
mock_mcp_run.assert_called_once_with(
226+
transport="http", host=mock_env["MCP_HOST"], port=mock_env["MCP_PORT"]
227+
)
228+
229+
@patch("oracle.oci_api_mcp_server.server.mcp.run")
230+
@patch("os.getenv")
231+
def test_main_without_host_and_port(self, mock_getenv, mock_mcp_run):
232+
mock_getenv.return_value = None
233+
import oracle.oci_api_mcp_server.server as server
234+
235+
server.main()
236+
mock_mcp_run.assert_called_once_with()
237+
238+
@patch("oracle.oci_api_mcp_server.server.mcp.run")
239+
@patch("os.getenv")
240+
def test_main_with_only_host(self, mock_getenv, mock_mcp_run):
241+
mock_env = {
242+
"MCP_HOST": "1.2.3.4",
243+
}
244+
mock_getenv.side_effect = lambda x: mock_env.get(x)
245+
import oracle.oci_api_mcp_server.server as server
246+
247+
server.main()
248+
mock_mcp_run.assert_called_once_with()
249+
250+
@patch("oracle.oci_api_mcp_server.server.mcp.run")
251+
@patch("os.getenv")
252+
def test_main_with_only_port(self, mock_getenv, mock_mcp_run):
253+
mock_env = {
254+
"MCP_PORT": "8888",
255+
}
256+
mock_getenv.side_effect = lambda x: mock_env.get(x)
257+
import oracle.oci_api_mcp_server.server as server
258+
259+
server.main()
260+
mock_mcp_run.assert_called_once_with()

src/oci-api-mcp-server/pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "oracle.oci-api-mcp-server"
3-
version = "1.0.3"
3+
version = "1.1.0"
44
description = "OCI CLI MCP server"
55
readme = "README.md"
66
requires-python = ">=3.13"
@@ -49,5 +49,3 @@ omit = [
4949
[tool.coverage.report]
5050
precision = 2
5151
fail_under = 91.81
52-
53-

src/oci-api-mcp-server/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/oci-cloud-guard-mcp-server/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,16 @@ It includes tools to help with managing cloud guard problems.
77

88
## Running the server
99

10+
### STDIO transport mode
11+
1012
```sh
11-
uv run oracle.oci-cloud-guard-mcp-server
13+
uvx oracle.oci-cloud-guard-mcp-server
14+
```
15+
16+
### HTTP streaming transport mode
17+
18+
```sh
19+
MCP_HOST=<hostname/IP address> MCP_PORT=<port number> uvx oracle.oci-cloud-guard-mcp-server
1220
```
1321

1422
## Tools
@@ -35,5 +43,3 @@ Copyright (c) 2025 Oracle and/or its affiliates.
3543

3644
Released under the Universal Permissive License v1.0 as shown at
3745
<https://oss.oracle.com/licenses/upl/>.
38-
39-

src/oci-cloud-guard-mcp-server/oracle/oci_cloud_guard_mcp_server/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"""
66

77
__project__ = "oracle.oci-cloud-guard-mcp-server"
8-
__version__ = "1.0.1"
8+
__version__ = "1.1.0"

0 commit comments

Comments
 (0)