Skip to main content
Glama

Resemble AI Voice Generation MCP Server

by obaid
claude_client_test.py3.24 kB
""" Test script to simulate Claude Desktop calling our HTTP server. This script connects to the running HTTP server and calls the tools directly, simulating how Claude Desktop would interact with it. """ import json import requests import base64 import os from pathlib import Path # Create output directory if needed output_dir = "./output" Path(output_dir).mkdir(parents=True, exist_ok=True) # HTTP server URL SERVER_URL = "http://localhost:8000/tools" # Default HTTP server port def call_tool(tool_name, params=None): """Call a tool via the HTTP server.""" if params is None: params = {} payload = { "tool": tool_name, "params": params } print(f"\n=== Calling {tool_name} ===") print(f"Params: {json.dumps(params, indent=2)}") try: response = requests.post( SERVER_URL, json=payload, headers={"Content-Type": "application/json"} ) response.raise_for_status() result = response.json() print(f"Response status: {response.status_code}") print(f"Response: {json.dumps(result, indent=2, default=str)[:1000]}...") return result except Exception as e: print(f"Error calling {tool_name}: {str(e)}") return None def test_list_voices(): """Test the list_voices tool.""" result = call_tool("list_voices") if result and "voices" in result: print(f"\nFound {len(result['voices'])} voices") # Return the first voice ID for testing if result["voices"]: return result["voices"][0]["id"] return None def test_generate_tts(voice_id): """Test the generate_tts tool.""" # Test file output params_file = { "text": "Hello, this is a test of the Claude Desktop integration with Resemble AI.", "voice_id": voice_id, "return_type": "file", "output_filename": "claude_test" } file_result = call_tool("generate_tts", params_file) # Test base64 output params_base64 = { "text": "Hello, this is a test with base64 encoding.", "voice_id": voice_id, "return_type": "base64" } base64_result = call_tool("generate_tts", params_base64) # If we got base64 data, save it to a file for verification if base64_result and base64_result.get("success") and base64_result.get("audio_data"): try: audio_data = base64.b64decode(base64_result["audio_data"]) output_path = os.path.join(output_dir, "claude_test_base64.mp3") with open(output_path, "wb") as f: f.write(audio_data) print(f"\nSaved base64 audio to: {output_path}") except Exception as e: print(f"Error saving base64 audio: {str(e)}") if __name__ == "__main__": print("=== Claude Desktop HTTP Integration Test ===") # Test list_voices voice_id = test_list_voices() # Test generate_tts if we got a voice ID if voice_id: print(f"\nUsing voice ID: {voice_id}") test_generate_tts(voice_id) else: print("Skipping generate_tts test due to list_voices failure") print("\n=== Test Complete ===")

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/obaid/resemble-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server