oci-mcp-server
An MCP server for managing Oracle Cloud Infrastructure API Gateways, enabling listing and retrieval of gateway details via natural language or programmatic clients.
README
oci-mcp-server
A Python MCP (Multi-Client Protocol) server for Oracle Cloud Infrastructure (OCI) API Gateway management, with both programmatic and LLM-powered clients.
Features
- List API Gateways in a given OCI compartment.
- Get details for a specific API Gateway.
- MCP stdio transport for easy integration with LLM agents and other clients.
- LlamaIndex/Ollama client for natural language interaction with OCI API Gateway resources.
Quickstart
1. Prerequisites
- Python 3.11 (required)
- uv (fast Python package/dependency manager)
- OCI account with API Gateway access
- OCI session authentication files (
~/.oci/sessions/DEFAULT/tokenandoci_api_key.pem)
2. Install uv
curl -Ls https://astral.sh/uv/install.sh | sh
Or, from PyPI:
# With pip.
pip install uv
# Or pipx.
pipx install uv
If installed via the standalone installer, uv can update itself to the latest version:
uv self-update
Or see uv installation docs for other methods.
3. Create and Activate a Virtual Environment
uv venv --python 3.11
source .venv/bin/activate
4. Install Dependencies
uv pip install -r pyproject.toml
Or, if you want to use uv directly:
uv pip install -e .
Cursor & MCP Integration
5. Install Cursor
Cursor is an AI-powered code editor that can natively interact with MCP servers.
To install Cursor:
- Download and install Cursor from the official website for your platform (macOS, Windows, Linux).
- Follow the installation instructions for your OS.
6. Update your mcp.json configuration
To connect Cursor to your custom MCP server, you need to update or create an mcp.json file in your project root. Use the provided template in src/mcp_template.json as a starting point.
Steps
-
Open Cursor Settings by navigating to
Cursor > Settings... > Cursor Settings -
Select
MCP > + Add new global MCP server
You should also be able to edit mcp.json from vi ~/.cursor/mcp.json
Steps:
-
Copy the content of
src/mcp_template.jsonto~/.cursor/mcp.json(or tomcp.jsonfrom the editor): -
Edit
mcp.jsonand update the paths:- Replace
<path to Python>with the absolute path to your Python 3.11 executable if using a virtual environment). - Replace
<path to server.py>with the absolute path to yourserver.pyscript.
- Replace
-
Save the file. Cursor will now be able to discover and connect to your MCP server.
Configuration
Edit src/config.py to set your OCI compartment and gateway OCIDs, region, and profile as needed:
PROFILE_NAME = 'DEFAULT'
REGION = 'ap-mumbai-1'
SERVICE_ENDPOINT = '<SERVICE ENDPOINT>'
COMPARTMENT_ID = '<COMPARTMENT_ID>'
GATEWAY_ID = '<GATEWAY_ID>' # For Programmatic Client
You must have valid OCI session files in ~/.oci/sessions/DEFAULT/.
You can do so by something like this oci session authenticate --tenancy-name <TENANCY_NAME> --profile-name DEFAULT --region $REGION
Running the MCP Server
From the project root: (I have found that its better to run the server in a separate terminal)
python src/server.py
This will start the MCP server using stdio transport, exposing the following tools:
list_gateways_tool(compartment_id)get_gateway_tool(gateway_id)
Cursor Client (Agent Mode)
You do not need to run the MCP server for Cursor. As Cursor Agent will run it from the server resource provided in mcp.json
See src/mcp_template.json for an example MCP server config:
{
"mcpServers": {
"oci_api_gateway": {
"command": "<absolute path to Python (preferably from .venv)>",
"args": [
"<absolute path to server.py>"
]
}
}
}
In the Cursor editor, you can now interact with the MCP server using natural language queries.
For example, to list all the gateways in a specific compartment, you can type:
Example:
list all the gateways in ocid1.compartment.oc1..aaaaaaaai2zzsg.............................m4pjq
The Cursor agent will process your request and return the results from the MCP server.
Programmatic Client
The Programmatic Client allows you to test and interact with your custom MCP tools directly using Python code, without involving an AI agent. It's useful for verifying tool functionality and debugging server responses in a straightforward, scriptable way.
See src/client_stdio.py for a simple example:
python src/client_stdio.py
This will:
- Connect to the MCP server
- List available tools
- Call the
list_gateways_toolandget_gateway_toolmethods and print results
WIP: LlamaIndex + Ollama Client
The LlamaIndex + Ollama Client is a work in progress (WIP) that aims to enable natural language interaction with your MCP tools using an self hosted LLM agent
See src/client_llama_react.py for an advanced example using LlamaIndex and Ollama (Llama 3.2):
- Make sure you have Ollama running locally with the
llama3.2model. - Edit the
server_paramspath inclient_llama_react.pyif needed.
python src/client_llama_react.py
This will:
- Connect to the MCP server
- Wrap the tools for LlamaIndex
- Run a natural language query using the LLM
Development
- All source code is in the
src/directory. - Dependencies are managed via
pyproject.toml. - To add new tools, edit
src/server.pyand implement logic insrc/gateway_services.py(for gateway resources).
Troubleshooting
- Ensure your OCI session files are present and valid.
- Use Python 3.11 and the provided virtual environment.
- For LlamaIndex/Ollama, ensure the Ollama server is running and accessible.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。