MCP Connector

Connect AI to Raw TCP Sockets

TcpSocketMCP gives AI models direct raw TCP socket access with 11 tools for connections, buffering, and pattern-based auto-replies.


90
Spark score
out of 100
Updated 5 months ago
Version 1.0.0
Models
universal

Add to Favorites

Why it matters

Enable AI models to directly interact with network services by providing raw TCP connection access. This allows for integration with embedded devices, legacy systems, and custom protocols without HTTP wrappers.

Outcomes

What it gets done

01

Establish and manage multiple simultaneous TCP connections.

02

Send and receive data with flexible encoding options (UTF-8, hex, base64).

03

Implement automatic responses to network events using regex triggers.

04

Debug and analyze network protocols through direct traffic inspection.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-tcpsocketmcp | bash

Capabilities

Tools your agent gets

tcp_connect

Opens a TCP connection to any host:port, returns connection_id for subsequent operations

tcp_send

Sends data through an established connection with encoding options (utf-8, hex, base64)

tcp_read_buffer

Reads received data from the connection buffer with support for partial reads and formatting

tcp_disconnect

Closes the connection and frees resources, automatically removes all triggers

tcp_set_trigger

Sets automatic responses for pattern matches, supports regex patterns with capture groups

tcp_connect_and_send

Combines connect + send into a single atomic operation for time-sensitive protocols

tcp_list_connections

View all active connections with statistics

tcp_connection_info

Get detailed information about a specific connection

+3 tools

Overview

TcpSocketMCP Server

Gives AI models 11 tools for direct raw TCP socket interaction - connecting, sending/receiving in multiple encodings, buffering, and regex-based automatic response triggers - for protocol debugging, IoT devices, and legacy systems without HTTP. Use for debugging or reverse-engineering network protocols, talking to embedded/IoT devices or legacy systems directly, or automating protocol handshakes like IRC PING/PONG via pattern triggers.

What it does

TcpSocketMCP is an MCP server that gives AI models direct access to raw TCP sockets, letting them interact with network services without an HTTP wrapper. It supports multiple simultaneous connections, response data buffering, and automatic triggers. Eleven tools are exposed: tcp_connect opens a connection to any host:port and returns a connection_id for subsequent operations; tcp_send sends data through an established connection with a choice of encoding (utf-8, hex, or base64); tcp_read_buffer reads received data with support for partial reads and formatting options; tcp_disconnect closes a connection, frees its resources, and automatically removes any triggers attached to it; tcp_set_trigger sets an automatic response for pattern matches, supporting regex patterns with capture groups; tcp_connect_and_send combines connect and send into a single atomic operation for time-sensitive protocols; tcp_list_connections lists all active connections with statistics; tcp_connection_info gets detailed information about one connection; tcp_buffer_info checks buffer statistics without consuming the data; tcp_clear_buffer clears received data from a connection's buffer; and tcp_remove_trigger removes a specific auto-response trigger.

When to use - and when NOT to

Use this for direct interaction with embedded devices and IoT systems, debugging and testing network protocols, integrating with legacy systems that have no HTTP wrapper, protocol analysis and reverse engineering, or setting up automatic pattern-based responses for protocols like IRC or telnet (for example, automatic PING/PONG replies). It also fits tasks like polling unknown devices for identification or sending raw HTTP requests to a web server over a manually managed socket. Because network responses don't arrive instantly, the source recommends polling tcp_buffer_info to check for available data rather than assuming a response is immediately present after sending.

Capabilities

Hex encoding is recommended for binary protocols and for precise control over line endings, with common sequences called out explicitly: 0D0A for CRLF, 0A for LF, and 00 for null bytes. The server supports binary protocols via hex encoding, regex-based pattern matching for automatic responses, and is cross-platform compatible across Ubuntu, Windows, and macOS. The project maintains 85% test coverage with CI/CD and quality assurance in place.

How to install

Installation is available via PyPI:

pip install TcpSocketMCP

or via uv add TcpSocketMCP, or from source by cloning the repository and running uv pip install -e . followed by python run.py for direct execution. For Claude Desktop, an installed package is configured with command: TcpSocketMCP, while a from-source install is configured with command: python and args pointing at the local run.py path.

Who it's for

Network protocol developers, embedded/IoT engineers, and security researchers who need an AI assistant to open raw TCP connections, send and receive data in multiple encodings, and set up pattern-triggered automatic responses for protocol testing or reverse engineering.

Source README

An MCP server that provides direct access to TCP sockets, allowing AI models to directly interact with network services through raw TCP connections. Supports multiple simultaneous connections, response data buffering, and automatic triggers.

Installation

PyPI

pip install TcpSocketMCP

UV

uv add TcpSocketMCP

From Source

git clone https://github.com/kaseyk/tcp-socket-mcp.git
cd tcp-socket-mcp
uv pip install -e .

Direct Execution

python run.py

Configuration

Claude Desktop (Installed Package)

{
  "mcpServers": {
    "tcp-socket": {
      "command": "TcpSocketMCP",
      "env": {}
    }
  }
}

Claude Desktop (From Source)

{
  "mcpServers": {
    "tcp-socket": {
      "command": "python",
      "args": ["/path/to/tcp-socket-mcp/run.py"],
      "env": {}
    }
  }
}

Available Tools

Tool Description
tcp_connect Opens a TCP connection to any host:port, returns connection_id for subsequent operations
tcp_send Sends data through an established connection with encoding options (utf-8, hex, base64)
tcp_read_buffer Reads received data from the connection buffer with support for partial reads and formatting options
tcp_disconnect Closes the connection and frees resources, automatically removes all triggers
tcp_set_trigger Sets automatic responses for pattern matches, supports regex patterns with capture groups
tcp_connect_and_send Combines connect + send into a single atomic operation for time-sensitive protocols
tcp_list_connections View all active connections with statistics
tcp_connection_info Get detailed information about a specific connection
tcp_buffer_info Check buffer statistics without reading data
tcp_clear_buffer Clear received data from the buffer
tcp_remove_trigger Remove a specific auto-response trigger

Features

  • Direct interaction with embedded devices and IoT systems
  • Debugging and testing of network protocols
  • Integration with legacy systems without HTTP wrappers
  • Protocol analysis and reverse engineering
  • Automatic responses through trigger patterns (useful for IRC, telnet, custom protocols)
  • Support for multiple simultaneous connections
  • Response data buffering
  • Support for binary protocols with hex encoding
  • Regex pattern matching for automatic responses
  • Cross-platform compatibility (Ubuntu, Windows, macOS)

Usage Examples

Connecting to a web server and sending HTTP requests
Setting up automatic IRC PING/PONG responses
Polling unknown devices for identification
Sending binary protocol data using hex encoding
Debugging network protocols through raw TCP traffic analysis

Notes

Hex encoding is recommended for binary protocols and precise control over line endings. Common hex sequences include 0D0A for CRLF, 0A for LF, and 00 for null bytes. Network responses don't arrive instantly-use tcp_buffer_info to check for available data. The server maintains 85% test coverage with comprehensive CI/CD and quality assurance.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.