feat: Align with MCP Python SDK best practices#11
Merged
Conversation
- FastMCP initialization with host/port from environment variables - Add stateless_http=True and json_response=True for production - Use MCP_HOST/MCP_PORT env vars instead of CLI args - Simplify docker-compose.yml to use environment variables - Update Dockerfile with default MCP_HOST=0.0.0.0, MCP_PORT=8000
There was a problem hiding this comment.
Pull request overview
This PR modernizes the MCP Trino server configuration to align with MCP Python SDK best practices, introducing environment variable-based configuration and settings-driven transport handling.
Key changes:
- Introduced environment variable configuration (
MCP_HOST,MCP_PORT) with sensible defaults - Replaced CLI argument passing to
mcp.run()withmcp.settingsupdates - Simplified Docker and docker-compose configurations by removing redundant CLI arguments
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/server.py | Added environment variable support for host/port, updated FastMCP initialization with stateless_http and json_response settings, refactored transport handling to use mcp.settings |
| docker-compose.yml | Simplified service commands by removing --host and --port arguments, added MCP_HOST and MCP_PORT environment variables |
| Dockerfile | Added default MCP_HOST and MCP_PORT environment variables, updated comment to reflect simplified command pattern |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR aligns the project with MCP Python SDK best practices based on analysis of the official SDK repository.
Changes
server.py
Dockerfile
docker-compose.yml
SDK Best Practices Applied