Skip to main content
Glama

MCP Server Template

by KJ14GOD
server.py1.12 kB
#!/usr/bin/env python3 import os from fastmcp import FastMCP from dotenv import load_dotenv from smartthings import get_client_from_env load_dotenv() mcp = FastMCP("TV Control MCP Server") @mcp.tool(description="Turn on the TV via SmartThings") def tv_turn_on() -> dict: client = get_client_from_env() return client.turn_on() @mcp.tool(description="Turn off the TV via SmartThings") def tv_turn_off() -> dict: client = get_client_from_env() return client.turn_off() @mcp.tool(description="Set the TV volume (0-100) via SmartThings") def tv_set_volume(level: int) -> dict: client = get_client_from_env() return client.set_volume(level) @mcp.tool(description="Set the TV input source (e.g., hdmi1) via SmartThings") def tv_set_input(source: str) -> dict: client = get_client_from_env() return client.set_input(source) if __name__ == "__main__": port = int(os.environ.get("PORT", 8000)) host = "0.0.0.0" print(f"Starting FastMCP server on {host}:{port}") mcp.run( transport="http", host=host, port=port, stateless_http=True )

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/KJ14GOD/tvMCP'

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