Remote MCP Server to access an Oracle database in Claude on iOS
Think of MCP (Model Context Protocol) as the universal adapter for AI assistants. Just like USB-C promised to connect any device to any port, MCP lets AI models connect to virtually any data source, application, or service through a standardized protocol. Whether it's a company database, a cloud service, or a local file system, MCP bridges the gap between AI and the tools you use.
The buzz around MCP isn't just hype—it's solving a real problem. Until recently, getting AI to work with your specific data and workflows meant custom integrations, API wrangling, and a lot of developer headaches. MCP changes that by creating a common 'language' that AI models can use to communicate with external systems securely and efficiently.
Although MCP is relatively new (created by Anthropic in November 2024), all major players are backing the protocol. With developers rapidly building MCP servers for everything from databases to development tools, we're witnessing the birth of a truly connected AI ecosystem. It's not just about what AI can think—it's about what AI can do with your data.
Oracle already has an MCP server built into SQLcl, and there are some great articles from Connor McDonald, Scott Spendolini and Jeff Smith on getting this working with your own databases. You can also hook this MCP server up to the desktop versions of Anthropics Claude or OpenAI's ChatGPT, but what I wanted to do was access my OCI hosted database via an MCP server on my iPhone using the Claude iOS app. Now this isn't something that can be done natively, so hosting a local MCP server on a phone is out of the question.
Claude allows custom Connectors to be created for remote MCP servers where you specify a HTTPS URL to access the remote service. This is perfect for what I wanted to achieve but instead of hosting a local MCP service I could host the connection to the database remotely. It's not all plain sailing though. You can't setup the Connector in the Claude iOS app, instead you first need to create it in the web based version and then it becomes available in the app. Just one of a number of hoops you need to jump through to get it all working.
Here's a quick video (shortened some sequences a bit to keep it flowing) showing the MCP server working on the iPhone. This is what I'm getting Claude to do in the video:
- Access my Gmail emails and find one that contains some extra sales data that was sent to me. The data has the following fields: Country of Sale, Sale Amount, Sales Rep First & Last Names.
- Create a table in my database with that data and name it EXTRA_SALES.
- Add a column to that table to hold Sales Rep Commission and then calculate this based on a commission percentage already held in the database for the Sales Rep.
- Create a small React app to display a stacked bar chart showing sales by country for each rep.
Now just to be clear, exposing your database in this way is probably a bit of a crazy thing to do and you certainly wouldn't do this on a production system, but I'm just doing this to demonstrate the concept of remote MCP services. There's also no authentication but OAuth can be setup when creating the Connector. Also, even if you did want to do it this way you'd really want to do it via REST as an extra layer of security.
Here's a high level view of how I went about creating the remote MCP server:
- Created a HTTPS domain. To get this working quickly I created one at DuckDNS and also obtained a free SSL certification from Lets Encrypt
- Utilised an Nginx reverse proxy on the compute instance to handle the incoming SSL connection.
- I already had an autonomous database and compute instance on OCI plus the Virtual Cloud Network in place so the compute instance can connect to the database.
- Created the remote MCP server in Python utilising FastMCP, and hosted this on the OCI compute instance. To get access to the database I needed to provide the following (in a .env to keep things simple):
- Database user & password
- Connection string
- Path to a wallet
- Wallet password
- The MCP server was created with the following 'tools':
- execute_query: Execute SQL queries on the database
- list_tables: List all database tables with metadata
- test_connection: Test database connectivity
- describe_table: Get table structure (columns, data types, etc.)
- get_table_constraints: Get table constraints info
- Created the Connector in the web version of Claude specifying the HTTPS I created as the Remote MCP Server URL.
- The Connector was then made available to me in the iOS version of Claude.
That's it in a nutshell. I hope someone finds it useful. Happy remote MCP'ing!
Comments