Skip to main content

Say hello to user - Python MCP stdio server

Project description

Deploxy Python Quick Start

Deploxy is a REAL proxy for deploying Stdio MCP server to serverless platform.

This is the Python version of the Deploxy quick start example, built with fastMCP for simplified MCP server development.

What this guide covers

  • Deploying your Python Stdio MCP Server to PyPI package with Deploxy.
  • Transforming it into a secure, private MCP server.
  • Keeping your source code safe while providing users with a lightweight proxy package to install.

Installation and Usage

Using uvx (recommended)

# Run directly without installation
uvx kgesh-kgesh-sam-hello-1-py

# Or install and run
uvx --from kgesh-kgesh-sam-hello-1-py say-hello

Using pip

pip install kgesh-kgesh-sam-hello-1-py
say-hello

Development

Prerequisites

  • Python 3.8 or higher
  • pip or uv
  • fastMCP library

Setup

# Clone and enter the directory
cd quick-start-py

# Install dependencies
pip install -e .

# Or with uv
uv pip install -e .

Running locally

# Run the server directly
python -m quick_start_py.main

# Or using the installed script
say-hello

Deployment Steps

Step 1: Prepare Your Project

First, ensure your project is ready to be published as a standard PyPI package.

  1. Configure pyproject.toml: Make sure your pyproject.toml has the required name, version, and project.scripts properties set correctly.
  2. Build Your Project: Install dependencies and test your build.
    pip install build
    python -m build
    

Step 2: Check your PyPI package

To understand the problem Deploxy solves, let's first publish the package the traditional way.

# Build and publish to PyPI
python -m build
twine upload dist/*

Now, go to your package's page on PyPI (https://pypi.org/project/YOUR_PACKAGE_NAME/) and you will see that all your source code is publicly visible.

Important: This step is for this quick start demonstration only. In a real production, you will skip this step entirely.

Step 3: Create and Configure .deploxy.json

  1. Create the file

    You have two options to create the .deploxy.json file.

    Option 1: Use the CLI

    Run the following command in your project root:

    npx @deploxy/cli init
    

    Option 2: Use the Dashboard

    Go to the Deploy new project to create a new project, then copy the generated JSON configuration into a .deploxy.json file in your project root.

  2. Add your Auth Token: Open the file and add your authToken. If you don't have one, you can get it from the Tokens page.

    {
      "authToken": "your-auth-token-here",
      "defaultDeployRegion": "us-east-1",
      "stdioArgsIndex": "--args",
      "mcpPath": "/mcp",
      "packageType": "py",
      "injectedEnv": {}
    }
    

Step 4: Deploy with Deploxy

Now, instead of twine upload, run the deploy command.

Note: If you completed Step 2 and published a version to PyPI, you must increment the version in your pyproject.toml before running deploy. Both PyPI and Deploxy require a new version for each deployment.

npx @deploxy/cli deploy

You can monitor the deployment status on the Deploxy Dashboard.

Once deployment is complete, check your package page on PyPI again. You will see that the code has been replaced with the Deploxy proxy client.

That's it! Your Python package is now deployed with Deploxy, keeping your source code private while providing a secure proxy for your users.


How It Works: The Deploxy Magic

When you deploy with Deploxy, you're not just publishing a package; you're creating a secure, private backend for your MCP server.

The code that end-users download and run via uvx is a lightweight proxy client. This proxy client takes user requests (like a ToolCall) and streams them to your actual MCP server, which is running securely in the serverless cloud.

Understanding the .deploxy.json properties

  • authToken: This is the token required to authenticate and deploy your package to Deploxy.

  • defaultDeployRegion: This is the default AWS region where your MCP server will run if the end-user does not specify a particular region. To give your end-users the fastest experience, they can specify a region using the --region flag when they run your package (uvx your-pkg --region us-east-1). If the flag is omitted, this default region is used.

    With the Deploxy Pro plan, the --region parameter is not needed. Requests are automatically routed to the nearest region for the end-user.

  • stdioArgsIndex: This option specifies the arguments that are passed directly to your MCP server. For example, when an end-user runs uvx your-pkg --args user-api-key, your server can access user-api-key from sys.argv.

  • injectedEnv: This is an object of environment variables that are accessible only within your MCP server (e.g., os.getenv("DATABASE_URL")). These are completely hidden from the end-user because they only interact with the proxy client, not your secure server code.

  • mcpPath and packageType: You generally don't need to change these. For Python projects, packageType should be "py".

Security Warning: The .deploxy.json file contains your sensitive authToken. Never commit this file to a public repository. Ensure it is listed in your .gitignore file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kgesh_sam_hello_1_py_pkg-0.0.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kgesh_sam_hello_1_py_pkg-0.0.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file kgesh_sam_hello_1_py_pkg-0.0.1.tar.gz.

File metadata

File hashes

Hashes for kgesh_sam_hello_1_py_pkg-0.0.1.tar.gz
Algorithm Hash digest
SHA256 23ad6e14d75ef398641a9eec1240ef714a3c039f19ce7ccc931e02c13fb05d34
MD5 bd9b5e672e87486c9e4ec07b7885d416
BLAKE2b-256 4feb68de855f358f10540d9206932d32fd1352f72b750d24e43ce59ace7e7d9b

See more details on using hashes here.

File details

Details for the file kgesh_sam_hello_1_py_pkg-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for kgesh_sam_hello_1_py_pkg-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7d2e98018e4d8c52c0b2c443d6ceb2995ec45d2001428d3ebea3c3034827320d
MD5 9e04eedfafc9cc9870f618e4b7ddc6c7
BLAKE2b-256 2b6ee961ca28c5e50a97343145137c7326a16ede052dc6f5857d4b3a1c53cd88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page