chore: Update environment configuration and package dependencies for MCP server
- Change MCP_SERVER in .env.example to use port 7123 - Add USE_STDIO_TRANSPORT flag in .env.example for stdio transport mode - Update bun.lock to include new dependencies: cors, express, ajv, and their type definitions - Add new scripts for building and running the MCP server with stdio transport - Introduce PUBLISHING.md for npm publishing guidelines - Enhance README with detailed setup instructions and tool descriptions
This commit is contained in:
62
bin/test-stdio.js
Executable file
62
bin/test-stdio.js
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Test script for MCP stdio transport
|
||||
*
|
||||
* This script sends JSON-RPC 2.0 requests to the MCP server
|
||||
* running in stdio mode and displays the responses.
|
||||
*
|
||||
* Usage: node test-stdio.js | node bin/mcp-stdio.cjs
|
||||
*/
|
||||
|
||||
// Send a ping request
|
||||
const pingRequest = {
|
||||
jsonrpc: "2.0",
|
||||
id: 1,
|
||||
method: "ping"
|
||||
};
|
||||
|
||||
// Send an info request
|
||||
const infoRequest = {
|
||||
jsonrpc: "2.0",
|
||||
id: 2,
|
||||
method: "info"
|
||||
};
|
||||
|
||||
// Send an echo request
|
||||
const echoRequest = {
|
||||
jsonrpc: "2.0",
|
||||
id: 3,
|
||||
method: "echo",
|
||||
params: {
|
||||
message: "Hello, MCP!",
|
||||
timestamp: new Date().toISOString(),
|
||||
test: true,
|
||||
count: 42
|
||||
}
|
||||
};
|
||||
|
||||
// Send the requests with a delay between them
|
||||
setTimeout(() => {
|
||||
console.log(JSON.stringify(pingRequest));
|
||||
}, 500);
|
||||
|
||||
setTimeout(() => {
|
||||
console.log(JSON.stringify(infoRequest));
|
||||
}, 1000);
|
||||
|
||||
setTimeout(() => {
|
||||
console.log(JSON.stringify(echoRequest));
|
||||
}, 1500);
|
||||
|
||||
// Process responses
|
||||
process.stdin.on('data', (data) => {
|
||||
try {
|
||||
const response = JSON.parse(data.toString());
|
||||
console.error('Received response:');
|
||||
console.error(JSON.stringify(response, null, 2));
|
||||
} catch (error) {
|
||||
console.error('Error parsing response:', error);
|
||||
console.error('Raw data:', data.toString());
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user