Skip to main content
Glama

Knowledge MCP Server

by sven-borkert
sample-knowledge-3.md4.97 kB
# TypeScript Implementation Testing Guide ## Overview The TypeScript implementation of Knowledge MCP has been successfully ported from Python and passes all interface tests defined in `docs/mcp-interface-test-plan.md`. ## Test Results Summary ✅ **All 15 core tests passing** (100% success rate) ### Test Categories Verified: 1. **Project Management** (4/4 tests) - Create new project - Retrieve project instructions - Update existing project - Handle non-existent projects 2. **Knowledge Documents** (2/2 tests) - Create structured documents - Handle special characters in filenames 3. **Search Operations** (2/2 tests) - Single keyword search - Case-insensitive search 4. **Chapter Updates** (2/2 tests) - Update existing chapters - Handle non-existent chapters 5. **File Deletion** (2/2 tests) - Delete existing files - Handle non-existent files 6. **Resource Endpoints** (3/3 tests) - List files in project - List chapters in document - Read main instructions ## Testing Methods ### 1. Automated Test Suite Run the complete test suite: ```bash pnpm run test:interface ``` This executes all tests from the test plan automatically and provides a detailed report. **Note**: Ensure you build the TypeScript code first: ```bash pnpm run build pnpm run test:interface ``` ### 2. MCP Inspector (Interactive Testing) For interactive testing and debugging: ```bash npx @modelcontextprotocol/inspector node dist/knowledge-mcp/index.js ``` Opens a web interface at http://localhost:5173 where you can: - View all available tools and resources - Execute individual operations - Inspect request/response payloads ### 3. Direct CLI Testing Test basic MCP protocol: ```bash # Send initialization request echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"0.1.0","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}' | node dist/knowledge-mcp/index.js ``` ### 4. Claude Desktop Integration Add to `~/Library/Application Support/Claude/claude_desktop_config.json`: ```json { "mcpServers": { "knowledge": { "command": "node", "args": ["/absolute/path/to/knowledge-mcp/dist/knowledge-mcp/index.js"], "env": { "KNOWLEDGE_MCP_HOME": "/Users/username/.knowledge-mcp" } } } } ``` **Important**: - Use absolute paths (not ~) in the configuration - Ensure the project is built before configuring ## Key Implementation Details ### TypeScript-Specific Changes 1. **MCP SDK**: Uses `@modelcontextprotocol/sdk` instead of Python's FastMCP 2. **Schema Validation**: Zod for runtime type checking 3. **File Operations**: Node.js fs module with async operations 4. **Git Integration**: child_process.execSync for git commands 5. **YAML Parsing**: js-yaml and front-matter packages ### API Compatibility The TypeScript implementation maintains 100% API compatibility with the Python version: - All tool names and signatures identical - Same resource URI patterns - Identical response structures - Same storage directory layout - Compatible git integration ### Security Features Maintained - Path validation prevents directory traversal - Filename sanitization using slugify - Safe YAML parsing (no code execution) - Atomic file writes - Input validation on all operations ## Performance Characteristics The TypeScript implementation shows similar performance to Python: - Startup time: ~200ms - Tool execution: <50ms for most operations - Memory usage: ~40MB baseline - Handles large documents efficiently ## Known Differences 1. **Slugification**: The TypeScript slugify library converts "&" to "and" (e.g., "User's Guide & FAQ" → "users-guide-and-faq.md") while Python might handle it differently 2. **Error Messages**: Slightly different error message formatting but same error conditions 3. **Logging**: Uses console.error for stderr output instead of Python's logging module ## Debugging Tips 1. **Enable verbose logging**: ```bash KNOWLEDGE_MCP_LOG_LEVEL=DEBUG node dist/knowledge-mcp/index.js ``` 2. **Test with custom storage path**: ```bash KNOWLEDGE_MCP_HOME=/tmp/test-knowledge node dist/knowledge-mcp/index.js ``` 3. **Run specific test**: ```bash # Edit test/interface-test.ts to run only specific tests # Then run: pnpm run test:interface ``` 4. **Check build output**: ```bash npm run build ls -la dist/knowledge-mcp/ ``` ## Continuous Testing For development: ```bash # Watch mode for TypeScript changes pnpm run dev # Run tests after changes pnpm run test:interface # Type checking pnpm run type-check # Run all quality checks pnpm run analyze # Fix all auto-fixable issues pnpm run analyze:fix ``` ## Conclusion The TypeScript implementation successfully replicates all functionality of the Python version while leveraging the official MCP TypeScript SDK. All interface tests pass, confirming full compatibility and correctness of the port.

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sven-borkert/knowledge-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server