Mnemonica Strategy
An MCP server that connects to running Node.js applications via the Chrome Debug Protocol to analyze Mnemonica type hierarchies at runtime. It enables users to validate and improve static analysis by comparing runtime types with Tactica-generated types.
README
@mnemonica/strategy
MCP (Model Context Protocol) server for Mnemonica runtime analysis via Chrome Debug Protocol.
Overview
Strategy connects to running Node.js applications via Chrome Debug Protocol to extract and analyze Mnemonica type hierarchies. It compares runtime types with Tactica-generated types to validate and improve static analysis.
Installation
npm install @mnemonica/strategy
Usage
Prerequisites
Your target application must be running with the debug flag:
# For NestJS
nest start --debug --watch
# For regular Node.js
node --inspect=9229 your-app.js
As MCP Server
npx @mnemonica/strategy
Configure with Roo Code
Add to .roo/mcp.json:
{
"mcpServers": {
"mnemonica-strategy": {
"command": "node",
"args": ["/code/mnemonica/strategy/lib/cli.js"]
}
}
}
MCP Tools Provided
The Strategy MCP server exposes 3 bundled tools:
1. execute
Execute any command from the 3 context folders (MCP, RPC, RUN).
Input:
context(string, required): Execution context - "MCP", "RPC", or "RUN"command(string, required): Command name to executemessage(string, optional): JSON string containing command arguments
Example:
// Connect to NestJS debugger
execute {
context: "RPC",
command: "connection",
message: "{ \"action\": \"connect\", \"host\": \"localhost\", \"port\": 9229 }"
}
// Check connection status
execute {
context: "RPC",
command: "connection",
message: "{ \"action\": \"status\" }"
}
// Get runtime types
execute {
context: "RPC",
command: "get_runtime_types",
message: "{}"
}
2. list
List available commands by context.
Input:
context(string, required): "MCP", "RPC", "RUN", or "ALL"
Example:
list { context: "ALL" }
3. help
Get detailed help for any command.
Input:
context(string, required): Command contextcommand(string, required): Command name
Example:
help { context: "RPC", command: "connection" }
Args Passing Mechanism (IMPORTANT)
Due to MCP protocol limitations, command arguments must be passed as a JSON string in the message field, not as direct object properties.
Correct format:
execute {
context: "RPC",
command: "connection",
message: "{ \"action\": \"connect\", \"host\": \"localhost\", \"port\": 9229 }"
}
Incorrect format (will not work):
// DON'T DO THIS
execute {
context: "RPC",
command: "connection",
args: { action: "connect" } // This won't work!
}
Common Commands
Connection Management
// Connect to Node.js debugger
execute {
context: "RPC",
command: "connection",
message: "{ \"action\": \"connect\", \"host\": \"localhost\", \"port\": 9229 }"
}
// Check connection status
execute {
context: "RPC",
command: "connection",
message: "{ \"action\": \"status\" }"
}
// Disconnect from runtime
execute {
context: "RPC",
command: "connection",
message: "{ \"action\": \"disconnect\" }"
}
Type Analysis
// Get runtime types from connected application
execute {
context: "RPC",
command: "get_runtime_types",
message: "{}"
}
// Analyze type hierarchy
execute {
context: "RPC",
command: "analyze_type_hierarchy",
message: "{}"
}
// Load Tactica-generated types
execute {
context: "MCP",
command: "load_remote_tactica_types",
message: "{ \"projectPath\": \"/path/to/project\" }"
}
// Compare runtime vs Tactica types
execute {
context: "MCP",
command: "compare_with_tactica",
message: "{ \"projectPath\": \"/path/to/project\" }"
}
Memory Management
// Store memory in connected runtime
execute {
context: "RPC",
command: "store_memory",
message: "{ \"key\": \"myKey\", \"data\": { ... } }"
}
// Recall memories
execute {
context: "RPC",
command: "recall_memories",
message: "{ \"key\": \"myKey\" }"
}
Example Workflow
-
Start your application with debug mode:
cd tactica-examples/nestjs npm run start:debug -
Connect to the debugger:
execute { context: "RPC", command: "connection", message: "{ \"action\": \"connect\" }" } -
Analyze runtime types:
execute { context: "RPC", command: "get_runtime_types", message: "{}" } -
Compare with Tactica-generated types:
execute { context: "MCP", command: "compare_with_tactica", message: "{ \"projectPath\": \"/path/to/project\" }" }
Command Contexts
| Context | Folder | Execution Environment |
|---|---|---|
| MCP | commands-mcp/ |
Local MCP server process |
| RPC | commands-remote/ |
Remote via CDP in target Node.js |
| RUN | commands-run/ |
HTTP endpoint in VS Code |
Development
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run watch
# Test
npm run test
Creating Commands
Commands are JavaScript files in the commands-*/ folders with MCP Tool Metadata:
/**
* MCP Tool Metadata:
* {
* "name": "my_command",
* "description": "What this command does",
* "inputSchema": {
* "type": "object",
* "properties": {
* "argName": { "type": "string" }
* }
* }
* }
*/
var { require, args, store } = ctx;
// Parse message if present
var commandArgs = args;
if (args.message && typeof args.message === 'string') {
try {
commandArgs = JSON.parse(args.message);
} catch (e) {
return { success: false, error: 'Invalid JSON: ' + e.message };
}
}
// Access parsed arguments
var myArg = commandArgs.argName;
// Return result
return { success: true, data: { ... } };
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.