miadi 1.0.14

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.
Files changed (53) hide show
  1. package/.env.example +28 -0
  2. package/ARCHITECTURE.md +290 -0
  3. package/CLAUDE.md +269 -0
  4. package/GEMINI.md +80 -0
  5. package/MCP_CONNECTOR_READY.md +219 -0
  6. package/MCP_LEARNING_NOTES.md +178 -0
  7. package/MCP_REBUILD_PLAN.md +159 -0
  8. package/MCP_REMOTE_SERVER_SPEC.md +373 -0
  9. package/MIA.md +344 -0
  10. package/MIETTE.md +195 -0
  11. package/README.md +264 -0
  12. package/REMOTE_MCP_TRANSFORMATION_GUIDE.md +384 -0
  13. package/STATUS.md +191 -0
  14. package/TOOL_SELECTION_PLAN.md +340 -0
  15. package/WAKE_UP_SUMMARY.md +102 -0
  16. package/__PUBLISH.sh +1 -0
  17. package/book/_/ledgers/ledger_miadi_mcp_analysis_250730.md +0 -0
  18. package/conversations/2507301433.claude.issue.11.2025-07-30-this-mcp-is-not-working-another-instance-of-yours.txt +756 -0
  19. package/conversations/2507301601.cursor.reverse_engineer_mcp_service_for.md +808 -0
  20. package/conversations/2508050125.llmcon.claude.MIADI_TOOLS-implement-what-is-in-toolselectionplanmd.txt +1235 -0
  21. package/conversations/2508051939.llmcon.claude.issue-14.TransitionToPlanningIT.implement-what-is-in-toolselectionplanmd.txt +1424 -0
  22. package/conversations/2508082352.llmcon.claude.MCP-Remote-Take-II.txt +1658 -0
  23. package/dist/index-remote.js +54736 -0
  24. package/dist/index.js +32363 -0
  25. package/mcp.sample.json +14 -0
  26. package/openapi.yml +2161 -0
  27. package/package.json +56 -0
  28. package/research/MCP_Research_Perplexity_2508060045.md +410 -0
  29. package/samples/README.md +2 -0
  30. package/scripts/ngrokserve.sh +6 -0
  31. package/scripts/start-remote.sh +141 -0
  32. package/scripts/start-with-ngrok.sh +140 -0
  33. package/src/api-client.ts +254 -0
  34. package/src/index-remote.ts +406 -0
  35. package/src/index-simple.ts +232 -0
  36. package/src/index.ts +510 -0
  37. package/src/tool-registry.ts +223 -0
  38. package/src/tools/ai-tools.ts +69 -0
  39. package/src/tools/capability-tools.ts +79 -0
  40. package/src/tools/forge-tools.ts +51 -0
  41. package/src/tools/memory-tools.ts +137 -0
  42. package/src/tools/session-tools.ts +135 -0
  43. package/src/tools/workflow-tools.ts +65 -0
  44. package/src/types.ts +291 -0
  45. package/src/utils.ts +279 -0
  46. package/tests/quick-test.sh +116 -0
  47. package/tests/run-all-tests.sh +167 -0
  48. package/tests/test-agent-capabilities.sh +364 -0
  49. package/tests/test-connectivity.sh +90 -0
  50. package/tests/test-memory-operations.sh +236 -0
  51. package/tests/test-session-management.sh +320 -0
  52. package/tests/test-tool-discovery.sh +151 -0
  53. package/tsconfig.json +24 -0
