Skip to main content
Glama
wganalytics

mcp-ping-server-giulia-ai

by wganalytics
README.md
# PRJ-01 — Ping Server (MCP nível "super easy")

Servidor **MCP** (FastMCP, transporte `stdio`) — o exemplo introdutório do **Capítulo 2**
do livro *Model Context Protocol* (Sandeco), aqui com uma tool de utilidade real.

## 🏗️ Arquitetura do Servidor
![Diagrama MCP Ping Server](architecture.svg)

## Tools

| Tool | O que faz |
|---|---|
| `ping` | Health-check do próprio servidor — retorna `pong`. |
| `echo(mensagem)` | Devolve exatamente a mensagem (teste de transporte). |
| `check_host(host, port=443, timeout=3.0)` | **Health-check TCP real**: abre conexão e mede a latência (ms). |

## Uso

```bash
uv sync
uv run python src/ping_server.py     # ou: uv run python src/main.py
```

Registre no Claude Desktop apontando para `src/ping_server.py` (transporte `stdio`).
Exemplo de uso da tool real: `check_host("1.1.1.1", 443)` → `UP 1.1.1.1:443 — 12.3 ms`.

Sem segredos externos.

## Testes

```bash
uv run pytest        # 12 testes
```

`check_host` é exercitado contra um socket TCP local em porta efêmera — nada sai da máquina.

TDQS

A4/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: ping checks the MCP server itself, echo validates the transport layer, and check_host tests real TCP reachability to a host and port. There is no meaningful overlap or ambiguity.

Naming Consistency4/5

The names are all lowercase, short, and readable. ping and echo follow a command-line utility style while check_host uses a verb_noun pattern, so there is a slight stylistic deviation but no conflicting conventions.

Tool Count5/5

Three tools is a well-scoped set for a small ping and connectivity server. Each tool earns its place and the count is neither too thin nor bloated.

Completeness5/5

The set covers the apparent domain: MCP server health checking, transport testing, and real TCP connectivity checks with latency measurement. There are no obvious missing operations that would prevent an agent from accomplishing the intended tasks.

Maintenance

ActivityMaintained
ResponsivenessNo issues