Skip to content

Commit 41f3cfe

Browse files
enunoclaude
andcommitted
fix(docker): add mcp.run() call and update Docker instructions
Fixes Docker container exiting immediately by: - Adding mcp.run() call to main() function to start FastMCP server - Updating README Docker instructions to include -i flag for STDIO transport - Removing unused port mapping (STDIO doesn't use HTTP ports) The FastMCP server uses STDIO transport by default, which requires an interactive stdin to remain running. The -i flag keeps stdin open even in detached mode. Fixes: TypeError and container exit issues reported in #issues 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fec7965 commit 41f3cfe

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,17 @@ pip install -e ".[dev]"
9595
docker pull ghcr.io/enuno/unifi-mcp-server:latest
9696

9797
# Run the container (Cloud API)
98-
docker run -d \
98+
# Note: -i flag required for STDIO transport
99+
docker run -i -d \
99100
-e UNIFI_API_KEY=your-api-key \
100101
-e UNIFI_API_TYPE=cloud \
101-
-p 3000:3000 \
102102
ghcr.io/enuno/unifi-mcp-server:latest
103103

104104
# OR run with local gateway proxy
105-
docker run -d \
105+
docker run -i -d \
106106
-e UNIFI_API_KEY=your-api-key \
107107
-e UNIFI_API_TYPE=local \
108108
-e UNIFI_HOST=192.168.1.1 \
109-
-p 3000:3000 \
110109
ghcr.io/enuno/unifi-mcp-server:latest
111110
```
112111

src/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,9 @@ def main() -> None:
591591
logger.info(f"Base URL: {settings.base_url}")
592592
logger.info("Server ready to handle requests")
593593

594+
# Start the FastMCP server
595+
mcp.run()
596+
594597

595598
if __name__ == "__main__":
596599
main()

0 commit comments

Comments
 (0)