@@ -0,0 +1,151 @@
1
+ #!/bin/bash
2
+
3
+ # Test 2: Tool Discovery
4
+ # Validates that all expected MCP tools are registered and discoverable
5
+
6
+ set -e
7
+
8
+ # Colors
9
+ RED='\033[0;31m'
10
+ GREEN='\033[0;32m'
11
+ YELLOW='\033[1;33m'
12
+ NC='\033[0m'
13
+
14
+ echo -e "${YELLOW}🔍 Testing MCP Tool Discovery...${NC}"
15
+
16
+ # Expected tools (from the implementation)
17
+ expected_tools=(
18
+ "miadi-get-memory"
19
+ "miadi-store-memory"
20
+ "miadi-update-memory-ttl"
21
+ "miadi-get-memory-meta"
22
+ "miadi-scan-keys"
23
+ "miadi-gather-memory-values"
24
+ "miadi-collect-memory"
25
+ "miadi-view-key-content"
26
+ "miadi-search-cluster"
27
+ "miadi-start-session"
28
+ "miadi-get-current-session"
29
+ "miadi-switch-mode"
30
+ "miadi-switch-persona"
31
+ "miadi-end-session"
32
+ "miadi-list-sessions"
33
+ "miadi-resolve-capabilities"
34
+ "miadi-get-agent-info"
35
+ "miadi-detect-cues"
36
+ "miadi-openai-request"
37
+ "miadi-ai-request"
38
+ "miadi-register-agent"
39
+ "miadi-get-agent-events"
40
+ "miadi-get-workflow-howto"
41
+ "miadi-get-forge-state"
42
+ "miadi-update-forge-state"
43
+ "miadi-get-glyph-map"
44
+ )
45
+
46
+ echo -e "${YELLOW} → Expected ${#expected_tools[@]} tools to be registered${NC}"
47
+
48
+ # Test 1: Check source code for tool registrations
49
+ echo -e "${YELLOW} → Scanning source code for tool registrations...${NC}"
50
+ PROJECT_DIR="$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")"
51
+ SOURCE_FILE="$PROJECT_DIR/src/index.ts"
52
+
53
+ registered_tools=0
54
+ missing_tools=()
55
+
56
+ for tool in "${expected_tools[@]}"; do
57
+ if grep -q "'$tool'" "$SOURCE_FILE"; then
58
+ registered_tools=$((registered_tools + 1))
59
+ echo -e "${GREEN} ✅ $tool${NC}"
60
+ else
61
+ missing_tools+=("$tool")
62
+ echo -e "${RED} ❌ $tool${NC}"
63
+ fi
64
+ done
65
+
66
+ echo ""
67
+ echo -e "${YELLOW} 📊 Registration Summary:${NC}"
68
+ echo -e "${GREEN} ✅ Registered: $registered_tools/${#expected_tools[@]}${NC}"
69
+
70
+ if [ ${#missing_tools[@]} -gt 0 ]; then
71
+ echo -e "${RED} ❌ Missing: ${#missing_tools[@]}${NC}"
72
+ echo -e "${RED} Missing tools: ${missing_tools[*]}${NC}"
73
+ exit 1
74
+ fi
75
+
76
+ # Test 2: Check for proper Zod schema implementations
77
+ echo -e "${YELLOW} → Checking Zod schema implementations...${NC}"
78
+ tools_with_schemas=0
79
+ tools_with_todos=0
80
+
81
+ for tool in "${expected_tools[@]}"; do
82
+ if grep -A5 "'$tool'" "$SOURCE_FILE" | grep -q "z\."; then
83
+ tools_with_schemas=$((tools_with_schemas + 1))
84
+ elif grep -A3 "'$tool'" "$SOURCE_FILE" | grep -q "TODO.*Zod"; then
85
+ tools_with_todos=$((tools_with_todos + 1))
86
+ fi
87
+ done
88
+
89
+ echo -e "${GREEN} ✅ Tools with Zod schemas: $tools_with_schemas${NC}"
90
+ echo -e "${YELLOW} ⏳ Tools with TODO schemas: $tools_with_todos${NC}"
91
+
92
+ # Test 3: Verify tool descriptions are meaningful
93
+ echo -e "${YELLOW} → Validating tool descriptions...${NC}"
94
+ tools_with_descriptions=0
95
+
96
+ for tool in "${expected_tools[@]}"; do
97
+ if grep -A1 "'$tool'" "$SOURCE_FILE" | grep -q "'.*'"; then
98
+ tools_with_descriptions=$((tools_with_descriptions + 1))
99
+ fi
100
+ done
101
+
102
+ echo -e "${GREEN} ✅ Tools with descriptions: $tools_with_descriptions/${#expected_tools[@]}${NC}"
103
+
104
+ # Test 4: Check for proper async function handlers
105
+ echo -e "${YELLOW} → Checking async function handlers...${NC}"
106
+ tools_with_async=0
107
+
108
+ for tool in "${expected_tools[@]}"; do
109
+ if grep -A10 "'$tool'" "$SOURCE_FILE" | grep -q "async.*args"; then
110
+ tools_with_async=$((tools_with_async + 1))
111
+ fi
112
+ done
113
+
114
+ echo -e "${GREEN} ✅ Tools with async handlers: $tools_with_async/${#expected_tools[@]}${NC}"
115
+
116
+ # Test 5: Verify tool implementation calls correct modules
117
+ echo -e "${YELLOW} → Verifying tool module mappings...${NC}"
118
+
119
+ # Check memory tools
120
+ memory_tools=(
121
+ "miadi-get-memory"
122
+ "miadi-store-memory"
123
+ "miadi-scan-keys"
124
+ "miadi-collect-memory"
125
+ )
126
+
127
+ for tool in "${memory_tools[@]}"; do
128
+ if grep -A15 "'$tool'" "$SOURCE_FILE" | grep -q "memoryTools\."; then
129
+ echo -e "${GREEN} ✅ $tool → memoryTools${NC}"
130
+ else
131
+ echo -e "${RED} ❌ $tool → missing memoryTools call${NC}"
132
+ fi
133
+ done
134
+
135
+ # Check session tools
136
+ session_tools=(
137
+ "miadi-start-session"
138
+ "miadi-get-current-session"
139
+ "miadi-switch-mode"
140
+ )
141
+
142
+ for tool in "${session_tools[@]}"; do
143
+ if grep -A15 "'$tool'" "$SOURCE_FILE" | grep -q "sessionTools\."; then
144
+ echo -e "${GREEN} ✅ $tool → sessionTools${NC}"
145
+ else
146
+ echo -e "${RED} ❌ $tool → missing sessionTools call${NC}"
147
+ fi
148
+ done
149
+
150
+ echo ""
151
+ echo -e "${GREEN}🔍 Tool discovery tests completed${NC}"
package/tsconfig.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "commonjs",
5
+ "lib": ["ES2020"],
6
+ "outDir": "./dist",
7
+ "rootDir": "./src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "resolveJsonModule": true,
13
+ "declaration": true,
14
+ "declarationMap": true,
15
+ "sourceMap": true
16
+ },
17
+ "include": [
18
+ "src/**/*"
19
+ ],
20
+ "exclude": [
21
+ "node_modules",
22
+ "dist"
23
+ ]
24
+ }