Remote-MCP-Server-Testing

abhay-2108/Remote-MCP-Server-Testing

3.2

If you are the rightful owner of Remote-MCP-Server-Testing and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

This document provides a comprehensive overview of setting up and running a Model Context Protocol (MCP) server using FastMCP and uv.

Tools
1
Resources
0
Prompts
0

MCP Demo Project

This project demonstrates setting up and running an MCP (Model Context Protocol) server using FastMCP and uv.


Prerequisites

  • Python 3.11+
  • uv CLI tool
  • fastmcp Python package
  • GitHub account (for repository)
  • FastMCP Cloud account (free tier)

Setup Instructions

  1. Initialize the project using uv

    pip install uv
    uv init .
    
  2. Add FastMCP to the project

    uv add fastmcp
    
  3. Create your MCP server file (e.g., main.py)

    from fastmcp import FastMCP
    
    mcp = FastMCP("DemoServer")
    
    @mcp.tool
    def add(a: int, b: int) -> int:
        return a + b
    
    if __name__ == "__main__":
        mcp.run() 
        * To run MCP server locally. Default is to run locally
        mcp.run(transport="http",host="0.0.0.0",port=8000)
        * To run MCP server on FastMCP Cloud.
    
  4. Start the MCP server locally

    uv run fastmcp run main.py
    

    Start the Remote MCP server

    fastmcp run main.py --transport http --host 0.0.0.0 --port
    
                               or 
    
    uv run main.py
    
  5. Test server using MCP Inspector

    uv run fastmcp dev main.py
    
    • Allows you to test and inspect MCP tools locally (similar to Postman).

Deploy MCP Server on FastMCP Cloud as a Remote Server

  1. Create a GitHub repository for your project and push your code.

  2. Create a FastMCP Cloud account (free tier available at FastMCP Cloud).

  3. Install project dependencies on cloud

    uv add .
    uv add fastmcp
    
  4. Deploy your MCP server

    uv run fastmcp deploy main.py --cloud
    
  5. Test deployed server using MCP Inspector or via your cloud URL.


  1. To integrate MCP server with Claude Desktop powershell uv run fastmcp install claude-desktop main.py
  • Integrating MCP server with Claude Desktop is straightforward.

Using Proxy Server / Remote MCP Server Locally

You can connect to a remote MCP server using a proxy to access MCP tools locally. This is useful for testing cloud-deployed MCP servers or running your server from a remote environment.

Steps

  1. Ensure your remote MCP server is deployed and accessible (for example, on FastMCP Cloud).
  2. Use the as_proxy method to create a proxy client in your local environment.

Example: Using as_proxy Method

from fastmcp import FastMCP

# Connect to the remote MCP server using proxy
mcp = FastMCP.as_proxy("https://your-remote-mcp-server.fastmcp.ai")

# Call remote MCP tools as if they were local
result = mcp.add_expense(item="Lunch", amount=12.5, category="Food")
print(result)

summary = mcp.expense_summary()
print(summary)

This setup allows you to interact with the remote MCP server seamlessly, as

Project Structure

MCP Demo Project/
├─ main.py          # MCP server code
├─ uv.yaml          # Project config (generated by uv)
├─ README.md        # Project documentation
└─ .venv/           # Project virtual environment (managed by uv)

Notes

  • Use uv run fastmcp dev main.py for development and testing.
  • Use uv run fastmcp run main.py for running the production MCP server locally.
  • Deploy on FastMCP Cloud using uv run fastmcp deploy main.py --cloud.
  • All MCP tools are defined in main.py under @mcp.tool decorators.