Inspector Example
This is a simple example of how to use the MCP module to create a server that handles JSON-RPC requests and responses.
Usage
import incubaid.herolib.mcp
// Define custom handlers if needed
handlers := {
'custom_method': my_custom_handler
}
// Create server configuration
config := mcp.ServerConfiguration{
// Configure server capabilities as needed
}
// Create and start the server
mut server := mcp.new_server(handlers, config)!
server.start()!
Running Example
Option 1: Using the example script (Recommended)
bash example.sh- The MCP inspector will open automatically in your browser
- The inspector should connect automatically to the V server
Option 2: Manual configuration
- Start the MCP inspector:
npx @modelcontextprotocol/inspector - Open
localhost:5173in your browser - Configure inspector:
- Transport type:
STDIO - Command:
<path-to-server.vsh> - Arguments: (leave empty)
- Transport type:
- Click "Connect"
Option 3: Using V directly
- Start the MCP inspector:
npx @modelcontextprotocol/inspector - Open
localhost:5173in your browser - Configure inspector:
- Transport type:
STDIO - Command:
v - Arguments:
run <path-to-server.vsh>
- Transport type:
- Click "Connect"
