As a platform engineer,
I would like to run the Telegram MCP server either via STDIO or via HTTP
based on an input parameter or environment variable,
so that the same service can be deployed flexibly in local development
and in networked/runtime environments.
Background
The current implementation starts the Telethon client and runs the MCP server exclusively using mcp.run_stdio_async(). This limits integration options to STDIO-only transports. Adding a configurable transport mode (STDIO or HTTP) will allow the MCP to be used by external services over HTTP without changing code for different deployments.
Acceptance Criteria
Notes / Implementation Considerations
- Transport selection should be implemented in
main()/_main() without duplicating tool registration code.
- Consider adding a small configuration helper to resolve effective values in this priority order: CLI → ENV → defaults.
- HTTP mode should expose the same MCP tool surface as STDIO mode.
Background
The current implementation starts the Telethon client and runs the MCP server exclusively using
mcp.run_stdio_async(). This limits integration options to STDIO-only transports. Adding a configurable transport mode (STDIO or HTTP) will allow the MCP to be used by external services over HTTP without changing code for different deployments.Acceptance Criteria
stdio(current behavior) andhttp.MCP_TRANSPORT), and--transport), where CLI overrides the environment variable when both are provided.stdiowhen neither CLI nor environment variable is set.stdiois selected:await mcp.run_stdio_async()exactly as it does today.httpis selected:MCP_HTTP_HOST,MCP_HTTP_PORT,--host,--port).0.0.0.0, port8000).await client.start()) occurs before starting either transport mode and is shared between both modes.Notes / Implementation Considerations
main()/_main()without duplicating tool registration code.