# MCP2Serial: Bridge between AI Models and Physical World
Connect AI Large Language Models to hardware devices through the Model Context Protocol (MCP).
[GitHub Repository](https://github.com/mcp2everything/mcp2serial) | [Documentation](https://github.com/mcp2everything/mcp2serial/tree/main/docs)
## Features
- **Intelligent Serial Communication**
- Automatic port detection and configuration
- Multiple baud rate support (default 115200)
- Real-time status monitoring and error handling
- **MCP Protocol Integration**
- Full Model Context Protocol support
- Resource management and tool invocation
- Flexible prompt system
## Supported Clients
MCP2Serial supports all clients implementing the MCP protocol, including:
- Claude Desktop (Test ok)
- Continue (Should work)
- Cline (Test ok)
## Quick Start
make sure you have installed uv
```
```bash
windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
MacOS
curl -LsSf https://astral.sh/uv/install.sh | sh
```
## Basic Configuration
Add the following to your MCP client configuration:
```json
{
"mcpServers": {
"mcp2serial": {
"command": "uvx",
"args": ["mcp2serial"]
}
}
}
```
## Serial Port Configuration
Create or modify `config.yaml` to configure serial port parameters:
```yaml
serial:
port: COM11 # Windows example, on Linux might be /dev/ttyUSB0
baud_rate: 115200 # Baud rate
timeout: 1.0 # Serial timeout (seconds)
read_timeout: 0.5 # Read timeout (seconds)
```
If `port` is not specified, the program will automatically search for available serial ports.
## Configuration File Location
The configuration file (`config.yaml`) can be placed in different locations depending on your needs. The program searches for the configuration file in the following order:
### 1. Current Working Directory (For Development)
- Path: `./config.yaml`
- Example: If you run the program from `C:\Projects`, it will look for `C:\Projects\config.yaml`
- Best for: Development and testing
- No special permissions required
### 2. User's Home Directory (Recommended for Personal Use)
- Windows: `C:\Users\YourName\.mcp2serial\config.yaml`
- macOS: `/Users/YourName/.mcp2serial/config.yaml`
- Linux: `/home/username/.mcp2serial/config.yaml`
- Best for: Personal configuration
- Create the `.mcp2serial` directory if it doesn't exist
- No special permissions required
### 3. System-wide Configuration (For Multi-user Setup)
- Windows: `C:\ProgramData\mcp2serial\config.yaml` (requires admin rights)
- macOS/Linux: `/etc/mcp2serial/config.yaml` (requires sudo/root)
- Best for: Shared configuration in multi-user environments
- Create the directory with appropriate permissions
The program will use the first valid configuration file it finds in this order. Choose the location based on your needs:
- For testing: use current directory
- For personal use: use home directory (recommended)
- For system-wide settings: use ProgramData or /etc
## Serial Port Configuration
Create your `config.yaml` in one of the above locations with the following structure:
```yaml
serial:
port: COM11 # or /dev/ttyUSB0 for Linux
baud_rate: 115200
timeout: 1.0
read_timeout: 0.5
commands:
# Add your commands here
# See the Command Configuration section for examples
```
## Command Configuration
Add or remove custom commands in `config.yaml`:
```yaml
commands:
# PWM control command example
set_pwm:
command: "PWM {frequency}\n" # Actual command format to send
need_parse: false # No need to parse response
prompts: # Prompt list
- "Set PWM to {value}"
- "Turn off PWM"
# LED control command example
led_control:
command: "LED {state}\n" # state can be on/off or other values
need_parse: false
prompts:
- "Turn on LED"
- "Turn off LED"
- "Set LED state to {state}"
# Command example with response parsing
get_sensor:
command: "GET_SENSOR\n"
need_parse: true # Need to parse response
prompts:
- "Read sensor data"
```
### Response Parsing
1. Simple Response (`need_parse: false`):
- Device returns message starting with "OK" indicates success
- Other responses will be treated as errors
2. Parsed Response (`need_parse: true`):
- Complete response will be returned in the `result.raw` field
## Documentation
For detailed documentation, please visit our [GitHub repository](https://github.com/mcp2everything/mcp2serial).
## Support
If you encounter any issues or have questions:
1. Check our [Issues](https://github.com/mcp2everything/mcp2serial/issues) page
2. Read our [Wiki](https://github.com/mcp2everything/mcp2serial/wiki)
3. Create a new issue if needed
## License
This project is licensed under the MIT License.
Raw data
{
"_id": null,
"home_page": null,
"name": "mcp2serial",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "ai, llm, mcp, pwm, serial",
"author": "MCP2Everything Team",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/54/d5/6d923199b171ec6fdb05f9eff9386b3827a6cf7c75926a0bd0846a065540/mcp2serial-0.1.3.tar.gz",
"platform": null,
"description": "# MCP2Serial: Bridge between AI Models and Physical World\n\nConnect AI Large Language Models to hardware devices through the Model Context Protocol (MCP).\n\n[GitHub Repository](https://github.com/mcp2everything/mcp2serial) | [Documentation](https://github.com/mcp2everything/mcp2serial/tree/main/docs)\n\n## Features\n\n- **Intelligent Serial Communication**\n - Automatic port detection and configuration\n - Multiple baud rate support (default 115200)\n - Real-time status monitoring and error handling\n\n- **MCP Protocol Integration**\n - Full Model Context Protocol support\n - Resource management and tool invocation\n - Flexible prompt system\n\n## Supported Clients\n\nMCP2Serial supports all clients implementing the MCP protocol, including:\n\n- Claude Desktop (Test ok)\n- Continue (Should work)\n- Cline (Test ok)\n\n## Quick Start\nmake sure you have installed uv\n```\n```bash\nwindows\npowershell -ExecutionPolicy ByPass -c \"irm https://astral.sh/uv/install.ps1 | iex\"\nMacOS\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n```\n## Basic Configuration\n\nAdd the following to your MCP client configuration:\n\n```json\n{\n \"mcpServers\": {\n \"mcp2serial\": {\n \"command\": \"uvx\",\n \"args\": [\"mcp2serial\"]\n }\n }\n}\n```\n\n## Serial Port Configuration\n\nCreate or modify `config.yaml` to configure serial port parameters:\n\n```yaml\nserial:\n port: COM11 # Windows example, on Linux might be /dev/ttyUSB0\n baud_rate: 115200 # Baud rate\n timeout: 1.0 # Serial timeout (seconds)\n read_timeout: 0.5 # Read timeout (seconds)\n```\n\nIf `port` is not specified, the program will automatically search for available serial ports.\n\n## Configuration File Location\n\nThe configuration file (`config.yaml`) can be placed in different locations depending on your needs. The program searches for the configuration file in the following order:\n\n### 1. Current Working Directory (For Development)\n- Path: `./config.yaml`\n- Example: If you run the program from `C:\\Projects`, it will look for `C:\\Projects\\config.yaml`\n- Best for: Development and testing\n- No special permissions required\n\n### 2. User's Home Directory (Recommended for Personal Use)\n- Windows: `C:\\Users\\YourName\\.mcp2serial\\config.yaml`\n- macOS: `/Users/YourName/.mcp2serial/config.yaml`\n- Linux: `/home/username/.mcp2serial/config.yaml`\n- Best for: Personal configuration\n- Create the `.mcp2serial` directory if it doesn't exist\n- No special permissions required\n\n### 3. System-wide Configuration (For Multi-user Setup)\n- Windows: `C:\\ProgramData\\mcp2serial\\config.yaml` (requires admin rights)\n- macOS/Linux: `/etc/mcp2serial/config.yaml` (requires sudo/root)\n- Best for: Shared configuration in multi-user environments\n- Create the directory with appropriate permissions\n\nThe program will use the first valid configuration file it finds in this order. Choose the location based on your needs:\n- For testing: use current directory\n- For personal use: use home directory (recommended)\n- For system-wide settings: use ProgramData or /etc\n\n## Serial Port Configuration\n\nCreate your `config.yaml` in one of the above locations with the following structure:\n\n```yaml\nserial:\n port: COM11 # or /dev/ttyUSB0 for Linux\n baud_rate: 115200\n timeout: 1.0\n read_timeout: 0.5\n\ncommands:\n # Add your commands here\n # See the Command Configuration section for examples\n```\n\n## Command Configuration\n\nAdd or remove custom commands in `config.yaml`:\n\n```yaml\ncommands:\n # PWM control command example\n set_pwm:\n command: \"PWM {frequency}\\n\" # Actual command format to send\n need_parse: false # No need to parse response\n prompts: # Prompt list\n - \"Set PWM to {value}\"\n - \"Turn off PWM\"\n\n # LED control command example\n led_control:\n command: \"LED {state}\\n\" # state can be on/off or other values\n need_parse: false\n prompts:\n - \"Turn on LED\"\n - \"Turn off LED\"\n - \"Set LED state to {state}\"\n\n # Command example with response parsing\n get_sensor:\n command: \"GET_SENSOR\\n\"\n need_parse: true # Need to parse response\n prompts:\n - \"Read sensor data\"\n```\n\n### Response Parsing\n\n1. Simple Response (`need_parse: false`):\n - Device returns message starting with \"OK\" indicates success\n - Other responses will be treated as errors\n\n2. Parsed Response (`need_parse: true`):\n - Complete response will be returned in the `result.raw` field\n\n## Documentation\n\nFor detailed documentation, please visit our [GitHub repository](https://github.com/mcp2everything/mcp2serial).\n\n## Support\n\nIf you encounter any issues or have questions:\n1. Check our [Issues](https://github.com/mcp2everything/mcp2serial/issues) page\n2. Read our [Wiki](https://github.com/mcp2everything/mcp2serial/wiki)\n3. Create a new issue if needed\n\n## License\n\nThis project is licensed under the MIT License.\n",
"bugtrack_url": null,
"license": null,
"summary": "MCP Serial Service for PWM Control",
"version": "0.1.3",
"project_urls": {
"Documentation": "https://github.com/mcp2everything/mcp2serial/tree/main/docs",
"Homepage": "https://github.com/mcp2everything/mcp2serial",
"Issues": "https://github.com/mcp2everything/mcp2serial/issues",
"Repository": "https://github.com/mcp2everything/mcp2serial.git"
},
"split_keywords": [
"ai",
" llm",
" mcp",
" pwm",
" serial"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "04e6da0960c585067ec9491826f96858de6305bf17e1a2870587533f47df3799",
"md5": "c40ac16acb34adb083fe971c0d1ce787",
"sha256": "3d3e6959e0d9afc9dd556412c08a90a73d01e3678e5914d6ed30b12e4d482903"
},
"downloads": -1,
"filename": "mcp2serial-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c40ac16acb34adb083fe971c0d1ce787",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 11045,
"upload_time": "2024-12-18T13:26:42",
"upload_time_iso_8601": "2024-12-18T13:26:42.968155Z",
"url": "https://files.pythonhosted.org/packages/04/e6/da0960c585067ec9491826f96858de6305bf17e1a2870587533f47df3799/mcp2serial-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "54d56d923199b171ec6fdb05f9eff9386b3827a6cf7c75926a0bd0846a065540",
"md5": "1455cc40e0781d82e986f3641a923f60",
"sha256": "2e455b0bf51f6d17fc090b0c7e3cdc02776319d1b4e361aeaa0cd4d34a5269d6"
},
"downloads": -1,
"filename": "mcp2serial-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "1455cc40e0781d82e986f3641a923f60",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 5507782,
"upload_time": "2024-12-18T13:26:46",
"upload_time_iso_8601": "2024-12-18T13:26:46.017387Z",
"url": "https://files.pythonhosted.org/packages/54/d5/6d923199b171ec6fdb05f9eff9386b3827a6cf7c75926a0bd0846a065540/mcp2serial-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-18 13:26:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mcp2everything",
"github_project": "mcp2serial",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mcp2serial"
}