8000 feat: Implement Parameterless `server.start()` with CLI-Based Auto-Configuration by fauziralpiandi · Pull Request #127 · punkpeye/fastmcp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: Implement Parameterless server.start() with CLI-Based Auto-Configuration #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 21, 2025

Conversation

fauziralpiandi
Copy link
Contributor

Implements parameterless server startup with auto-configuration that:

  • Automatically parses CLI arguments (--transport, --port, --endpoint)
  • Reads environment variables (FASTMCP_TRANSPORT, FASTMCP_PORT, FASTMCP_ENDPOINT)
  • Applies smart configuration precedence
  • Eliminates boilerplate while maintaining flexibility
server.start(); // Auto-detects from CLI/environment

Configuration Precedence:

  1. Explicit parameters (highest priority)
  2. CLI arguments (--transport http-stream --port 3000)
  3. Environment variables (FASTMCP_TRANSPORT=httpStream)
  4. Sensible defaults (stdio transport)

Explicit Override (unchanged):

server.start({
  transportType: "httpStream",
  httpStream: { port: 3000 },
}); // still works exactly as before

Also, implements temporary enhanced logging at the FastMCP level to provide clear, accurate information about the transport type being used.

This solution addresses the user-facing confusion at the FastMCP level while the underlying issue exists in @modelcontextprotocol/sdk.

Related to #110 and closes #101

…ation

- add `#parseRuntimeConfig()` method for CLI argument parsing
- support `--transport`, `--port`, `--endpoint` CLI args
- add environment variable support: `FASTMCP_TRANSPORT, FASTMCP_PORT`, `FASTMCP_ENDPOINT`
- implement configuration precedence: explicit > CLI > env > defaults
- enable zero-boilerplate server startup with `server.start()`
- maintain backward compatibility with explicit parameters
- add clearer logging for `httpStream` transport type (misleading)
Copy link
Contributor Author
@fauziralpiandi fauziralpiandi left a comment

Choose a reason for hiding this comment

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

ready for review! @punkpeye

@punkpeye punkpeye merged commit 16e12b8 into punkpeye:main Jun 21, 2025
1 check passed
@punkpeye
Copy link
Owner

Love it!

@fauziralpiandi fauziralpiandi deleted the feat/parameterless branch June 21, 2025 02:58
@mlc-mlapis
Copy link

@fauziralpiandi Great work. I appreciate it. 💯 The support for the environment variable is especially important for the cloud containerized world.

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.

MCP server writes a bit misleading formulation using "SSE stream" on the console with transportType: "httpStream"
3 participants
0