Skip to main content
Glama

MinIO Model-Context Protocol (MCP) Server

by ucesys
client.py1.95 kB
from mcp import ClientSession, StdioServerParameters from mcp.client.stdio import stdio_client import asyncio import os import sys import tempfile async def main(): # Get the absolute path to the server script server_script = os.path.join(os.path.dirname(__file__), "minio_mcp_server/server.py") # Create server parameters for stdio connection using python interpreter server_params = StdioServerParameters( command=sys.executable, # Use Python interpreter args=[server_script], # Path to your server script env=None # Optional environment variables ) async with stdio_client(server_params) as (read, write): async with ClientSession(read, write) as session: # Initialize the connection await session.initialize() # Example: Create a temporary file and upload it with tempfile.NamedTemporaryFile(mode='w', suffix='.txt', delete=False) as temp_file: temp_file.write("Hello MinIO MCP!") temp_file_path = temp_file.name try: # Upload the file print("\nUploading test file...") result = await session.call_tool( "PutObject", { "bucket_name": "test-bucket", "object_name": "hello.txt", "file_path": temp_file_path } ) print(f"Upload result: {result}") # List available resources print("\nListing resources...") resources_result = await session.list_resources() for resource in resources_result.resources: print(f"Resource: {resource}") finally: # Clean up the temporary file os.unlink(temp_file_path) if __name__ == "__main__": asyncio.run(main())

Latest Blog Posts

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/ucesys/minio-python-mcp'

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