Integrating Gemini CLI with the "Context Plane" via the use of a MCP Server
“Context” of this post
I often find writing helps me coalesce and refine my thoughts when new patterns start to emerge, but aren’t very clear yet.
So this article is a brain dump / train of thought continuation of the architecture needed to have one Context Plane to rule them all, as part of a proposed “AI Data Stack”.
This article provides an overview of integrating and using Claude and Google Gemini CLI with the “Context Plane” via a MCP service.
MCP (Model Context Protocol)
The next thing I wanted to understand was how a MCP would work with the current version of the “Context Plane” we have in the current AgileData Platform.
McSpikey
So time to do a McSpikey (experiment) with Nigel. Success for this experiment was to be able to query the AgileData “Context Plane” with tools such as Claude and Gemini CLI.
MCP Server
We are a Google Cloud only platform so we thought that using this MCP server would make sense
https://github.com/googleapis/genai-toolbox
But after some investigation Nigel worked out it would mean a lot of rework, as we would have had to define all the tools and sql queries needed to query Google Spanner, where we store our Context.
Since we already have all those queries defined as part of the AgileData Platform API’s. Nigel discovered that we could just wrap our existing FastAPI endpoints with FastApiMCP and so we implemented that.
In the words of Nigel:
toolbox is just a wrapper for the same transports etc we are using, we just get them from free and dont need to write all the config that it requires … think 5mins to enable compared to hours of
We always like minutes over hours at AgileData and we love the DORO principle (Define Once, Reuse Often)
There were some challenges deploying FastAPIMcCP via Google App Engine, if you want more details on that just ask and Nigel can write up a more technical post on how that went.
Architecture
So we ended up with an architecture that looks like:
Gemini CLI talks to MCP Service
MCP Service calls applicable API (exposed as tools)
API talks to “Context Plane”
Connecting Gemini CLI to MCP server
Its always funny what takes the most time when doing a McSpikey.
When Nigel setup the MCP server he connected to it using Claude, next learning you need to have a paid version of Claude to provide MCP connectivity.
So I though I would use Google Gemini CLI for me.
Next learning, the paid version of Claude makes it very easy to define the MCP connection, you pretty much paste the url for it in.
Gemini CLI not so much, you need to frig around with JSON strings in a settings.json file.
And of course finding the exact structure for that JSON is a pain.
After a bit of trial and error got it working with this:
{
“selectedAuthType”: “oauth-personal”,
“theme”: “Dracula”,
“mcpServers”: {
“MCPServer1": {
“url”: "https://mcpserver1/mcp
}
}
}
Lets Get Ready to Rumble
Does it connect?
So first test does it connect to our “Context Plane”?
/mcp list
Yup it can see the MCP server and it can see four API end points that we have exposed.
Does it see Context objects?
Next lets test if it can see objects stored in the “Context Plane”
list tile names
Its worked out the correct API to hit to get back a list of Tiles from the Catalog.
And its given me a list of Tile names.
Does it understand Context for those objects?
We run a layered data architecture and the Data Layer is held as Context for the Tiles, not in the tile name etc. So that why im getting multiple Tiles back with the same name.
Lets try to get some Context.
list tile names and their data layer
All good, it worked out what Data Layer the Tiles belong in.
Interestingly we never use the term “Data Layer” in the “Context Plane”, im guessing its picked up the Data Layer from the table prefix or the object type we hold against each tile.
I had assumed we would need to add extensive aliasing of terms in the “Context Plane” to make it find answers to people natural language questions, but given Gemini CLI is backed by the Gemini LLM maybe we don’t.
(This is the value of doing a McSpikey, you discover things you didn’t know, and of course end up with more questions to answer).
Real Life Use Cases
I have been asking people at the coal face for use cases they constantly hit where they think accessing the “Context Plane” may reduce the complexity of the data work they do.
Im looking for use cases that are more than the usual “text to SQL” use case everybody now has as table stakes in their product.
Get Data Catalog Tiles
We have already proven we can connect and get Catalog Tiles using Gemini CLI.
But I am a GUI by default kinda guy and so for that use case I would just use the Catalog search screen in the AgileData App.
A couple of clicks and i’m done, no need to type lots of words.
Ask a question, get an answer, Context provided for me
The challenge with the App approach is I know that I need to search for Consume Tiles if I want to use the data on a Last Mile report. A new user would not.
So lets try that scenario by asking:
I need to use Netflix data in the report I have to create for the boss
Again its using the concept of our Data Layers to understand that data in the Consume layer should be used in a report.
Given we have provided no RAG or Prompt reinforcement on our Data Layer Architecture I wonder if its because we use clear terms like “Consume” rather than “Gold” that is helping the model.
Its also come back with a follow up question, lets answer it and see what happens.
details about cast and directors
Looks like its checking the Data Dictionary for the Tiles to see what fields are available.
As an aside there is now finally a reason for us to populate a Description for each Field in the “Context Plane”.
And its come back with the Fields I would need to use for my report.
Its also asking if I want it to help me build that report.
show me the data
It recognises that it has no MCP service to access data or run a query.
One of the features we built in the AgileData App ages ago was the ability to click on a Catalog Tile and open the data directly in Looker Studio, as a very quick way to explore the data via a GUI.
Gemini CLI has understood that from the “Context Plane” and look like it found the relevant Looker Studio url to open the data I need in Looker Studio.
Lets cut and paste that url ….
Yup thats exactly what it has done that was unexpected but magical.
Wonder if I could get it to rewrite that url to only include the Fields I am after, that is a question for another day.
Show me the impact of a change
The second real life use case I got given was to see if it would help streamline the process of understanding the impact of the changing a Field somewhere in the data pipeline flow.
i need to update the field type for the director for the netflix tile what do I need to worry about impact wise
It did a pretty good job of understanding the flow of the data and transformation logic for that Field.
Because we store the Information Apps that are accessed by Information Consumers in the “Context Plane” and we link tose to the Consume Tiles they consume it also picked up the Last Mile objects that may break and impact our Information Consumers.
One question I have is how it determined the lineage for this data from the four API services we gave it access to, as we did not give it access to the Data Map (lineage) API service.
Im guessing it stitched it together from the Change Rules.
Another question to be answered. I am going to have to figure out how to get Gemini CLI to show me what MCP services it using to understand the process more. Task for another day.
So in Summary
Colour me impressed!
Wood from the Trees
Still a way to go before I have a coherent set of Patterns that I can Coach / Mentor / Teach somebody else for the “Context Plane”, and the “AI Data Stack” or present as a robust Architecture map.
But as I have already said, writing my half formed ideas helps me think.
An incoherent stream of thought
You can find all the previous articles with my train of thought combined on this article over at: