loading…
Search for a command to run...
loading…
Enables semantic search over TwinCAT 3 documentation using natural language queries, with intelligent caching for fast results.
Enables semantic search over TwinCAT 3 documentation using natural language queries, with intelligent caching for fast results.
A Model Context Protocol (MCP) server providing semantic search access to TwinCAT 3 documentation. This project includes tools for converting PDFs to Markdown, generating embeddings, and hosting a searchable API on GitHub Pages.
This project provides a complete semantic search solution for TwinCAT 3 documentation:
[Generate Embeddings] → Push to GitHub
↓
[GitHub Pages] → Transformers.js API
↓
[Local MCP Server] → Returns to Cursor/LM Studio
git clone https://github.com/njfsmallet-eng/twincat-knowledge-mcp-server.git
cd twincat-knowledge-mcp-server
npm install
npm run build
This compiles TypeScript to JavaScript in the dist/ directory. The dist/ folder is not tracked in git, so you need to build after cloning.
Note: You only need to rebuild if you modify the source code. The compiled dist/ files are not committed to git.
mcp.json:Option A: Using compiled CommonJS (Recommended)
{
"mcpServers": {
"twincat-knowledge": {
"command": "node",
"args": ["C:\\Users\\YourUsername\\path\\to\\twincat-knowledge-mcp-server\\dist\\index.js"],
"env": {}
}
}
}
Option B: Using TypeScript directly
{
"mcpServers": {
"twincat-knowledge": {
"command": "npx",
"args": ["-y", "tsx", "C:\\Users\\YourUsername\\path\\to\\twincat-knowledge-mcp-server\\src\\index.ts"],
"env": {}
}
}
}
Note: Replace the path with your actual repository location. Use double backslashes (\\) for Windows paths.
The configuration works identically across all compatible platforms:
mcp.json file in your user directory (typically C:\Users\YourUsername\.cursor\mcp.json on Windows)Both platforms support the standard MCP stdio protocol used by this server.
Once configured in Cursor or LM Studio, use the search_knowledge tool:
"Describe what TwinCAT Scope is and its main features."
Available filters:
category: Communication, PLC, Motion_Control, etc.product: TF6100, TC3, TE1000, etc.top_k: Number of results (default: 5)The MCP server includes an intelligent caching system that dramatically improves performance:
.cache/ directory in project rootCache contents:
You can test the search functionality directly in your browser at: https://njfsmallet-eng.github.io/twincat-knowledge-mcp-server/
This web interface allows you to:
twincat-knowledge-mcp-server/
├── src/ # TypeScript source
│ ├── index.ts # MCP server
│ ├── types.ts # Type definitions
│ ├── github-pages-client.ts # API client
│ └── cache-manager.ts # Cache management
├── dist/ # Compiled JavaScript (CommonJS)
│ ├── index.js # Compiled MCP server
│ └── *.js # Other compiled files
├── scripts/ # Python scripts
│ ├── chunking.py # Text chunking
│ ├── generate_embeddings.py # Embedding generation
│ └── README.md # Scripts documentation
├── gh-pages/ # GitHub Pages files
│ ├── index.html # API interface
│ └── search.js # Transformers.js search
├── embeddings/ # Generated embeddings
│ ├── chunks.json # Chunks with metadata
│ ├── embeddings.npy.gz # Compressed vectors
│ └── metadata.json # Generation stats
├── docs/ # Converted markdown docs
├── .cache/ # Persistent cache (auto-created)
│ ├── chunks.json # Cached documentation chunks
│ ├── embeddings.npy.gz # Cached embeddings
│ └── model/ # Xenova model cache
│ └── Xenova/
│ └── all-MiniLM-L6-v2/
├── .github/workflows/ # CI/CD
│ └── deploy-pages.yml # GitHub Pages deployment
├── package.json # Node.js config
├── tsconfig.json # TypeScript config
└── requirements.txt # Python dependencies
Python (for embedding generation only):
sentence-transformers - Transformer models for embeddingstorch - PyTorchnumpy - Numerical operationspyyaml - YAML parsingtqdm - Progress barsNote: Python dependencies are only needed to generate embeddings. The MCP server itself requires only Node.js.
Node.js:
@modelcontextprotocol/sdk - MCP protocol@xenova/transformers - Transformers.js for embeddingstypescript - TypeScript compiler (for building)The project compiles TypeScript to CommonJS for optimal Node.js compatibility.
sentence-transformers/all-MiniLM-L6-v2 (384 dimensions)Xenova/all-MiniLM-L6-v2 ONNX (quantized)npx tsc to compile TypeScript to CommonJS in dist/ directoryMIT License
Выполни в терминале:
claude mcp add twincat-knowledge-mcp-server -- npx Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.