Content
# Camera DB MCP Server
An MCP (Model Context Protocol) server for querying a database of CCTV camera information. This server provides tools to search, filter, and retrieve camera details from a dataset of 10,000 cameras stored in memory.
## Features
- **10,000 Sample Cameras**: Pre-loaded with randomly generated camera data
- **Rich Camera Data**: Each camera includes:
- Camera ID, Name, Model
- Manufacturer
- IP Address, MAC Address
- Firmware Version
- Location, Type
- Install Date, Warranty Date
- Status (active/inactive/maintenance)
## Available Tools
### `get_camera`
Get details of a specific camera by ID.
**Parameters:**
- `cameraId` (string, required): The camera ID (e.g., "CAM-000001")
### `search_cameras`
Search cameras by various criteria with pagination support.
**Parameters:**
- `search` (string, optional): Search term matching name, model, manufacturer, location, IP, or MAC
- `manufacturer` (string, optional): Filter by manufacturer
- `type` (string, optional): Filter by camera type (Dome, Bullet, PTZ, Box, Fisheye, Thermal, IP, Analog)
- `location` (string, optional): Filter by location
- `status` (string, optional): Filter by status (active, inactive, maintenance)
- `limit` (number, optional): Maximum results (default: 100)
- `offset` (number, optional): Pagination offset (default: 0)
### `get_camera_stats`
Get overall statistics about the camera database including counts by manufacturer, type, and status.
### `list_manufacturers`
List all unique manufacturers in the database.
### `list_locations`
List all unique locations in the database.
## Installation
1. Install dependencies:
```bash
npm install
```
2. Build the project:
```bash
npm run build
```
## Usage
### Running the Server
The server runs on stdio and is designed to be used with MCP-compatible clients:
```bash
npm start
```
### Quick Start: Choose Your Client
You can integrate this MCP server with several AI clients:
1. **Claude Desktop** (Free, Recommended) - See [Claude Desktop Setup](#1-claude-desktop-recommended-alternative)
2. **Cursor IDE** (Paid) - See [Cursor Setup](#connecting-to-cursor)
3. **Windsurf IDE** (Free/Paid) - See [Windsurf Setup](#2-windsurf-ide)
4. **Custom Integration** - See [Custom Integration](#3-custom-integration-using-mcp-sdk)
> 💡 **New to MCP?** Start with **Claude Desktop** - it's free and the easiest to set up!
### Connecting to Cursor
There are two ways to connect this MCP server to Cursor:
#### Method 1: Using Cursor's GUI (Recommended)
1. **Open Cursor Settings**:
- Go to `Settings` → `Features` → `MCP` (or press `Cmd+,` on Mac / `Ctrl+,` on Windows/Linux, then search for "MCP")
2. **Add a New MCP Server**:
- Click the `+ Add New MCP Server` button
3. **Configure the Server**:
- **Name**: `Camera DB` (or any name you prefer)
- **Type**: Select `stdio`
- **Command**: Enter the full path to Node.js
- On Mac/Linux: Usually `/usr/local/bin/node` or `/usr/bin/node`
- On Windows: Usually `C:\Program Files\nodejs\node.exe`
- You can find it by running: `which node` (Mac/Linux) or `where node` (Windows)
- **Args**: Enter the absolute path to the compiled server:
```
/Users/harshakrishnak/Projects/CameraDBMCP/dist/index.js
```
> **Note**: Replace with your actual project path. Run `pwd` in the project directory to get the absolute path.
4. **Save and Connect**:
- Click Save
- Cursor will automatically connect to your MCP server
- You should see the server appear in the MCP servers list with a green status indicator
#### Method 2: Using Configuration File
If Cursor supports a configuration file, you can add this to your MCP config:
```json
{
"mcpServers": {
"camera-db": {
"command": "node",
"args": ["/Users/harshakrishnak/Projects/CameraDBMCP/dist/index.js"]
}
}
}
```
> **Get your absolute path**: Run `./get-path.sh` in this project directory to get the exact paths you need, or run `pwd` to get the project path.
#### Verifying the Connection
After adding the server in Cursor:
1. **Check the MCP Status**: In Cursor's MCP settings, you should see your server listed with a green status indicator
2. **Test with a Query**: Try asking Cursor:
- "Get camera statistics"
- "List all manufacturers"
- "Find cameras by Hikvision"
If the server is connected, Cursor will be able to query your camera database!
## Alternative MCP Clients
Besides Cursor, you can integrate this MCP server with several other AI clients that support the Model Context Protocol:
### 1. Claude Desktop (Recommended Alternative)
**Claude Desktop** is Anthropic's official desktop application that supports MCP servers. It's free and provides a great way to interact with your camera database.
#### Installation & Setup:
1. **Download Claude Desktop**:
- Visit [claude.ai/download](https://claude.ai/download)
- Download and install Claude Desktop for your operating system
2. **Configure MCP Server**:
- The configuration file location depends on your OS:
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
3. **Edit the Configuration File**:
- Create or edit the config file (create the directory if it doesn't exist)
- Add your MCP server configuration:
```json
{
"mcpServers": {
"camera-db": {
"command": "node",
"args": ["/Users/harshakrishnak/Projects/CameraDBMCP/dist/index.js"],
"description": "CCTV Camera Database with 10,000 cameras"
}
}
}
```
> **Important**: Replace `/Users/harshakrishnak/Projects/CameraDBMCP/dist/index.js` with your absolute path. Use `pwd` in your project directory to get the path.
4. **Restart Claude Desktop**:
- Close and reopen Claude Desktop
- The MCP server should automatically connect
5. **Verify Connection**:
- Look for "MCP servers connected" indicator in Claude Desktop
- Ask Claude: "Get camera statistics" or "List all Hikvision cameras"
### 2. Windsurf IDE
**Windsurf** is another code editor that supports MCP integration, similar to Cursor.
#### Setup:
1. **Install Windsurf**: Download from [codeium.com/windsurf](https://codeium.com/windsurf)
2. **Configure MCP**: Similar to Cursor, use the Settings → MCP section
3. **Add Server**: Use the same configuration as Cursor (stdio transport)
### 3. Custom Integration Using MCP SDK
You can build your own client or integrate with existing applications using the MCP SDK:
#### Using Node.js:
See `example-client.js` for a complete working example. Here's a quick snippet:
```javascript
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
// Create transport
const transport = new StdioClientTransport({
command: 'node',
args: ['/path/to/CameraDBMCP/dist/index.js']
});
// Create client
const client = new Client({
name: 'my-camera-client',
version: '1.0.0'
}, {
capabilities: {}
});
// Connect and use
await client.connect(transport);
// Call tools
const result = await client.callTool({
name: 'get_camera_stats',
arguments: {}
});
console.log(result);
```
**Run the example:**
```bash
node example-client.js
```
#### Using Python:
```python
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
async def main():
# Create server parameters
server_params = StdioServerParameters(
command="node",
args=["/path/to/CameraDBMCP/dist/index.js"]
)
# Create session
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
# Initialize
await session.initialize()
# Call tool
result = await session.call_tool(
"get_camera_stats",
arguments={}
)
print(result)
# Run
import asyncio
asyncio.run(main())
```
### 4. Web-Based MCP Clients
You can also create a web interface that communicates with your MCP server:
- Use the MCP SDK in a Node.js backend
- Create REST API endpoints that wrap MCP tool calls
- Build a frontend that queries your API
- This allows web-based access to your camera database
### Comparison of MCP Clients
| Client | Type | Cost | Setup Difficulty | Best For |
|--------|------|------|------------------|----------|
| **Claude Desktop** | Desktop App | Free | Easy | General AI queries, chat interface |
| **Cursor** | IDE | Paid | Easy | Code-focused workflows |
| **Windsurf** | IDE | Free/Paid | Easy | Code-focused workflows |
| **Custom SDK** | Custom | Free | Medium | Custom applications, integrations |
### Getting Your Server Path
To find the absolute path to your MCP server for any client:
```bash
# On Mac/Linux
cd /Users/harshakrishnak/Projects/CameraDBMCP
pwd
# Output: /Users/harshakrishnak/Projects/CameraDBMCP
# The server path would be:
# /Users/harshakrishnak/Projects/CameraDBMCP/dist/index.js
# Or use the provided script:
./get-path.sh
```
### Troubleshooting MCP Connections
1. **Server not starting**:
- Ensure you've run `npm run build`
- Check that `dist/index.js` exists
- Verify Node.js is in your PATH
2. **Path issues**:
- Always use absolute paths in configuration
- On Windows, use forward slashes or escaped backslashes
- Test the server manually: `node dist/index.js`
3. **Permission issues**:
- Ensure the server file is executable
- Check file permissions: `chmod +x dist/index.js` (Mac/Linux)
4. **Connection timeout**:
- Verify the server starts correctly
- Check client logs for error messages
- Test with `node test-server.js` to verify server functionality
### Example Queries
Once connected, you can query the camera database using natural language:
- "Find all cameras by Hikvision"
- "Show me cameras in the Parking Lot"
- "List all active cameras"
- "Get statistics about the camera database"
- "Find cameras with IP address starting with 192.168"
- "Show me PTZ cameras installed in 2024"
## Development
### Project Structure
```
CameraDBMCP/
├── src/
│ ├── index.ts # MCP server implementation
│ ├── cache.ts # In-memory cache for cameras
│ ├── dataGenerator.ts # Sample data generator
│ └── types.ts # TypeScript type definitions
├── dist/ # Compiled JavaScript (generated)
├── package.json
├── tsconfig.json
└── README.md
```
### Building
```bash
npm run build
```
### Development Mode
Watch mode for development:
```bash
npm run dev
```
## Data Generation
The sample data includes:
- 12 different manufacturers (Hikvision, Dahua, Axis, Bosch, Sony, etc.)
- 8 camera types (Dome, Bullet, PTZ, Box, Fisheye, Thermal, IP, Analog)
- 20 different locations
- Random IP addresses, MAC addresses, and firmware versions
- Install dates between 2020-2024
- Warranty dates 1-3 years after install date
## License
MIT
MCP Config
Below is the configuration for this MCP Server. You can copy it directly to Cursor or other MCP clients.
mcp.json
Connection Info
You Might Also Like
No recommendations available