Skip to content

MCP server feature#379

Open
karlnewell wants to merge 11 commits into
workfloworchestrator:mainfrom
karlnewell:feat/mcp-server
Open

MCP server feature#379
karlnewell wants to merge 11 commits into
workfloworchestrator:mainfrom
karlnewell:feat/mcp-server

Conversation

@karlnewell
Copy link
Copy Markdown
Contributor

I created this to support the agent2agent proof of concept we're working on with SURF. I won't be upset if you don't want to merge this code.

I have a container built and deployed to our production instance and the MCP server is working as intended.

FYI, this was entirely vibe coded with Claude Code. I have reviewed the code but it touches areas (like DB session) that I'm not very familiar with. I don't know if the @click.option modifications are necessary.

The MCP server does not start by default; start is controlled by an env var. The MCP server runs in a separate thread - I don't know if this is a problem. Is the DB session code thread safe?

There is an optional port_mapping_file that can be included to map SuPA port_id to physical device and interface. This isn't needed if you have another MCP server that can dereference that data; e.g., WFO or NSO.

Signed-off-by: Peter Boers <peter.boers@surf.nl>
@hanstrompert
Copy link
Copy Markdown
Member

@pboers1988 also indicated that he wants to have MCP support.

The code looks good.

If you want to be able to set the options with command line options, then this is the way to do that. In the future we probably want to replace Click by something like Typer.

I see you that you use deb_session() everywhere, that is thread safe. All asynchronous NSI replies are handled by APscheduler jobs that run in a thread pool. So I do not foresee any problems there.

I see you use threading to start the MCP server in te background. This should work just fine alongside APscheduler. But for consistency, maybe it is better to start it like this using the scheduler:

from supa import scheduler

scheduler.add_job(
    func=mcp.run,
    trigger='date',            # Executes exactly once
    run_date=datetime.now(),   # Fires immediately
    kwargs={"transport": "streamable-http"},
    id="supa-mcp",             # Similar to 'name' in threading
    replace_existing=True      # Helpful if restarting the task
)

Please make sure you import scheduler locally, this is because of side effect (should probably be fixed when we can start using lazy imports).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants