We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/adamydwang/NanoBananaPro'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
README.md•3.1 KiB
# MCP Server Test Scripts
This directory contains Python test scripts for testing the GenAI MCP Server.
## Prerequisites
1. Python 3.7 or higher
2. Install dependencies:
```bash
pip install -r requirements.txt
```
## Setup
1. Make sure the MCP server is running:
```bash
# In the project root directory
go run server.go
```
2. The server should be listening on `http://127.0.0.1:8080/mcp` by default.
## Test Scripts
### 1. test_list_tools.py
Lists all available tools from the MCP server.
**Usage:**
```bash
python test_list_tools.py [base_url]
```
**Example:**
```bash
python test_list_tools.py
python test_list_tools.py http://127.0.0.1:8080/mcp
```
**Output:**
- Lists all available tools
- Shows tool descriptions
- Displays tool parameters and their types
### 2. test_generate_image.py
Tests the image generation functionality using Gemini.
**Usage:**
```bash
python test_generate_image.py <prompt> [base_url]
```
**Example:**
```bash
python test_generate_image.py "A beautiful sunset over mountains"
python test_generate_image.py "A cute cat playing with a ball" http://127.0.0.1:8080/mcp
```
**Output:**
- Generates an image based on the prompt
- Returns the image URL or data URI
- Displays the result
### 3. test_edit_image.py
Tests the image editing functionality using Gemini.
**Usage:**
```bash
python test_edit_image.py <prompt> <image_url> [base_url]
```
**Example:**
```bash
python test_edit_image.py "Make it blue" "https://example.com/image.jpg"
python test_edit_image.py "Add a rainbow" "data:image/png;base64,..." http://127.0.0.1:8080/mcp
```
**Output:**
- Edits the image based on the prompt
- Returns the edited image URL or data URI
- Displays the result
## Running All Tests
### Option 1: Run All Tests Automatically
Use the `run_all_tests.py` script to run all tests in sequence:
```bash
python run_all_tests.py [base_url]
```
**Example:**
```bash
python run_all_tests.py
python run_all_tests.py http://127.0.0.1:8080/mcp
```
### Option 2: Run Tests Individually
You can also run each test script separately:
```bash
# 1. List tools
python test_list_tools.py
# 2. Generate an image
python test_generate_image.py "A beautiful landscape"
# 3. Edit an image (using the generated image URL from step 2)
python test_edit_image.py "Make it more colorful" "<image_url_from_step_2>"
```
## Troubleshooting
1. **Connection Error**: Make sure the MCP server is running and accessible at the specified URL.
2. **Timeout Error**: Image generation/editing may take some time. The default timeout is 60 seconds. You can modify it in `mcp_client.py` if needed.
3. **Authentication Error**: Make sure the server has valid API keys configured in the `.env` file.
4. **Tool Not Found**: Ensure the server has registered the tools correctly. Check the server logs for any errors.
## Notes
- All test scripts are independent and can be run separately
- The scripts use JSON-RPC 2.0 protocol to communicate with the MCP server
- Results may include data URIs (base64 encoded images) or URLs depending on server configuration
- If OSS upload is enabled, the server will upload images to OSS and return signed URLs