MCP Integration
ai_nn_controller automatically generates MCP (Model Context Protocol) tools for AI agent integration, enabling AI agents such as Claude to discover and control network equipment without any extra configuration.
Overview
MCP tools are auto-generated from:
Application
control_functions→ Control toolsApplication
read_measurements→ Measurement toolsApplication state management → State tools
@agent_controlleddecorated methods → Agent-controlled tools
MCP Endpoints
Server Info
List All Tools
List Tools by App
Call Tool
MCP JSON-RPC
Server-Sent Events
Auto-Generated Tools
For each @aic_app, the following tools are generated:
Control Tools
One tool per command in control_functions:
Name:
{AppName}_{command_name}Example:
NetworkApp1_set_gainSchema: From command registry schema
Measurement Tool
If app has read_measurements:
Name:
{AppName}_get_measurementsSchema: Optional
node_idfilter
State Tools
For every app:
{AppName}_get_state- Get current state{AppName}_set_state- Set state (running/paused/stopped)
Agent-Controlled Tools
If the app has @agent_controlled decorated methods, one tool per operation:
Name:
{AppName}_{operation_name}Example:
SmartApp_optimize_gainSchema: From the
schemaparameter of the@agent_controlleddecorator
These tools execute inside the process loop with access to live measurements.
The app must be in running state for these tools to work.
Request:
{
"name": "SmartApp_optimize_gain",
"arguments": {
"node_id": 8,
"strategy": "max_snr"
}
}
Response:
{
"success": true,
"result": {
"result": {
"status": "applied",
"previous_gain": 15.0,
"new_gain": 17.0
},
"request_id": "abc-123-def"
}
}
Error (app not running):
{
"success": true,
"result": {
"error": "App 'SmartApp' is not running (state: stopped). Start the app first."
}
}
Error (timeout):
{
"success": true,
"result": {
"error": "Timeout waiting for operation 'optimize_gain' (request_id=abc-123, timeout=11s)."
}
}
Tool Registry API
Tool Schema Lookup
- class ai_nn_controller.mcp.tool_registry.MCPTool
Represents a single MCP tool.
- Parameters:
name – Tool name
description – Human-readable description
input_schema – JSON Schema for input validation
handler – Async function to execute the tool
app_name – Associated application name
tool_type – “control”, “measurement”, “state”, or “agent_controlled”
- to_mcp_format()
Convert to MCP protocol format.
Claude Desktop Integration
To integrate with Claude Desktop, add to your MCP configuration file:
{
"mcpServers": {
"ai_nn_controller": {
"command": "curl",
"args": ["-X", "POST", "http://localhost:8000/mcp/message"]
}
}
}
Or use the HTTP transport directly in Claude’s settings.
Example Usage with AI Agents
An AI agent can:
Discover tools: Query
/mcp/toolsto see available capabilitiesRead state: Call
{App}_get_stateto check if app is runningStart app: Call
{App}_set_statewith{"state": "running"}Read measurements: Call
{App}_get_measurementsSend commands: Call
{App}_set_gainor other control toolsRun in-loop operations: Call
{App}_optimize_gainor other agent-controlled tools
Example conversation:
User: "Check the gain on node 3"
Agent: [Calls NetworkApp1_get_measurements with node_id=3]
Agent: "The current gain on node 3 is 20.5 dB"
User: "Set it to 15 dB"
Agent: [Calls NetworkApp1_set_gain with node_id=3, target_gain=15]
Agent: "Done. I've set the target gain to 15 dB"