add mpc inspector example

This commit is contained in:
Timur Gordon
2025-03-14 02:37:48 +01:00
parent 0a953f2c09
commit 475e812ba3
3 changed files with 41 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
# 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
```v
import freeflowuniverse.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
1. `bash example.sh`
2. `open localhost:5173`
3. Configure inspector:
- Transport type: `STDIO`
- Command: `v`
- Arguments: `-w -n run /Users/timurgordon/code/github/freeflowuniverse/herolib/lib/mcp/v_do/vdo.v`
4. Connect
## Output
Expected output:
![Inspector Screenshot](inspector_screenshot.png)

View File

@@ -0,0 +1,3 @@
#!/bin/bash
npx @modelcontextprotocol/inspector node build/index.js

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 KiB