Add RuntimeProvider with 17 MCP tools for controlling running flowgraphs: - Container lifecycle: launch, list, stop, remove - Connection: connect by URL or container name - Variable control: list, get, set via XML-RPC introspection - Flowgraph execution: start, stop, lock, unlock - Visual feedback: screenshot capture, container logs Docker is optional - 10 tools work without it for external flowgraphs. Includes: - DockerMiddleware wrapping docker.DockerClient - XmlRpcMiddleware wrapping xmlrpc.client.ServerProxy - Dockerfile with Xvfb + ImageMagick + VNC for headless QT - 29 new unit tests (71 total)
29 lines
831 B
Python
29 lines
831 B
Python
from __future__ import annotations
|
|
|
|
from fastmcp import FastMCP
|
|
|
|
from gnuradio_mcp.middlewares.platform import PlatformMiddleware
|
|
from gnuradio_mcp.providers.mcp import McpPlatformProvider
|
|
from gnuradio_mcp.providers.mcp_runtime import McpRuntimeProvider
|
|
|
|
try:
|
|
from gnuradio import gr
|
|
from gnuradio.grc.core.platform import Platform
|
|
except ImportError:
|
|
raise Exception("Cannot find GNU Radio!") from None
|
|
|
|
platform = Platform(
|
|
version=gr.version(),
|
|
version_parts=(gr.major_version(), gr.api_version(), gr.minor_version()),
|
|
prefs=gr.prefs(),
|
|
)
|
|
platform.build_library()
|
|
|
|
app: FastMCP = FastMCP("GNU Radio MCP", instructions="Create GNU Radio flowgraphs")
|
|
|
|
McpPlatformProvider.from_platform_middleware(app, PlatformMiddleware(platform))
|
|
McpRuntimeProvider.create(app)
|
|
|
|
if __name__ == "__main__":
|
|
app.run()
|