This document demonstrates a basic workflow for using the OSC MCP Server to receive and process OSC messages.
You want to receive OSC messages from a SuperCollider synthesizer and monitor the frequency and amplitude parameters being sent.
First, create an endpoint to listen for OSC messages on port 8000:
{
"tool": "create_osc_endpoint",
"parameters": {
"port": 8000,
"bufferSize": 500,
"addressFilters": ["/synth/*"]
}
}Expected Response:
{
"endpointId": "endpoint_8000_1234567890",
"port": 8000,
"status": "active",
"message": "OSC endpoint created successfully"
}Check that the endpoint is running correctly:
{
"tool": "get_endpoint_status",
"parameters": {
"endpointId": "endpoint_8000_1234567890"
}
}Expected Response:
{
"endpoints": [
{
"id": "endpoint_8000_1234567890",
"port": 8000,
"status": "active",
"bufferSize": 500,
"addressFilters": ["/synth/*"],
"createdAt": "2024-01-01T12:00:00.000Z",
"messageCount": 0
}
]
}Using SuperCollider, send some test messages:
// Create NetAddr for the OSC MCP Server
~oscServer = NetAddr("127.0.0.1", 8000);
// Send synthesizer control messages
~oscServer.sendMsg("/synth/freq", 440.0);
~oscServer.sendMsg("/synth/amp", 0.8);
~oscServer.sendMsg("/synth/filter", 2000.0, 0.5);Retrieve the messages that were sent:
{
"tool": "get_osc_messages",
"parameters": {
"endpointId": "endpoint_8000_1234567890",
"timeWindowSeconds": 60,
"limit": 10
}
}Expected Response:
{
"messages": [
{
"timestamp": "2024-01-01T12:01:00.000Z",
"address": "/synth/freq",
"typeTags": "f",
"arguments": [440.0],
"sourceIp": "127.0.0.1",
"sourcePort": 57120
},
{
"timestamp": "2024-01-01T12:01:01.000Z",
"address": "/synth/amp",
"typeTags": "f",
"arguments": [0.8],
"sourceIp": "127.0.0.1",
"sourcePort": 57120
},
{
"timestamp": "2024-01-01T12:01:02.000Z",
"address": "/synth/filter",
"typeTags": "ff",
"arguments": [2000.0, 0.5],
"sourceIp": "127.0.0.1",
"sourcePort": 57120
}
],
"totalCount": 3,
"filteredCount": 3
}Query only frequency messages:
{
"tool": "get_osc_messages",
"parameters": {
"endpointId": "endpoint_8000_1234567890",
"addressPattern": "/synth/freq",
"limit": 5
}
}Check endpoint status to see message count:
{
"tool": "get_endpoint_status",
"parameters": {
"endpointId": "endpoint_8000_1234567890"
}
}The messageCount field will show how many messages have been received.
When finished, stop the endpoint:
{
"tool": "stop_osc_endpoint",
"parameters": {
"endpointId": "endpoint_8000_1234567890"
}
}Expected Response:
{
"endpointId": "endpoint_8000_1234567890",
"message": "OSC endpoint stopped successfully"
}- Address Filters: Using
/synth/*filters only messages starting with/synth/ - Buffer Management: With bufferSize 500, only the most recent 500 messages are kept
- Time Windows: Use
timeWindowSecondsto get recent messages only - Pattern Matching: Address patterns support wildcards for flexible filtering
- Resource Cleanup: Always stop endpoints when done to free resources
- Try the Multi-Endpoint Workflow for handling multiple sources
- Explore Real-time Monitoring for continuous message processing
- See Advanced Filtering for complex message routing