Open registry for autonomous agents with REST API and web interface.
NANDA Index is a lightweight registry system for autonomous agents. It provides a web interface for browsing agents and a REST API for programmatic access. The system supports Google OAuth authentication and implements full CRUD operations with ownership controls.
- REST API for agent management
- Google OAuth 2.0 authentication
- Web interface for agent browsing
- MongoDB data persistence
- Owner-based access controls
- Real-time agent statistics
- Node.js 16+
- MongoDB Atlas account
- Google Cloud Console project with OAuth 2.0 credentials
- Clone the repository:
git clone https://github.com/aidecentralized/nanda-index.git
cd nanda-index- Install dependencies:
npm install- Configure environment variables:
cp .env.example .envEdit .env with your credentials:
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
SESSION_SECRET=your_random_session_secret
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/
PORT=3000
- Start the server:
npm starthttp://localhost:3000
Authentication is required for create, update, and delete operations. The API uses session-based authentication via Google OAuth 2.0.
GET /auth/google- Initiate Google OAuth flowGET /auth/google/callback- OAuth callback (redirect)GET /auth/logout- Sign out userGET /api/user- Get current user session
GET /api/agentsResponse:
[
{
"_id": "507f1f77bcf86cd799439011",
"username": "alice",
"agent_facts_link": "https://example.com/alice.json",
"created_at": "2024-01-15T10:30:00.000Z",
"updated_at": "2024-01-15T10:30:00.000Z",
"source_agent_id": "agent-abc123-xyz789",
"source_user_id": "google_user_id",
"created_by_email": "alice@example.com"
}
]POST /api/agents
Content-Type: application/jsonRequest Body:
{
"username": "alice",
"agent_facts_link": "https://example.com/alice.json"
}Response:
{
"_id": "507f1f77bcf86cd799439011",
"username": "alice",
"agent_facts_link": "https://example.com/alice.json",
"created_at": "2024-01-15T10:30:00.000Z",
"source_agent_id": "agent-abc123-xyz789",
"source_user_id": "google_user_id",
"created_by_email": "alice@example.com"
}Error Response:
{
"error": "Username already exists"
}PUT /api/agents/:id
Content-Type: application/jsonRequest Body:
{
"username": "alice_updated",
"agent_facts_link": "https://example.com/alice_v2.json"
}Response:
{
"message": "Agent updated successfully"
}DELETE /api/agents/:idResponse:
{
"message": "Agent deleted successfully"
}All endpoints return appropriate HTTP status codes:
200- Success400- Bad Request (validation errors)401- Unauthorized (authentication required)403- Forbidden (insufficient permissions)404- Not Found500- Internal Server Error
Error responses include descriptive messages:
{
"error": "Authentication required"
}List agents:
curl http://localhost:3000/api/agentsCreate agent (requires authentication via web interface first):
curl -X POST http://localhost:3000/api/agents \
-H "Content-Type: application/json" \
-d '{"username":"testbot","agent_facts_link":"https://example.com/test.json"}' \
--cookie "session_cookie_from_browser"Update agent:
curl -X PUT http://localhost:3000/api/agents/507f1f77bcf86cd799439011 \
-H "Content-Type: application/json" \
-d '{"username":"testbot_v2","agent_facts_link":"https://example.com/test_v2.json"}' \
--cookie "session_cookie_from_browser"Delete agent:
curl -X DELETE http://localhost:3000/api/agents/507f1f77bcf86cd799439011 \
--cookie "session_cookie_from_browser"const fetch = require('node-fetch');
// List all agents
async function listAgents() {
const response = await fetch('http://localhost:3000/api/agents');
const agents = await response.json();
console.log(agents);
}
// Note: Create, update, delete require authentication
// Use the web interface to authenticate first{
"_id": "ObjectId",
"username": "string (unique)",
"agent_facts_link": "string (URL)",
"created_at": "ISO 8601 string",
"updated_at": "ISO 8601 string",
"source_agent_id": "string (auto-generated)",
"source_user_id": "string (Google user ID)",
"created_by_email": "string"
}username: Required, unique, alphanumeric characters and underscores onlyagent_facts_link: Required, valid URL format- Authentication required for create, update, delete operations
- Users can only modify agents they created
- Connect your GitHub repository to Railway
- Set environment variables in Railway dashboard
- Deploy automatically on push
FROM node:16-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "start"]├── server.js # Express server and API routes
├── public/
│ └── index.html # Web interface
├── package.json # Dependencies and scripts
├── .env.example # Environment template
└── README.md # Documentation
- Fork the repository
- Create a feature branch
- Implement changes with tests
- Submit a pull request
MIT License
For issues and feature requests, please use the GitHub issues page.