This project is a lightweight graph-powered API that models people, locations, and their relationships using Neo4j and exposes endpoints via an Express.js server. Additionally, it supports natural-language interactions and automation through a FastMCP-based tool interface.
- Visiting New York? Instantly find out who you know in the city.
- Need a referral? Discover how you're connected to someone in your network graph (e.g., "How is Dave connected to Alice?").
- Manage connections: Add, update, or delete people, relationships, and locations.
- AI Automation: Search, modify, or explain graph paths via FastMCP tools (usable in LLMs like GPT).
| Component | Description |
|---|---|
| Node.js | Backend runtime |
| Express.js | RESTful API framework |
| Neo4j | Graph database for relationships |
| Cypher | Query language for graph traversal |
| FastMCP | Python-based tool framework for agent use |
| Jest | Testing suite for API endpoints |
git clone https://github.com/yourusername/neo4j-api-server.git
cd neo4j-api-servercp .env.example .envUpdate .env with your Neo4j credentials:
NEO4J_URI=bolt://localhost:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=your_passwordMake sure Neo4j is running and listening on that URI.
npm installnpm startRuns on http://localhost:3000
cd fast-mcp
uv pip install -r requirements.txtRun the FastMCP server:
uvicorn server:app --reloadThis exposes tools like
search_people,modify_graph, andexplain_relationshipto AI agents via MCP protocol.
neo4j-api-server/
├── index.js # Main Express server
├── .env # Environment variables
├── fast-mcp/ # FastMCP Python tool server
│ ├── server.py # All @mcp.tool functions live here
│ └── __pycache__/ # Python bytecode (auto)
├── __tests__/ # Jest-based API tests
├── package.json # Node.js dependencies
└── README.md # You're reading it!
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /people |
List all people |
| GET | /people/:name |
Get person by name |
| POST | /people |
Create a new person |
| PATCH | /people/:name |
Update person's info |
| DELETE | /people/:name |
Delete person + relationships |
| POST | /relationships/friend |
Add a bidirectional friendship |
| POST | /relationships/father |
Link father to child |
| POST | /relationships/lives-in |
Link person to a location |
| GET | /people/:name/friends |
List a person's friends |
| GET | /people/:name/location |
Get where a person lives |
| GET | /location/:name/people |
People in a given location |
| GET | /path/:from/:to |
Get raw path between two people |
| GET | /relationship/explain |
Human-readable explanation |
npm testRuns tests from the __tests__ folder using jest.
- Add people: Alice, Bob, Dave, Carol
- Create relationships:
- Alice → FRIEND_OF → Bob
- Dave → FRIEND_OF → Carol
- Bob → FATHER_OF → Carol
- Add location nodes: New York, San Francisco
- Use
/location/New York/peopleto find who’s there - Use
/relationship/explain?from=Dave&to=Aliceto trace the referral path
| Tool Name | Description |
|---|---|
search_people |
Find people by name, city, etc. |
modify_graph |
Add or delete people and relationships |
explain_relationship |
Explain how two people are connected |
Make sure your .gitignore includes:
.env
.venv/
fast-mcp/__pycache__/
node_modules/
Made by Sai Shashank Kudkuli Built for demos, prototyping, and experimentation.
Open an issue or ping me if something breaks or you want to contribute ideas.