Skip to main content
Glama

Mistral Agent Manager

by Uzbyr
test_mcp.py1.45 kB
#!/usr/bin/env python3 """ Test MCP Server """ import asyncio import json from mcp.server import Server from mcp.server.stdio import stdio_server from mcp.types import Tool, TextContent # Create server instance server = Server("test-mcp-server") @server.list_tools() async def list_tools() -> list[Tool]: """List available tools""" return [ Tool( name="echo", description="Echo back the input text", inputSchema={ "type": "object", "properties": { "text": { "type": "string", "description": "Text to echo back" } }, "required": ["text"] } ) ] @server.call_tool() async def call_tool(name: str, arguments: dict) -> list[TextContent]: """Handle tool calls""" if name == "echo": text = arguments.get("text", "") return [TextContent(type="text", text=f"Echo: {text}")] else: raise ValueError(f"Unknown tool: {name}") async def main(): """Main function""" print("Starting MCP server...", file=sys.stderr) async with stdio_server() as (read_stream, write_stream): await server.run( read_stream, write_stream, server.create_initialization_options() ) if __name__ == "__main__": import sys asyncio.run(main())

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/Uzbyr/mcp-server'

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