Use your own agent framework#
Any framework that can act as an MCP client can use GeoNeMo. You do not need the reference agent service or NeMo Platform. The framework connects to the GeoNeMo MCP server, lists its tools and calls them. The toolkit depends on no orchestration code (Agent orchestration).
This page covers what you decide when you wire an agent to the server. The connection steps for each harness are in Connect an MCP client.
Prerequisites#
An MCP-capable framework. It needs an MCP client that supports either streamable HTTP or stdio.
A GeoNeMo server, or the local stack (Run the local stack).
Choose a transport#
Streamable HTTP |
stdio bridge |
|
|---|---|---|
Endpoint |
|
The |
Credential |
MCP personal token or MCP OAuth |
API sign-in, or |
Tool limits |
Set by the server operator |
Your scope file |
Choose it when |
The agent runs on a different host from your credentials, or an operator controls the scope |
You want to limit the agent yourself, or the framework starts local tool processes |
Configure one connection. It serves both the tools and the skills.
Credentials#
Case |
What to provide |
|---|---|
Local stack |
Any bearer token, such as |
HTTP, with a token |
An MCP personal token, sent as a bearer token. Keep it in |
HTTP, with OAuth |
The login flow of your MCP client |
stdio |
|
MCP and API credentials have different audiences and cannot be swapped. Create tokens and
read the scopes in Sign in and tokens. The services:read scope is required for MCP.
Authentication does not create tenant isolation.
Limit the agent with a scope file#
The stdio bridge refuses any call outside its scope file. tools/list still shows every
installed tool, so tell the model which tools it may use. A call to a tool outside
allowed_tools fails with tool is outside the deployment scope, and a collection outside
allowed_collections with collection is outside the deployment scope.
{
"services_endpoint": "https://geonemo.example.com",
"project_id": "default",
"allowed_collections": ["preview-imagery"],
"allowed_tools": [
"catalog_list_collections",
"catalog_search",
"catalog_get_record"
],
"allowed_gkb_projects": [],
"capabilities": []
}
Start it with geonemo-mcp --scope-file /path/to/geonemo-scope.json. The keys are in the
table in Connect an MCP client. The file must be a regular file under 64 KiB, unknown keys are
rejected, and allowed_tools holds at most 32 names. Tool names are in
MCP tools.
Grant only what the task needs. Add gkb.write to capabilities only for an agent that
must publish knowledge.
Load the skills#
Skills tell the agent when and how to use the tools. Two ways to supply them:
Way |
How |
|---|---|
MCP resources |
Read |
Install |
Install from a checkout with the Skills CLI, for a harness that reads skills from the file system |
Both are described in Install and use skills. The skills in the catalog are listed in Skills. A skill carries no tools; the connection supplies them.
Call tools that start work#
Some tools start work instead of returning data. Handle them as follows.
Pass an
idempotency_key. Make it unique for the request. Use the same key on every retry, so a retry does not start a second run. The key is 1 to 256 characters.Treat the first response as a receipt, not a result.
Poll with the status tool until the status is terminal. Do not assume success.
Read the result with the result tool after success.
Treat a failed or cancelled run as an unknown outcome, not as an empty result.
Vessel detection is the example: sentinel_2_vessel_detection_start, then
vessel_detection_get_status, then vessel_detection_get_result. See
Detect vessels. Check discovery before you rely on an optional pack.
Example in Python#
The end-to-end version over HTTP is docs/examples/mcp_tour.py (Tutorial: an agent question, end to end).
The mcp package opens a stdio session to the bridge. This follows the client code in
reference/orchestration/nemo/ci/smoke_retrieval_tools.py.
import asyncio
import os
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
params = StdioServerParameters(
command="geonemo-mcp",
args=["--scope-file", "geonemo-scope.json"],
env=dict(os.environ),
)
async def main():
async with (
stdio_client(params) as (read, write),
ClientSession(read, write) as session,
):
await session.initialize()
tools = await session.list_tools()
print([tool.name for tool in tools.tools])
result = await session.call_tool(
"catalog_list_collections", {}
)
print(result.structured_content)
asyncio.run(main())
Check result.is_error before you use the result. Pass the tools from list_tools to your
framework in its own tool format; that step depends on the framework and is not shown here.
What the reference orchestration adds#
The reference agent service (Agent orchestration) provides parts that you build yourself when you use your own framework.
Part |
What it does |
What you provide instead |
|---|---|---|
Agent definitions and releases |
Versioned agents that are imported, checked and released |
Your own packaging |
Deployments and instances |
Hosted agents on NeMo Platform, each with its own scope and lifetime |
Your own hosting and per-agent scope files |
Conversations and runs |
Stored runs with events that you can follow or cancel |
Your own run records |
Durable tasks |
Work that continues across runs |
Your own queue and retry logic |
Event wakes |
An agent sleeps and wakes when catalog or knowledge content changes, through |
Your own poller on those feeds |
Model connections |
Connections from agents to inference gateways |
Your own model access |
Your agent reaches the toolkit the same way in either case: MCP tools and skill resources,
or REST /v1 with scoped credentials (Call the REST API, Use the Python client).
Result#
Your framework lists the server’s tools, calls the ones your scope allows, and polls long runs to a terminal state.