Skip to content

Conversation

@Nyholm
Copy link
Contributor

@Nyholm Nyholm commented Dec 24, 2025

Add a way to pragmatically stop the server

Motivation and Context

When the server is running with stdioTransport, there is no way to stop it. With this PR, it allows Symfony to do a "reload" feature. See symfony/ai#1280

I could have added this feature into the stdioTransport class directly, but that is less flexible.

How Has This Been Tested?

Local only

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

$this->processInput();
$this->processFiber();
$this->flushOutgoingMessages();
if (RunnerState::RUNNING !== $this->runnerControl->getState()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should even be part of the while expression

@chr-hertel
Copy link
Member

Is this only a STDIO concern? If so, maybe move it to Mcp\Server\Transport\Stdio\ namespace?

Comment on lines 22 to 23
case STOP_AND_DESTROY_SESSION;
case STOP;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struggling a bit with the naming and if RunnerState::STOP really expresses the purpose - it's restarting/reloading the connection without killing/destroying the session, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is breaking out of the while(true) loop without cleaning up sessions.

It does not restart or reload. (That is handled by other processes)

@Nyholm
Copy link
Contributor Author

Nyholm commented Dec 25, 2025

Thank you. I've updated the PR

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.

2 participants