TcpSocketMCP

TcpSocketMCP

MCP server offering raw TCP socket access for AI models to interact with network services.

8
Stars
1
Forks
0
Releases

Overview

A Model Context Protocol (MCP) server that provides raw TCP socket access, enabling AI models to interact directly with network services using raw TCP Sockets. It supports multiple concurrent connections, buffering of incoming data and triggering automatic responses. This MCP server targets low-level network interactions not covered by HTTP MCP servers, such as debugging and interfacing with embedded devices and IoT systems, protocol reverse engineering, and legacy system integration without HTTP wrappers. It enables direct interaction with devices, network protocol debugging, and automated handshake handling via trigger patterns. The server offers pre-registered triggers for common handshakes (for example IRC PING/PONG) and supports regex capture groups for dynamic responses. It stores received data in a per-connection buffer, enabling reading data asynchronously and reading in different formats (utf-8, hex, base64). Tools accessible through MCP include core connection operations (tcp_connect, tcp_send, tcp_read_buffer, tcp_disconnect), advanced triggers (tcp_set_trigger, tcp_connect_and_send), and utility introspection commands (list connections, connection info, buffer status, clear buffer, remove triggers).

Details

Owner
SpaceyKasey
Language
Python
License
MIT License
Updated
2025-12-07

Features

tcp_connect

Opens a TCP connection to a host:port and returns a connection_id for subsequent operations; supports pre-registered connection_ids for triggers.

tcp_send

Sends data over an established connection with encoding options (utf-8, hex, base64); supports hex-encoded binary data and optional terminator bytes (e.g., 0D0A).

tcp_read_buffer

Reads data from the connection's receive buffer; data may not be immediately available; buffer stores all data until cleared; supports index/count and output formats (utf-8, hex, base64).

tcp_disconnect

Closes the connection and frees resources; all associated triggers are removed.

tcp_set_trigger

Sets automatic responses for pattern matches using regex; supports pre-registration and capture groups; triggers fire automatically on matches (handshake automation).

tcp_connect_and_send

Performs connect + send in one atomic operation; useful for time-sensitive protocols and immediate handshakes; returns a connection_id.

tcp_list_connections

Lists all active connections with statistics for monitoring and management.

tcp_connection_info

Provides detailed information about a specific connection.

Audience

AI modelsInteract with raw TCP services via MCP to exchange data and test protocols.
Network engineersDebug, prototype, and monitor raw TCP-based communications and device protocols.
IoT developersInterface with embedded devices over TCP sockets for control and data collection.
Security researchersPerform protocol analysis and security testing using triggers and raw sockets.

Tags

tcpsocketraw tcpMCPAInetworkIoTembeddedprotocol debuggingregex triggersbufferingconcurrencyhandshake automationIRCtelnetprotocol reverse engineering