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 MCP server directly (stdio mode)
uvx kgesh-sam-hello-1-py-pkg

# Or use the script alias
uvx --from kgesh-sam-hello-1-py-pkg say-hello

Using pip

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

# Run as MCP server
kgesh-sam-hello-1-py-pkg

# Or use script
say-hello

Available MCP Components

This server provides:

Tools:

  • say-hello: Greets a user with environment information

Resources:

  • env://info: Returns current environment variables and system information

Prompts:

  • greeting_prompt: Generates customizable greeting prompt templates

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 MCP server directly 
python -m quick_start_py

# Run via main module
python -m quick_start_py.main

# Or using installed scripts
kgesh-sam-hello-1-py-pkg
say-hello

Testing with MCP Inspector

FastMCP includes a built-in debugging tool. After installing locally:

# Install with dev dependencies
pip install -e ".[dev]"

# Use the MCP Inspector (if available)
# This provides a web UI to test your MCP server components
python -m quick_start_py.main --inspect

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.2.tar.gz (6.0 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.2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for kgesh_sam_hello_1_py_pkg-0.0.2.tar.gz
Algorithm Hash digest
SHA256 70e648433b554997e5135c441f6cf50a7bd91e6f031c2b9b63a22ec7af76b7b9
MD5 457032c87130e305c067e0b8d8fcfe4e
BLAKE2b-256 e8a0212774063474e5cd7f5cdac9c7581617f40f653bbbc0a7c2b71644e741d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kgesh_sam_hello_1_py_pkg-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1b27a29a724188f5ccd41d3bbb9b476bb076d984734827de9794e56144ecd899
MD5 2364c32aa28219409df2236ad383a38c
BLAKE2b-256 ae7cf4be9cd0af7f39ea52089975c0c579c12e26ce62b4e84a50a56581898914

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