Skip to content

Conversation

@SpaceyKasey
Copy link
Contributor

@SpaceyKasey SpaceyKasey commented Aug 16, 2025

Description

Adding TcpSocketMCP to the community servers list - a Model Context Protocol server that provides raw TCP socket access, enabling AI models to interact directly with network services. This server fills a critical gap in the MCP ecosystem by allowing direct network protocol interactions for debugging, testing, and automation tasks.

Server Details

Server: TcpSocketMCP (new addition)
Repository: https://github.com/SpaceyKasey/TcpSocketMCP
PyPI Package: https://pypi.org/project/TcpSocketMCP/

Motivation and Context

Many network services and IoT devices communicate via raw TCP protocols that aren't covered by existing HTTP-based MCP servers. TcpSocketMCP enables:

  • Direct interaction with embedded devices and IoT systems
  • Network protocol debugging and testing
  • Legacy system integration without HTTP wrappers
  • Protocol reverse engineering and analysis
  • Automated responses via trigger patterns (useful for IRC, telnet, custom protocols)

This addresses the need for low-level network access that several community members have expressed, particularly for industrial automation, IoT development, and network security testing scenarios.

How Has This Been Tested?

Extensively tested with Claude Code across multiple scenarios:

  • ✅ IRC client implementation with automatic PING/PONG handling
  • ✅ HTTP/1.1 raw protocol communication
  • ✅ Telnet session management
  • ✅ Binary protocol interaction using hex encoding
  • ✅ Multiple concurrent connections (tested up to 10 simultaneous)
  • ✅ IoT device interrogation and control (as shown in demo GIFs)
  • ✅ Tested with MCP Inspector for protocol compliance

Testing environments:

macOS 15.x with Claude Code

Breaking Changes

None - this is a new server addition with no impact on existing functionality.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

Key Features

  • Multiple encoding support: UTF-8, hex, and base64 for handling both text and binary protocols
  • Automatic trigger system: Pre-register responses for pattern matches (perfect for protocol handshakes)
  • Connection management: Support for multiple concurrent connections with individual buffers
  • Atomic operations: tcp_connect_and_send for time-sensitive protocol requirements
  • Comprehensive buffering: All received data is buffered and accessible on-demand

Security Considerations

  • No authentication required for local socket access (follows MCP local-first principle)
  • Connections are isolated per session
  • Buffer size limits prevent memory exhaustion
  • Automatic connection cleanup on server shutdown

Installation Methods

# PyPI installation
pip install TcpSocketMCP

# Claude Code integration
claude mcp add rawtcp -- uvx TcpSocketMCP

# Direct execution
TcpSocketMCP

Sample Use Cases Demonstrated

  1. Device Discovery: Interrogating unknown network devices to identify protocols
  2. Protocol Testing: Sending crafted packets and analyzing responses
  3. Automation: Setting up automatic responses for protocol-specific requirements
  4. Binary Protocol Support: Full hex encoding support for non-text protocols

Performance Metrics

  • Handles 10+ concurrent connections
  • Sub-millisecond trigger response times
  • Buffer capacity: 1MB per connection (configurable)
  • Tested with sustained 100KB/s throughput

This server has been actively used in production environments for IoT device management and network debugging tasks. The comprehensive demo GIFs in the repository show real-world usage scenarios.

Related Tools in Ecosystem

Complements existing MCP servers:

  • Works alongside HTTP-based servers for complete network coverage
  • Can be combined with filesystem servers for logging network interactions
  • Integrates with database servers for storing protocol analysis results

Copy link
Member

@domdomegg domdomegg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really cool stuff, love the receipt printer example!

@domdomegg domdomegg merged commit 3f47710 into modelcontextprotocol:main Aug 17, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants