MCP Server
Connect Claude Desktop, Cursor, Windsurf, and other AI tools directly to your NaijaBase database.
Ask Claude in plain English:
"List all my tables"
"Query the orders table where status is pending"
"Insert a new product"
"What is my database size?"
Install
npm install -g @naijabase/mcp-server
Or use directly with npx (no install needed):
npx @naijabase/mcp-server
Setup — Claude Desktop
Install Claude Desktop from claude.ai/download — not the Microsoft Store version. The Store version runs in a sandbox that prevents MCP servers from loading. If you installed from the Store, uninstall it and reinstall from claude.ai/download.
Add to your Claude Desktop config file:
Mac:
~/Library/Application Support/Claude/claude_desktop_config.json
Windows (.exe installer):
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"naijabase": {
"command": "npx",
"args": ["-y", "@naijabase/mcp-server"],
"env": {
"NAIJABASE_SERVICE_KEY": "nb_service_xxx",
"NAIJABASE_PROJECT_ID": "your-project-id"
}
}
}
}
Restart Claude Desktop after saving. Look for the hammer icon (🔨) in the chat input — that confirms MCP is active.
Setup — Cursor
Add to .cursor/mcp.json in your project root:
{
"mcpServers": {
"naijabase": {
"command": "npx",
"args": ["-y", "@naijabase/mcp-server"],
"env": {
"NAIJABASE_SERVICE_KEY": "nb_service_xxx",
"NAIJABASE_PROJECT_ID": "your-project-id"
}
}
}
}
Setup — Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"naijabase": {
"command": "npx",
"args": ["-y", "@naijabase/mcp-server"],
"env": {
"NAIJABASE_SERVICE_KEY": "nb_service_xxx",
"NAIJABASE_PROJECT_ID": "your-project-id"
}
}
}
}
Where to find your credentials
Go to app.naijabase.dev → your project → API tab.
Project ID: shown in the API tab
Service Key: starts with nb_service_
click the eye icon to reveal
Never put your service key in browser or client-side code — it bypasses Row Level Security and gives full database access. Use it only in server-side environments and MCP config files.
Available tools
Data tools — service key only
| Tool | What it does |
|---|---|
list_tables | List all tables in your project |
query_table | SELECT with filters, ordering, pagination |
insert_row | INSERT one or many rows |
update_row | UPDATE rows matching a filter |
delete_row | DELETE rows matching a filter |
Admin tools — API token required
| Tool | What it does |
|---|---|
run_sql | Execute raw SQL |
list_projects | List all your projects |
get_project | Project details and API keys |
create_project | Create a new project |
list_functions | List edge functions |
deploy_function | Deploy an edge function |
get_logs | Edge function execution logs |
get_usage | DB size, requests, storage stats |
To get your API token for admin tools, open app.naijabase.dev in Chrome, press F12 → Console, then run:
localStorage.getItem('nb_token')
Add the result to your MCP config env:
"NAIJABASE_API_TOKEN": "token-from-console"
Example prompts
Once connected, ask Claude:
"Show me all tables in my NaijaBase project"
"Query the orders table where status is pending and return the last 10 results"
"Insert a new row into products: name=Ankara Shirt, price=15000, category=fashion"
"How many users signed up this week?"
"What is my current database size?"
"Deploy this edge function..."
"Show me my API usage for the last 30 days"
Troubleshooting
Hammer icon not showing in Claude Desktop
You likely have the Microsoft Store version of Claude Desktop installed. Uninstall it, then install from claude.ai/download. The Store version runs in a sandbox that blocks MCP servers entirely.
NAIJABASE_SERVICE_KEY is required error
Environment variables are not reaching the MCP server. Make sure your config uses the -y flag with npx:
"command": "npx",
"args": ["-y", "@naijabase/mcp-server"]
Tools not appearing after restart
Fully quit Claude Desktop before restarting — closing the window is not enough.
- Windows: Task Manager → find Claude → End Task, then reopen
- Mac: Claude menu → Quit Claude, then reopen
Package info
- npm: npmjs.com/package/@naijabase/mcp-server
- Version: 1.0.1
- License: MIT