mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-11 16:46:16 +00:00
3.0 KiB
3.0 KiB
Sogen MCP Server
A Model Context Protocol (MCP) server that provides AI access to the sogen userspace emulator.
Setup
-
Install dependencies:
npm install -
Run the server:
npm startOr for development with auto-restart:
npm run dev
Structure
server.js- Main server implementationpackage.json- Node.js project configuration
Available Tools
list_applications
Lists all available applications in the sogen userspace emulator.
Parameters: None
Example usage:
{
"name": "list_applications",
"arguments": {}
}
run_application
Executes a specific application from the allowed list in the sogen userspace emulator.
Parameters:
application(string, required): The name of the application to run (uselist_applicationsto see available apps)args(array of strings, optional): Arguments to pass to the applicationtimeout(number, optional): Timeout in milliseconds (default: 5000)
Example usage:
{
"name": "run_application",
"arguments": {
"application": "echo",
"args": ["Hello from sogen!"],
"timeout": 3000
}
}
Adding More Tools
To add additional tools:
- Add the tool definition to the
ListToolsRequestSchemahandler - Add the implementation to the
CallToolRequestSchemahandler - Create the corresponding method in the
MyMCPServerclass
Execution Model
The server uses an analyzer-based execution model:
- Applications are not executed directly
- Instead, the server runs:
C:/analyer.exe -e C:/somedir <application_name> [args...] - The analyzer handles the actual execution within the sogen environment
- All output comes from the analyzer process
Command Structure
C:/analyer.exe -e C:/somedir <application_name> [arguments...]
Where:
C:/analyer.exe- The sogen analyzer executable-e C:/somedir- Analyzer flags and environment directory<application_name>- The application fromget_applications()[arguments...]- Optional arguments passed to the application
Implementation Required
You need to provide the implementation for the get_applications() method in server.js. This method should:
async get_applications() {
// Return a Promise that resolves to a string array
// Example: return ['echo', 'ls', 'cat', 'grep'];
}
Usage
This server allows AI assistants to:
- List available applications using
list_applications - Execute specific applications using
run_applicationwith validation
The server communicates over stdio and is designed for MCP-compatible clients.
Example Workflow
- Call
list_applicationsto see what's available - Call
run_applicationwith a valid application name and arguments
Next Steps
- Implement
get_applications()method - Provide the actual implementation - Add application-specific argument validation
- Implement resource handling for file access
- Add comprehensive logging and monitoring
- Consider per-application sandboxing for enhanced security