Socket MCP Server
A powerful Model Context Protocol (MCP) Server designed for AI-assisted development. It enables your AI assistant to communicate via TCP/IP sockets directly.
Key Features
- Easy Integration: Connect to any TCP/IP device or service
- Ready to Use: Simple
pipinstallation with zero complex setup - Multi-Connection: Manage multiple socket connections simultaneously
- Packet Protocol: Custom start/end delimiter packet parsing
- Background Listener: Auto-receive and buffer packets with drop_oldest overflow policy
- Data Transmission: Send/receive text or binary (hex) data
- Dual Execution Modes: Supports STDIO (default) and HTTP modes
Installation
Ensure you have Python 3.10 or higher installed.
pip install da2-mcp-socket
Quick Start
# STDIO mode (for Cursor/Claude Desktop)
da2-mcp-socket
# HTTP mode (for Antigravity)
da2-mcp-socket --http --port 8000
Client Configuration
Cursor / Claude Desktop
{
"mcpServers": {
"socket": {
"command": "da2-mcp-socket",
"args": [],
"env": { "LOG_LEVEL": "INFO" }
}
}
}
Antigravity
{
"mcpServers": {
"socket": {
"serverUrl": "http://localhost:8000/mcp"
}
}
}
Available Tools (15)
Connection Management
| Tool | Description |
|---|---|
| connect | Connect to a TCP server (host:port) |
| disconnect | Close a specific connection |
| get_connection_status | Get status of active connection(s) |
Data Transmission
| Tool | Description |
|---|---|
| send_data | Send text or hex data through a connection |
| receive_data | Receive data from a connection (with timeout) |
| receive_line | Receive a line (until newline character) |
| receive_until | Receive until a specific terminator |
Protocol Management
| Tool | Description |
|---|---|
| set_protocol | Configure receive mode (raw/line/packet) with custom delimiters |
| receive_packet | Receive complete packet based on configured protocol |
| get_protocol | Get current protocol settings for a connection |
Background Listener
| Tool | Description |
|---|---|
| start_listening | Start background listener thread |
| stop_listening | Stop background listener |
| get_packets | Get all buffered packets (clears buffer) |
| get_buffer_status | Query buffer status (count/overflow) |
Server Info
| Tool | Description |
|---|---|
| get_server_info | Get server version and default settings |
Usage Examples
RFID Reader Connection (AL-510)
# 1. Connect to device
connect("192.168.248.70", 1001)
# 2. Set packet protocol: <0x0A>[data]<0x0D0A>
set_protocol("conn_id", mode="packet",
start_delimiter_hex="0A",
end_delimiter_hex="0D0A")
# 3. Send command (Inventory EPC+TID)
send_data("conn_id", "0A4055322C52322C302C360D", as_hex=True)
# 4. Receive packet
receive_packet("conn_id", timeout=5.0)
# → @2000/01/01 01:31:11.981-Antenna1-U3000E300...,RE28069952...
# 5. Disconnect
disconnect("conn_id")
Background Continuous Listening
# 1. Connect and set protocol
connect("192.168.248.70", 1001, max_buffer_packets=100)
set_protocol("conn_id", mode="packet", start_delimiter_hex="0A", end_delimiter_hex="0D0A")
# 2. Start background listener
start_listening("conn_id")
# 3. Get accumulated packets anytime
get_packets("conn_id")
# → { packets: [{data_hex, data_text, timestamp}, ...], count: 5 }
# 4. Query buffer status
get_buffer_status("conn_id")
# → { buffer: { count: 5, max: 100, overflow_count: 0 } }
# 5. Stop listening
stop_listening("conn_id")
HTTP Request
connect("example.com", 80)
send_data("conn_id", "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n")
receive_data("conn_id", size=4096, timeout=5.0)
disconnect("conn_id")
Default Settings
| Parameter | Default Value |
|---|---|
| Connection Timeout | 10.0 seconds |
| Read Timeout | 5.0 seconds |
| Buffer Size | 4096 bytes |
| Max Buffer Packets | 100 |
| Overflow Policy | drop_oldest |
License
MIT License
Copyright (c) 2026 Danny, DA2 Studio (https://da2.35g.tw)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
da2_mcp_socket-0.2.0.tar.gz
(17.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file da2_mcp_socket-0.2.0.tar.gz.
File metadata
- Download URL: da2_mcp_socket-0.2.0.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a9c4d744d1a913f9b7c4017c567b9ffd24d32b5e34a28c755d979b1c464f184
|
|
| MD5 |
b297aa7f6b3926bd55ae038b4912a10c
|
|
| BLAKE2b-256 |
912a3bc4afc13bf021335248db3449e23d059919fabb1ba25f13957cffac1429
|
File details
Details for the file da2_mcp_socket-0.2.0-py3-none-any.whl.
File metadata
- Download URL: da2_mcp_socket-0.2.0-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45eac2bb4f9de3e52e140a7b536d09bf9b1f81c1bd52bca64fda41c014fafe5d
|
|
| MD5 |
50555128fb0188caabcd92e5119d48f1
|
|
| BLAKE2b-256 |
32bdbcd501a98dee2368c118cd316b391366850a12574c5aa8e758deeeb8062f
|