da2-mcp-socket 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- da2_mcp_socket-0.2.0.dist-info/METADATA +204 -0
- da2_mcp_socket-0.2.0.dist-info/RECORD +8 -0
- da2_mcp_socket-0.2.0.dist-info/WHEEL +4 -0
- da2_mcp_socket-0.2.0.dist-info/entry_points.txt +2 -0
- da2_mcp_socket-0.2.0.dist-info/licenses/LICENSE +21 -0
- mcp_socket/__init__.py +6 -0
- mcp_socket/server.py +559 -0
- mcp_socket/socket_manager.py +1103 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: da2-mcp-socket
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A Socket TCP/IP MCP Server - enables AI assistants to communicate via TCP/IP sockets
|
|
5
|
+
Project-URL: Homepage, https://da2.35g.tw
|
|
6
|
+
Project-URL: Repository, https://github.com/anthropics/mcp
|
|
7
|
+
Project-URL: Documentation, https://da2.35g.tw
|
|
8
|
+
Author-email: Danny <danny@35g.tw>, DA2 Studio <contact@35g.tw>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai,claude,cursor,ip,llm,mcp,network,socket,tcp
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Communications
|
|
22
|
+
Classifier: Topic :: Internet
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Requires-Dist: mcp[cli]>=1.0.0
|
|
26
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# Socket MCP Server
|
|
30
|
+
|
|
31
|
+
A powerful Model Context Protocol (MCP) Server designed for **AI-assisted development**. It enables your AI assistant to communicate via TCP/IP sockets directly.
|
|
32
|
+
|
|
33
|
+
## Key Features
|
|
34
|
+
|
|
35
|
+
* **Easy Integration**: Connect to any TCP/IP device or service
|
|
36
|
+
* **Ready to Use**: Simple `pip` installation with zero complex setup
|
|
37
|
+
* **Multi-Connection**: Manage multiple socket connections simultaneously
|
|
38
|
+
* **Packet Protocol**: Custom start/end delimiter packet parsing
|
|
39
|
+
* **Background Listener**: Auto-receive and buffer packets with drop_oldest overflow policy
|
|
40
|
+
* **Data Transmission**: Send/receive text or binary (hex) data
|
|
41
|
+
* **Dual Execution Modes**: Supports STDIO (default) and HTTP modes
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
Ensure you have Python 3.10 or higher installed.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install da2-mcp-socket
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# STDIO mode (for Cursor/Claude Desktop)
|
|
55
|
+
da2-mcp-socket
|
|
56
|
+
|
|
57
|
+
# HTTP mode (for Antigravity)
|
|
58
|
+
da2-mcp-socket --http --port 8000
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Client Configuration
|
|
62
|
+
|
|
63
|
+
### Cursor / Claude Desktop
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"socket": {
|
|
69
|
+
"command": "da2-mcp-socket",
|
|
70
|
+
"args": [],
|
|
71
|
+
"env": { "LOG_LEVEL": "INFO" }
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Antigravity
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"mcpServers": {
|
|
82
|
+
"socket": {
|
|
83
|
+
"serverUrl": "http://localhost:8000/mcp"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Available Tools (15)
|
|
92
|
+
|
|
93
|
+
### Connection Management
|
|
94
|
+
| Tool | Description |
|
|
95
|
+
| :--- | :--- |
|
|
96
|
+
| **connect** | Connect to a TCP server (host:port) |
|
|
97
|
+
| **disconnect** | Close a specific connection |
|
|
98
|
+
| **get_connection_status** | Get status of active connection(s) |
|
|
99
|
+
|
|
100
|
+
### Data Transmission
|
|
101
|
+
| Tool | Description |
|
|
102
|
+
| :--- | :--- |
|
|
103
|
+
| **send_data** | Send text or hex data through a connection |
|
|
104
|
+
| **receive_data** | Receive data from a connection (with timeout) |
|
|
105
|
+
| **receive_line** | Receive a line (until newline character) |
|
|
106
|
+
| **receive_until** | Receive until a specific terminator |
|
|
107
|
+
|
|
108
|
+
### Protocol Management
|
|
109
|
+
| Tool | Description |
|
|
110
|
+
| :--- | :--- |
|
|
111
|
+
| **set_protocol** | Configure receive mode (raw/line/packet) with custom delimiters |
|
|
112
|
+
| **receive_packet** | Receive complete packet based on configured protocol |
|
|
113
|
+
| **get_protocol** | Get current protocol settings for a connection |
|
|
114
|
+
|
|
115
|
+
### Background Listener
|
|
116
|
+
| Tool | Description |
|
|
117
|
+
| :--- | :--- |
|
|
118
|
+
| **start_listening** | Start background listener thread |
|
|
119
|
+
| **stop_listening** | Stop background listener |
|
|
120
|
+
| **get_packets** | Get all buffered packets (clears buffer) |
|
|
121
|
+
| **get_buffer_status** | Query buffer status (count/overflow) |
|
|
122
|
+
|
|
123
|
+
### Server Info
|
|
124
|
+
| Tool | Description |
|
|
125
|
+
| :--- | :--- |
|
|
126
|
+
| **get_server_info** | Get server version and default settings |
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Usage Examples
|
|
131
|
+
|
|
132
|
+
### RFID Reader Connection (AL-510)
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
# 1. Connect to device
|
|
136
|
+
connect("192.168.248.70", 1001)
|
|
137
|
+
|
|
138
|
+
# 2. Set packet protocol: <0x0A>[data]<0x0D0A>
|
|
139
|
+
set_protocol("conn_id", mode="packet",
|
|
140
|
+
start_delimiter_hex="0A",
|
|
141
|
+
end_delimiter_hex="0D0A")
|
|
142
|
+
|
|
143
|
+
# 3. Send command (Inventory EPC+TID)
|
|
144
|
+
send_data("conn_id", "0A4055322C52322C302C360D", as_hex=True)
|
|
145
|
+
|
|
146
|
+
# 4. Receive packet
|
|
147
|
+
receive_packet("conn_id", timeout=5.0)
|
|
148
|
+
# → @2000/01/01 01:31:11.981-Antenna1-U3000E300...,RE28069952...
|
|
149
|
+
|
|
150
|
+
# 5. Disconnect
|
|
151
|
+
disconnect("conn_id")
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Background Continuous Listening
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
# 1. Connect and set protocol
|
|
158
|
+
connect("192.168.248.70", 1001, max_buffer_packets=100)
|
|
159
|
+
set_protocol("conn_id", mode="packet", start_delimiter_hex="0A", end_delimiter_hex="0D0A")
|
|
160
|
+
|
|
161
|
+
# 2. Start background listener
|
|
162
|
+
start_listening("conn_id")
|
|
163
|
+
|
|
164
|
+
# 3. Get accumulated packets anytime
|
|
165
|
+
get_packets("conn_id")
|
|
166
|
+
# → { packets: [{data_hex, data_text, timestamp}, ...], count: 5 }
|
|
167
|
+
|
|
168
|
+
# 4. Query buffer status
|
|
169
|
+
get_buffer_status("conn_id")
|
|
170
|
+
# → { buffer: { count: 5, max: 100, overflow_count: 0 } }
|
|
171
|
+
|
|
172
|
+
# 5. Stop listening
|
|
173
|
+
stop_listening("conn_id")
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### HTTP Request
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
connect("example.com", 80)
|
|
180
|
+
send_data("conn_id", "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n")
|
|
181
|
+
receive_data("conn_id", size=4096, timeout=5.0)
|
|
182
|
+
disconnect("conn_id")
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Default Settings
|
|
188
|
+
|
|
189
|
+
| Parameter | Default Value |
|
|
190
|
+
| :--- | :--- |
|
|
191
|
+
| **Connection Timeout** | 10.0 seconds |
|
|
192
|
+
| **Read Timeout** | 5.0 seconds |
|
|
193
|
+
| **Buffer Size** | 4096 bytes |
|
|
194
|
+
| **Max Buffer Packets** | 100 |
|
|
195
|
+
| **Overflow Policy** | drop_oldest |
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## License
|
|
200
|
+
|
|
201
|
+
MIT License
|
|
202
|
+
|
|
203
|
+
Copyright (c) 2026 Danny, DA2 Studio (https://da2.35g.tw)
|
|
204
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
mcp_socket/__init__.py,sha256=c7quRgWcg-oggoCP5o6T75InOF6RgDsovcxXNyRIwVw,139
|
|
2
|
+
mcp_socket/server.py,sha256=9JzFjsZglpNy-kRgNcj1syUDrua19UvOzUrpcIDQyM4,17528
|
|
3
|
+
mcp_socket/socket_manager.py,sha256=DM5g_Qpw8HYO_mwcetTpFXq0MuONl6rVwoi5fuP8Im0,44518
|
|
4
|
+
da2_mcp_socket-0.2.0.dist-info/METADATA,sha256=I3eDjt-gjO32foyjgLvF9A3fmt-jqmQRNtvr7tStsUc,5456
|
|
5
|
+
da2_mcp_socket-0.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
6
|
+
da2_mcp_socket-0.2.0.dist-info/entry_points.txt,sha256=kknAd10bEep6ZRLgWOiJsooDbtLCafYlpV4r36X8j44,58
|
|
7
|
+
da2_mcp_socket-0.2.0.dist-info/licenses/LICENSE,sha256=9UcuR0omFhpKiuKjnMAqGxhFizwoj-luexK-RXgM0Qs,1116
|
|
8
|
+
da2_mcp_socket-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Danny, DA2 Studio (https://da2.35g.tw)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|