initialize Electron desktop app and remove unused files
This commit is contained in:
Vendored
+56
@@ -0,0 +1,56 @@
|
||||
const readline = require('node:readline')
|
||||
|
||||
const rl = readline.createInterface({ input: process.stdin, crlfDelay: Infinity })
|
||||
|
||||
rl.on('line', line => {
|
||||
if (!line.trim()) return
|
||||
const message = JSON.parse(line)
|
||||
if (message.method === 'initialize') {
|
||||
process.stdout.write(`${JSON.stringify({
|
||||
jsonrpc: '2.0',
|
||||
id: message.id,
|
||||
result: {
|
||||
protocolVersion: '2024-11-05',
|
||||
capabilities: { tools: {} },
|
||||
serverInfo: { name: 'fake-mcp', version: '0.0.0' },
|
||||
},
|
||||
})}\n`)
|
||||
return
|
||||
}
|
||||
if (message.method === 'tools/list') {
|
||||
process.stdout.write(`${JSON.stringify({
|
||||
jsonrpc: '2.0',
|
||||
id: message.id,
|
||||
result: {
|
||||
tools: [
|
||||
{
|
||||
name: 'fake_echo',
|
||||
description: 'Echo a value through fake MCP.',
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: { text: { type: 'string' } },
|
||||
required: ['text'],
|
||||
additionalProperties: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
})}\n`)
|
||||
return
|
||||
}
|
||||
if (message.method === 'tools/call') {
|
||||
process.stdout.write(`${JSON.stringify({
|
||||
jsonrpc: '2.0',
|
||||
id: message.id,
|
||||
result: {
|
||||
content: [{ type: 'text', text: `mcp:${message.params?.arguments?.text || ''}` }],
|
||||
},
|
||||
})}\n`)
|
||||
return
|
||||
}
|
||||
process.stdout.write(`${JSON.stringify({
|
||||
jsonrpc: '2.0',
|
||||
id: message.id,
|
||||
error: { code: -32601, message: `Method not found: ${message.method}` },
|
||||
})}\n`)
|
||||
})
|
||||
Reference in New Issue
Block a user