MCP Simple Example
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Simple ExampleCan you ping google.com?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Simple Example
A Model Context Protocol (MCP) server that provides network diagnostic tools (ping, traceroute) as AI-accessible tools. Works with any MCP-compatible client
Overview
This project creates an MCP server that exposes network diagnostic commands as tools that can be called by any MCP-compatible AI assistant. The AI assistant (powered by Ollama with llama3.1:8b) can use these tools to diagnose network issues, check host connectivity, trace network paths
What is MCP?
The Model Context Protocol (MCP) is an open standard developed by Anthropic for connecting AI assistants to external tools and data sources. Instead of hardcoding tool implementations in every AI client, MCP allows:
Standardized Tool Interface: Tools are defined once and work with any MCP client
Secure Execution: Tools run in isolation, reducing security risks
Easy Integration: MCP clients can discover and use tools dynamically
Language Agnostic: Servers can be written in any language (Python, TypeScript, Go, etc.)
Components
mcp_server.py: The main MCP server implementation
Implements the MCP protocol over stdio
Defines two tools:
network-ping,network-tracerouteHandles tool execution and response formatting
mcp_client.py: Interactive CLI test client
Allows manual testing of all tools
Useful for debugging without an AI assistant
Tool Definitions
Tool | Purpose | Key Parameters |
| Test host reachability and latency |
|
| Trace network path to host |
|
Related MCP server: netops-mcp
Prerequisites
System Requirements
Python: 3.10 or higher
uv: Package manager (install from https://github.com/astral-sh/uv)
Required System Tools
The server uses the following system commands (must be installed on your system):
Command | Purpose | Install (Debian/Ubuntu) | Install (macOS) |
| ICMP echo requests |
| Built-in |
| Network path tracing |
| Built-in |
Ollama Setup (for AI Integration)
To use with an AI assistant:
Install Ollama: https://ollama.ai
Pull the model:
ollama pull llama3.1:8bStart Ollama:
ollama serve
Installation
Step 1: Clone or Navigate to the Project
cd /path/to/simple_mcp_exampleStep 2: Install Dependencies with uv
# Install all dependencies using uv
uv sync
# Or install the MCP package directly
uv add mcp python-dotenvStep 3: Verify Installation
# Check that uv created the virtual environment
ls -la .venv
# Verify Python can see the packages
uv run python -c "import mcp; print('MCP installed')"Step 4: Install System Tools (if needed)
# Debian/Ubuntu
sudo apt update
sudo apt install iputils-ping traceroute
Usage
Direct Server Execution
Start the server directly (outputs to stderr):
uv run python mcp_server.pyInteractive Test Client
The easiest way to test the server:
# Run the interactive test client
uv run python mcp_client.pyYou can then type commands like:
> ping google.com
> traceroute cloudflare.com
> quitConfiguration
Environment Variables
The server doesn't require environment variables, but you can add them to pyproject.toml if needed:
[tool.mcp-server.env]
# DEBUG=trueCustomizing Tool Behavior
Edit mcp_server.py to customize:
Add New Tools
Add new Tool definitions and handlers in mcp_server.py.
API Reference
Tool: network-ping
Test connectivity and measure latency to a host.
Parameters:
Name | Type | Required | Default | Description |
| string | Yes | - | Hostname or IP address |
| integer | No | 4 | Number of packets |
Example Request:
{
"method": "tools/call",
"params": {
"name": "network-ping",
"arguments": {
"host": "google.com",
"count": 4
}
}
}Example Response:
# Ping Results for google.com
## Command Output
PING google.com (142.250.80.46): 56 data bytes
64 bytes from 142.250.80.46: icmp_seq=0 ttl=117 time=10.123 ms
64 bytes from 142.250.80.46: icmp_seq=1 ttl=117 time=10.456 ms
...
## Summary
✓ 0% packet loss - Host is fully reachable
Latency (RTT): min=10.1ms, avg=10.3ms, max=10.5msTool: network-traceroute
Trace the network path to a destination host.
Parameters:
Name | Type | Required | Default | Description |
| string | Yes | - | Hostname or IP address |
| integer | No | 30 | Maximum hops to trace |
| integer | No | 5 | Seconds to wait per hop |
Example Request:
{
"method": "tools/call",
"params": {
"name": "network-traceroute",
"arguments": {
"host": "cloudflare.com",
"max_hops": 15
}
}
}Troubleshooting
"ping command not found"
Solution: Install ping utilities
# Debian/Ubuntu
sudo apt install iputils-ping
# macOS
# ping is built-in"Server timed out" or "Connection failed"
Possible causes:
Server is taking too long to start
Network issues between client and server
Host is unreachable
Solutions:
# Check server starts correctly
uv run python mcp_server.py
License
MIT License - Feel free to use, modify, and distribute.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceNetwork diagnostics — ping, traceroute, DNS lookup, port scanning, and connectivity testing via MCP.14MIT
- AlicenseNot gradedqualityBmaintenanceProvides network operations tools such as ping, traceroute, DNS queries, and nmap scans via MCP, enabling network diagnostics and monitoring through natural language.13MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to perform real network diagnostics on the local machine, including ping, traceroute, DNS lookups, TLS checks, and more.MIT
- AlicenseAqualityDmaintenanceAn MCP server that exposes live network monitoring data as Resources and diagnostic capabilities as Tools, letting AI assistants query network health conversationally.6MIT
Related MCP Connectors
Live browser debugging for AI assistants — DOM, console, network via MCP.
Give AI agents real phone numbers, messages, and voice calls via MCP.
MCP server for AI access to SmartBear tools, including BugSnag, Reflect, Swagger, PactFlow, QTM4J.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/rmschn/simple_mcp_example'
If you have feedback or need assistance with the MCP directory API, please join our Discord server