mcp-socket
Click on "Deploy 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-socket Send HTTP GET to example.com and show the response headers"
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-socket
Stateful outbound TCP/UDP MCP server for LLMs.
Sockets stay open across tool calls until you close them or they hit the idle timeout. That makes multi-step protocols practical: HTTP/1.x, SMTP, Redis, DNS (UDP), custom text/binary protocols, and more.
See DESIGN.md for the full design.
Install
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"Related MCP server: WireMCP
Run
# stdio (default) — typical for MCP clients
mcp-socket
# or
python -m mcp_socket
# HTTP transport
mcp-socket --transport streamable-http --host 127.0.0.1 --port 8000CLI options
Option | Default | Description |
|
|
|
|
| HTTP bind address |
|
| HTTP bind port |
|
| Idle seconds before auto-close |
|
| Cleanup scan interval |
| off | Allow RFC1918/loopback/ULA/etc. |
|
| Max concurrent sockets |
|
| Max send payload |
|
| Max recv payload |
|
| Logging level |
Tools
Tool | Purpose |
| Hostname → A/AAAA |
| Connect TCP to IP:port |
| Create UDP socket |
| Send ( |
| Receive (base64 + optional text) |
| Check readability |
| Inspect open sockets |
| Close (optional TCP RST) |
tcp_connect / udp_send require IP literals. Call resolve_dns first for hostnames.
Private and local destinations are blocked by default (ADDRESS_BLOCKED). Use --allow-private-network for local testing.
Example (TCP HTTP/1.0)
resolve_dns(hostname="example.com")
→ { "ipv4": ["93.184.216.34"], ... }
tcp_connect(address="93.184.216.34", port=80)
→ { "socket_id": "...", "state": "connected" }
tcp_send(socket_id="...", encoding="utf8",
data="GET / HTTP/1.0\r\nHost: example.com\r\n\r\n")
tcp_recv(socket_id="...", max_bytes=65536, timeout_seconds=5)
→ { "bytes_received": N, "data_base64": "...", "text": "HTTP/1.0 200 ..." }
close_socket(socket_id="...")Security
Before every connect() / sendto():
Destination must be a valid IP literal
Private/local ranges are denied unless
--allow-private-networkMulticast / unspecified / reserved ranges are always denied
No TLS, no listening sockets, no proxy support — higher-level servers can layer those on top.
Develop
pip install -e ".[dev]"
pytestLicense
MIT
Available Tools
10 toolsclose_socketA
Close a socket and remove it from the registry. For TCP, reset=false performs a graceful FIN shutdown; reset=true attempts an abortive close (TCP RST). For UDP, reset is ignored.
Inputs: socket_id (required), reset. Returns: object
list_socketsA
List open sockets and their metadata (state, remote/local endpoints, idle time, byte/packet counters). Pass socket_id as a string, list of strings, or omit/null for all sockets.
Inputs: socket_id. Returns: result
resolve_dnsA
Resolve a hostname into IPv4 (A) and IPv6 (AAAA) addresses. Address ordering follows the OS resolver. Use this before tcp_connect/udp_send because those tools require IP literals, not hostnames.
Inputs: hostname (required). Returns: object
socket_pollA
Check whether a socket currently has readable data. If timeout_seconds > 0, wait until readable or timeout. Most clients can rely on timeout support in tcp_recv/udp_recv instead.
Inputs: socket_id (required), timeout_seconds. Returns: object
tcp_connectA
Create a TCP socket and connect to an IP:port. address must be an IPv4 or IPv6 literal (call resolve_dns first for hostnames). Returns socket_id for subsequent send/recv/close operations.
Inputs: port (required), address (required), timeout_seconds. Returns: object
tcp_recvA
Receive bytes from a TCP socket. timeout_seconds=0 (default) is non-blocking; >0 waits for at least one byte or timeout. Returns base64 (and text if valid UTF-8). bytes_received=0 with empty data indicates timeout or EOF (peer closed).
Inputs: socket_id (required), max_bytes, timeout_seconds. Returns: object
tcp_sendA
Send bytes over a connected TCP socket. encoding=utf8 encodes data as UTF-8; encoding=base64 base64-decodes data first.
Inputs: data (required), encoding (required), socket_id (required). Returns: object
udp_openA
Create an unbound outbound UDP socket. Use udp_send to send datagrams and udp_recv to receive them. Returns socket_id.
Inputs: no named parameters. Returns: object
udp_recvA
Receive one or more UDP datagrams (up to max_packets). timeout_seconds=0 (default) is non-blocking; >0 waits for at least one packet. Each packet includes source address/port, length, base64 data, and optional text.
Inputs: socket_id (required), max_packets, timeout_seconds. Returns: object
udp_sendC
Send a UDP datagram to address:port. address must be an IP literal. encoding=utf8 or base64 as with tcp_send.
Inputs: data (required), port (required), address (required), encoding (required), +1 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool targets a distinct operation (TCP connect/send/recv/close, UDP open/send/recv, DNS resolution, socket listing, polling). No overlap in functionality.
All tools use consistent lowercase snake_case with a verb_noun pattern (e.g., tcp_connect, resolve_dns, close_socket). Adheres to a predictable naming convention.
10 tools is appropriate for a socket utility server. It covers TCP and UDP client operations without being excessive or sparse.
Covers essential TCP/UDP client operations and DNS resolution. Missing server-side features (TCP listen, UDP bind) and advanced options, but the scope is clearly client-oriented.
Maintenance
Related MCP Connectors
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
LLM cost optimization gateway, repo token-waste auditor & model arbitrage MCP server.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server that provides LLMs access to other LLMs438 npm81MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that provides LLMs with real-time network traffic analysis capabilities, enabling tasks like threat hunting, network diagnostics, and anomaly detection through Wireshark's tshark.7605MIT
- AlicenseNot gradedqualityDmaintenanceA powerful MCP server for making HTTP requests, GraphQL queries, and TCP/Telnet connections from AI assistants.7MIT
- FlicenseAqualityAmaintenanceAn MCP server that bridges LLMs with dynamic real-world data by leveraging Chrome DevTools Protocol to intercept and reconstruct network traffic, enabling AI agents to extract high-quality structured data from complex web environments.389-