會延遲設定範圍中隨機毫秒數的回應。 支援 HTTP 請求與 STDIO 通訊。
組態範例
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v4.0.0/rc.schema.json",
"plugins": [
{
"name": "LatencyPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
"configSection": "latencyPlugin"
}
],
"latencyPlugin": {
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v4.0.0/latencyplugin.schema.json",
"minMs": 200,
"maxMs": 10000
}
}
組態屬性
| 財產 | 描述 | 違約 |
|---|---|---|
minMs |
以毫秒為單位新增至要求的最低延遲量。 必須小於或等於 maxMs。 |
0 |
maxMs |
以毫秒為單位新增至要求的最大延遲量。 | 五千 |
命令行選項
沒有
備註
Dev Proxy 會在外掛啟動時驗證其設定。 如果 minMs 大於 maxMs,Dev Proxy 就無法啟動並顯示錯誤,例如:
LatencyPlugin: minMs (500) must be less than or equal to maxMs (100).
要加上固定延遲,將 和 maxMs 設minMs為相同的數值。
STDIO 支援
當你用 這個LatencyPlugin指令時stdio,插件會為 stdout 回應增加人工延遲。 模擬延遲有助於測試應用程式如何處理緩慢的模型情境協定(MCP)伺服器回應或其他基於 STDIO 的工具。
STDIO 的配置範例
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v4.0.0/rc.schema.json",
"plugins": [
{
"name": "LatencyPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
"configSection": "latencyPlugin"
},
{
"name": "MockStdioResponsePlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
"configSection": "mockStdioResponsePlugin"
}
],
"latencyPlugin": {
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v4.0.0/latencyplugin.schema.json",
"minMs": 100,
"maxMs": 500
},
"mockStdioResponsePlugin": {
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v4.0.0/mockstdioresponseplugin.schema.json",
"mocksFile": "stdio-mocks.json"
}
}
然後執行:
devproxy stdio npx -y @modelcontextprotocol/server-filesystem