TESTING.md•2.17 kB
# Testing Guide for MCP Server
## Prerequisites
- Server must be running: `npm run start`
- For GitHub tool: Ensure `.env` file has `GITHUB_PERSONAL_ACCESS_TOKEN` set
## Quick Tests
### 1. Check Server Status
```bash
curl http://localhost:3001/mcp/status
```
Expected: `{"status":"OK","tools":["mark_attendance","commit_changes"]}`
### 2. List Available Tools
```bash
curl -X POST http://localhost:3001/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1
}'
```
### 3. Test mark_attendance Tool
```bash
curl -X POST http://localhost:3001/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "mark_attendance",
"arguments": {
"studentId": "12345",
"date": "2024-01-15",
"status": "present"
}
},
"id": 2
}'
```
Expected response:
```json
{
"jsonrpc": "2.0",
"result": {
"content": [
{
"type": "text",
"text": "Attendance for 12345 on 2024-01-15: present"
}
]
},
"id": 2
}
```
### 4. Test commit_changes Tool
```bash
curl -X POST http://localhost:3001/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "commit_changes",
"arguments": {
"repoOwner": "your-github-username",
"repoName": "your-repo-name",
"branchName": "main",
"commitMessage": "Test commit from MCP",
"filesToCommit": [
{
"path": "test.txt",
"content": "Hello from MCP server!"
}
]
}
},
"id": 3
}'
```
**Note:** Replace `your-github-username` and `your-repo-name` with actual values. The repository must exist and your token must have write access.
## Using the Test Script
Run the automated test script:
```bash
./test-tools.sh
```
(Requires `jq` for JSON formatting: `sudo apt install jq`)
## Testing with Codex
1. Ensure server is running
2. Configure codex to connect to: `http://localhost:3001/mcp`
3. Codex should be able to discover and call both tools