Skip to main content
Glama

netcheck MCP Server - The Hard Way

Build an MCP server that answers "is my site healthy and configured right?" from raw bytes up: TLS certificates, DNS packets, HTTP redirects, security headers, with an SSRF guard in front of every connection. No dnspython, no requests, no certificate library in the server code.

At the end you will have built a small version of netcheck-mcp yourself, and you will understand the things most "network tool" MCP tutorials skip: what the bytes actually say, why an agent-facing tool must refuse to talk to your own network, and how to test code that talks to the internet without the internet.

Why this exists

A weather-API tutorial teaches the SDK and nothing else. A network checker has real depth:

  • a certificate that "fails" can fail six different ways, and each needs a different fix

  • DNS is a binary protocol with compression pointers, truncation and two flavours of "not found"

  • redirects hide latency, loops and downgrades unless you follow them yourself

  • a tool that fetches URLs for an AI is an SSRF cannon unless you aim it carefully

Related MCP server: web-security-guard

Modules

#

Module

You build

Key idea

1

TLS handshake and certs

a DER certificate reader and a failure classifier

Python only decodes certs it verified; read the bytes yourself, ask OpenSSL why it failed

2

DNS wire format

a resolver: query bytes, compression, UDP+TCP

NXDOMAIN and NODATA are different answers

3

Redirects and timings

a hop-by-hop HTTP tracer

connect vs TTFB vs total; loops and caps

4

Security headers

a grader that names the exact fix

a finding without a fix is a complaint

5

SSRF defense

a guard: vet addresses, pin the IP, re-check every hop

decide by address, never by name

6

The MCP wrapper

a stdio server over modules 1, 2 and 5

ToolError is the only error text the agent sees

7

Hermetic testing

test fixtures: minted certs, a DNS server, synthetic SPF

the network is the last thing to test against

How to use it

python -m venv .venv && source .venv/bin/activate      # Windows: .venv\Scripts\activate
pip install -r requirements.txt
python verify.py          # runs every module against local servers; nothing leaves your machine
python 02-dns-wire-format/main.py

Each module has a README (the why), a main.py (runnable code that checks itself with assert), and a "break it" exercise at the end of the README. labs.py at the top is the shared lab: a throwaway certificate authority, a TLS/HTTP server and a DNS server, all on 127.0.0.1. Module 7 explains how it works; the earlier modules just use it.

Requirements: Python 3.10+. The server code in modules 1-6 uses only the standard library plus mcp; cryptography is used only by labs.py to mint test certificates.

Responsible use

The finished tool opens network connections on an AI's behalf. Point it only at hosts you own or are authorised to test, and keep the SSRF guard from module 5 switched on.

License

MIT

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Enables live website health checks including TLS, HTTPS, and security headers, returning an A-F grade with specific fixes.
    2
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to audit URLs for security headers, generate CSP Level 3 policies, compute SRI hashes, evaluate WCAG 2.2 contrast, and remediate headers.
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Enables Claude to run safe, read-only diagnostics against servers and websites — certificate chains and expiry, HTTP status/redirects/security headers, DNS records, email authentication (SPF, DKIM, DMARC, MTA-STS, TLS-RPT) and sitemaps. Every check returns severity-tagged findings with concrete fixes, plus a 0-100 score and A-F grade, without any ability to modify the target.
    8
    31 npm
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Enables AI agents and developers to audit any URL or domain for seven critical OWASP HTTP security headers, returning an A+ to F grade plus actionable Nginx, Apache, Caddy, and Cloudflare remediation snippets. It also probes /.well-known/security.txt and /security.txt to surface responsible vulnerability disclosure contacts, bug bounty scopes, and PGP keys.
    2
    MIT