-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmy_server.py
More file actions
27 lines (19 loc) · 790 Bytes
/
Copy pathmy_server.py
File metadata and controls
27 lines (19 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from fastmcp import FastMCP
# https://gofastmcp.com/servers/server
mcp = FastMCP(
name="My MCP Server"
)
@mcp.tool
def greet(name: str) -> str:
return f"Seja muito bem-vindo, {name}! Este é um programa de exemplo para uso de MCP que Cleverson fez em Python usando o FastMCP."
def ask_question(question: str) -> str:
# Exemplo simples: responde perguntas genéricas
# Aqui você pode integrar com IA, base de dados, etc.
if "nome" in question.lower():
return "Meu nome é My MCP Server."
elif "criador" in question.lower():
return "Fui criado por Cleverson usando FastMCP."
else:
return f"Recebi sua pergunta: '{question}'. Ainda não tenho uma resposta específica, mas posso conversar!"
if __name__ == "__main__":
mcp.run()