Skip to content

gitrey/fastmcp-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastMCP Demo Application

This is a simple demonstration application using the FastMCP framework.

Sample ADK agent to call this MCP server is avilable in this repo: https://github.com/gitrey/adk-fastmcp

Prerequisites

Before deploying, ensure you have the following:

  1. Google Cloud SDK (gcloud): Installed and authenticated.
  2. Enabled APIs: Cloud Run API and Cloud Build API must be enabled for your project.
    gcloud services enable run.googleapis.com cloudbuild.googleapis.com
  3. Billing Enabled: Your Google Cloud project must have billing enabled.

Project Structure

Ensure your project has the following files in the root directory:

  • server.py: Your main application code using FastMCP.
  • requirements.txt: Lists the Python dependencies.
    fastmcp
    asyncio
  • Procfile: Tells Cloud Run how to start your web server.
    web: python server.py
    (Note: This assumes your FastMCP instance is named mcp within your server.py file. Adjust server:mcp if your filename or instance name is different.)

Deployment to Cloud Run (from Source)

  1. Navigate to the project directory: Open your terminal and change to the directory containing server.py, requirements.txt, and Procfile.

    cd ~/fastmcp-demo
  2. Run the deployment command:

    gcloud run deploy fastmcp-demo \
        --source . \
        --region YOUR_REGION
    • Replace fastmcp-demo with your desired service name.
    • Replace YOUR_REGION with the Google Cloud region you want to deploy to (e.g., us-central1, europe-west1).
    • The --allow-unauthenticated flag makes the service publicly accessible. Remove this flag if you want to manage access using IAM.
  3. Test Your Service: Once the deployment is complete, gcloud will output the URL of your deployed service.

    Install cmcp

    pip install cmcp

    List available tools:

    cmcp https://fastmcp-demo-658000000000.us-central1.run.app tools/list 

    Output:

    {   
        "meta": null,
        "nextCursor": null,
        "tools": [
        {
            "name": "add",
            "description": "Add two numbers",
            "inputSchema": {
                "properties": {
                "a": {
                    "title": "A",
                    "type": "integer"
                },
                "b": {
                    "title": "B",
                    "type": "integer"
                }
                },
                "required": [
                    "a",
                    "b"
                ],
                    "title": "addArguments",
                    "type": "object"
                }
        }
    ]}

    Call the tool:

    cmcp https://fastmcp-demo-658000000000.us-central1.run.app tools/call -d '{"name": "add", "arguments": {"a": 1, "b": 2}}'

    Output:

    {
        "meta": null,
        "content": [
            {
                "type": "text",
                "text": "3",
                "annotations": null
            }
        ],
        "isError": false
    }

About

FASTMCP Demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published