frappe-mcp-server
Version:
Enhanced Model Context Protocol server for Frappe Framework with comprehensive API instructions and helper tools
147 lines (112 loc) • 2.86 kB
Markdown
This guide covers all testing approaches for the Frappe MCP server.
Tests the complete MCP protocol implementation using the official MCP client.
```bash
npm run test-mcp
```
Features:
- Tests all 20 MCP tools
- Validates MCP protocol compliance
- Uses stdio transport
- Mock Frappe credentials
Tests the HTTP transport implementation.
```bash
npm run start-http
npm run test-http
```
Tests:
- Health check endpoint
- Server info endpoint
- Tool listing
- Tool execution via HTTP
- Error handling
Tests against a real Frappe instance with actual credentials.
```bash
FRAPPE_URL=https://epinomy.com \
FRAPPE_API_KEY=ff09790d111aeab \
FRAPPE_API_SECRET=d3bc10957fd898f \
npm run test-real
```
Features:
- Real API calls to Frappe
- Validates actual data
- Tests all tool categories
- Performance benchmarks
Simple verification scripts for quick testing.
```bash
node quick-test.js
node simple-test.js
```
Create a `test-config.env` file (gitignored) with:
```env
FRAPPE_URL=https://your-frappe-instance.com
FRAPPE_API_KEY=your-api-key
FRAPPE_API_SECRET=your-api-secret
```
HTTP server runs on port 51966 (0xCAFE) by default. Override with:
```bash
PORT=8080 npm run start-http
```
```bash
npm run build
npm run test-mcp && npm run test-http && npm run test-real
```
```bash
DEBUG=* npm run test-real
```
Modify test files to focus on specific tools:
```javascript
// In test file
const tests = [
() => this.testPing(), // Only test ping
];
```
Add new test methods in `test-mcp-protocol.ts`:
```typescript
async testNewFeature() {
const response = await this.client.callTool('new_tool', {
param: 'value'
});
// Validate response
}
```
Add to `test-http-server.js`:
```javascript
async testNewEndpoint() {
const response = await axios.get(`${this.baseUrl}/new-endpoint`);
// Validate response
}
```
- Ensure server is built: `npm run build`
- Check correct port is used
- Verify credentials are set
- Verify API key/secret are correct
- Check Frappe instance is accessible
- Ensure user has required permissions
- Increase timeout values in test files
- Check network connectivity
- Verify Frappe server performance