Graph knowledge based Afrikaans tutor
# π― Afrikaans Agent MCP Server
A node-based FastAPI server that exposes a custom MCP (Model Context Protocol) server over SSE for ElevenLabs agents to query a Neo4j knowledge graph.
## π Node Pipeline Flow
Like Blender GeoNodes, each function is a node in the pipeline:
```
[Input] β [Tool Node] β [Cypher Query Node] β [Output Stream]
```
### Node Breakdown:
- **[Input Node]**: Receives queries from ElevenLabs agent
- **[Tool Node]**: Defines MCP tool schema for ElevenLabs
- **[Cypher Query Node]**: Converts natural language to Neo4j queries
- **[Output Stream Node]**: Streams results via Server-Sent Events (SSE)
## π Quick Start
### 1. Install Dependencies
```bash
pip install -r requirements.txt
```
### 2. Configure Neo4j Connection
Edit `main.py` and uncomment the Neo4j connection in the `startup_event()` function:
```python
neo4j_node = Neo4jNode("bolt://localhost:7687", "neo4j", "your_password")
```
### 3. Start the Server
```bash
uvicorn main:app --reload --host 0.0.0.0 --port 8000
```
### 4. Test the Pipeline
```bash
python test_client.py
```
## π‘ API Endpoints
### Health Check
```bash
GET /health
```
### MCP Tools Registration
```bash
GET /tools
```
### Query Knowledge Graph (SSE Stream)
```bash
POST /query
Content-Type: application/json
{
"query_type": "vocabulary",
"topic": "hello",
"difficulty": "beginner"
}
```
## π οΈ MCP Tool Schema
The server exposes one tool for ElevenLabs:
```json
{
"name": "query_afrikaans_knowledge_graph",
"description": "Query the Afrikaans knowledge graph for educational content",
"inputSchema": {
"type": "object",
"properties": {
"query_type": {
"type": "string",
"enum": ["vocabulary", "story", "culture", "grammar", "general"]
},
"topic": {
"type": "string",
"description": "Specific topic or question"
},
"difficulty": {
"type": "string",
"enum": ["beginner", "intermediate", "advanced"],
"default": "beginner"
}
}
}
}
```
## ποΈ Neo4j Schema
Expected node types in your Neo4j database:
- **Word**: `{afrikaans, eng β¦