Documentation Index
Fetch the complete documentation index at: https://mintlify.com/dvlpjrs/guMCP/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The main server entry point provides a unified interface for launching guMCP servers. It parses command-line arguments and delegates to the remote server implementation.
Source: src/servers/main.py
Main Function
Source: src/servers/main.py:12
def main():
"""Parse arguments and launch the guMCP server"""
Command-Line Arguments
Host address for the server
Implementation
The main function:
- Parses command-line arguments
- Imports the remote server module
- Passes arguments to the remote server’s main function
Source Code:
def main():
parser = argparse.ArgumentParser(description="guMCP Server")
parser.add_argument("--host", default="0.0.0.0", help="Host for server")
parser.add_argument("--port", type=int, default=8000, help="Port for server")
args = parser.parse_args()
logger.info(f"Starting guMCP server on {args.host}:{args.port}")
# Import and run the remote server
from remote import main as remote_main
# Pass the CLI arguments to the remote server
sys.argv = [sys.argv[0]] # Clear existing args
if args.host:
sys.argv.extend(["--host", args.host])
if args.port:
sys.argv.extend(["--port", str(args.port)])
remote_main()
Usage
Basic Usage
python -m src.servers.main
Starts the server on 0.0.0.0:8000 (default)
Custom Host and Port
python -m src.servers.main --host 127.0.0.1 --port 3000
Help
python -m src.servers.main --help
Output:
usage: main.py [-h] [--host HOST] [--port PORT]
guMCP Server
optional arguments:
-h, --help show this help message and exit
--host HOST Host for server
--port PORT Port for server
Entry Point
Source: src/servers/main.py:33
if __name__ == "__main__":
main()
Logging
Source: src/servers/main.py:6-9
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
logger = logging.getLogger("gumcp-server")
Log message:
Starting guMCP server on {host}:{port}
Architecture
The main entry point serves as a simple launcher that:
- Provides a clean CLI interface
- Handles argument parsing
- Delegates to the remote server implementation
- Allows for future expansion (e.g., choosing between local/remote modes)
Package Entry Point
Can be used as a package entry point in setup.py or pyproject.toml:
setup.py
setup(
name="guMCP",
entry_points={
"console_scripts": [
"gumcp-server=src.servers.main:main",
],
},
)
pyproject.toml
[project.scripts]
gumcp-server = "src.servers.main:main"
After installation:
gumcp-server --host 0.0.0.0 --port 8000
Example Workflow
Development
# Start with default settings
python -m src.servers.main
# Check server is running
curl http://localhost:8000/health_check
Production
# Start on specific interface
python -m src.servers.main --host 0.0.0.0 --port 80
# Or using installed entry point
gumcp-server --host 0.0.0.0 --port 80
Docker
FROM python:3.11
WORKDIR /app
COPY . .
RUN pip install -e .
EXPOSE 8000
CMD ["gumcp-server", "--host", "0.0.0.0", "--port", "8000"]
See Also