mcp-server-environment-agency 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/test-script.js ADDED
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from 'child_process';
4
+ import { fileURLToPath } from 'url';
5
+ import { dirname, join } from 'path';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+
10
+ function testMCPServer(message, description) {
11
+ return new Promise((resolve, reject) => {
12
+ console.log(`\n๐Ÿงช Testing: ${description}`);
13
+ console.log(`๐Ÿ“ค Sending: ${message}`);
14
+
15
+ const serverPath = join(__dirname, 'build', 'index.js');
16
+ const child = spawn('node', [serverPath], {
17
+ stdio: ['pipe', 'pipe', 'pipe']
18
+ });
19
+
20
+ let stdout = '';
21
+ let stderr = '';
22
+
23
+ child.stdout.on('data', (data) => {
24
+ stdout += data.toString();
25
+ });
26
+
27
+ child.stderr.on('data', (data) => {
28
+ stderr += data.toString();
29
+ });
30
+
31
+ child.on('close', (code) => {
32
+ console.log(`๐Ÿ“ฅ Response: ${stdout.trim()}`);
33
+ if (stderr) {
34
+ console.log(`๐Ÿ“‹ Server logs: ${stderr.trim()}`);
35
+ }
36
+ resolve({ stdout: stdout.trim(), stderr: stderr.trim(), code });
37
+ });
38
+
39
+ child.on('error', (error) => {
40
+ reject(error);
41
+ });
42
+
43
+ // Send the test message
44
+ child.stdin.write(message + '\n');
45
+ child.stdin.end();
46
+ });
47
+ }
48
+
49
+ async function runTests() {
50
+ console.log('๐Ÿš€ Starting MCP Server Tests\n');
51
+
52
+ try {
53
+ // Test 1: List tools
54
+ await testMCPServer(
55
+ '{"jsonrpc":"2.0","id":1,"method":"tools/list"}',
56
+ 'List available tools'
57
+ );
58
+
59
+ // Test 2: Get flood warnings
60
+ await testMCPServer(
61
+ '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_flood_warnings","arguments":{}}}',
62
+ 'Get current flood warnings'
63
+ );
64
+
65
+ // Test 3: Get flood warnings with parameters
66
+ await testMCPServer(
67
+ '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_flood_warnings","arguments":{"min_severity":3}}}',
68
+ 'Get flood warnings with severity filter'
69
+ );
70
+
71
+ // Test 4: Get monitoring stations (limited)
72
+ await testMCPServer(
73
+ '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_monitoring_stations","arguments":{"limit":5}}}',
74
+ 'Get 5 monitoring stations'
75
+ );
76
+
77
+ // Test 5: Get latest readings (limited)
78
+ await testMCPServer(
79
+ '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_readings","arguments":{"latest":true,"limit":5}}}',
80
+ 'Get 5 latest readings'
81
+ );
82
+
83
+ console.log('\nโœ… All tests completed!');
84
+
85
+ } catch (error) {
86
+ console.error('\nโŒ Test failed:', error);
87
+ process.exit(1);
88
+ }
89
+ }
90
+
91
+ runTests();
package/tsconfig.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2022"],
5
+ "module": "ESNext",
6
+ "moduleResolution": "Node",
7
+ "rootDir": "./src",
8
+ "outDir": "./build",
9
+ "strict": true,
10
+ "esModuleInterop": true,
11
+ "skipLibCheck": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "declaration": true,
14
+ "declarationMap": true,
15
+ "sourceMap": true,
16
+ "resolveJsonModule": true,
17
+ "allowSyntheticDefaultImports": true
18
+ },
19
+ "include": ["src/**/*"],
20
+ "exclude": ["node_modules", "build", "**/*.test.ts"]
21
+ }