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
Before deploying, ensure you have the following:
- Google Cloud SDK (
gcloud): Installed and authenticated.- Install: https://cloud.google.com/sdk/docs/install
- Login:
gcloud auth login - Set Project:
gcloud config set project YOUR_PROJECT_ID(ReplaceYOUR_PROJECT_IDwith your actual Google Cloud project ID)
- Enabled APIs: Cloud Run API and Cloud Build API must be enabled for your project.
gcloud services enable run.googleapis.com cloudbuild.googleapis.com - Billing Enabled: Your Google Cloud project must have billing enabled.
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.(Note: This assumes your FastMCP instance is namedweb: python server.pymcpwithin yourserver.pyfile. Adjustserver:mcpif your filename or instance name is different.)
-
Navigate to the project directory: Open your terminal and change to the directory containing
server.py,requirements.txt, andProcfile.cd ~/fastmcp-demo
-
Run the deployment command:
gcloud run deploy fastmcp-demo \ --source . \ --region YOUR_REGION- Replace
fastmcp-demowith your desired service name. - Replace
YOUR_REGIONwith the Google Cloud region you want to deploy to (e.g.,us-central1,europe-west1). - The
--allow-unauthenticatedflag makes the service publicly accessible. Remove this flag if you want to manage access using IAM.
- Replace
-
Test Your Service: Once the deployment is complete,
gcloudwill 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 }