Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/mcp-server/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is an example .env file for the RushDB MCP Server
# Copy this to .env and update with your actual values

# Required: Your RushDB API key
RUSHDB_API_KEY=your-rushdb-api-key-here

# The server will automatically use this environment variable
# when running the MCP server
16 changes: 16 additions & 0 deletions packages/mcp-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:23.11-slim AS node_base
WORKDIR /app

FROM node_base AS builder
COPY package.json package-lock.json tsconfig.json ./
RUN --mount=type=cache,target=/root/.npm npm ci --ignore-scripts --omit-dev

COPY . ./
RUN --mount=type=cache,target=/root/.npm npm run build

FROM node_base
COPY package.json package-lock.json ./
COPY --from=builder /app/build ./build
ENV NODE_ENV=production
RUN --mount=type=cache,target=/root/.npm npm ci --ignore-scripts --omit-dev
ENTRYPOINT ["node", "/app/build/index.js"]
63 changes: 63 additions & 0 deletions packages/mcp-server/EXAMPLES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Example Configuration

Here are example configurations for different MCP clients:

## Claude Desktop

Add this to your `claude_desktop_config.json` file:

```json
{
"mcpServers": {
"rushdb": {
"command": "npx",
"args": ["@rushdb/mcp-server"],
"env": {
"RUSHDB_API_KEY": "your-rushdb-api-key-here"
}
}
}
}
```

## VS Code MCP Extension

If you're using a VS Code MCP extension, add this to your settings:

```json
{
"mcp.servers": {
"rushdb": {
"command": "npx",
"args": ["@rushdb/mcp-server"],
"env": {
"RUSHDB_API_KEY": "your-rushdb-api-key-here"
}
}
}
}
```

## Example Usage

Once configured, you can use the RushDB MCP server like this:

### Create a record
```
Create a new customer record with name "John Doe", email "john@example.com", and age 30
```

### Find records
```
Find all customers with age greater than 25
```

### Create relationships
```
Attach a "PURCHASED" relationship from customer ID abc123 to product ID def456
```

### Export data
```
Export all customer records to CSV format
```
97 changes: 97 additions & 0 deletions packages/mcp-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# RushDB MCP Server

A Model Context Protocol server providing access to RushDB's Labeled Meta Property Graph (LMPG) database.

## Features

- **Record Management**: Create, read, update, and delete records
- **Graph Operations**: Attach and detach relationships between records
- **Advanced Querying**: Search across records using RushDB's flexible query language
- **Label & Property Discovery**: Browse labels and properties in your database
- **Bulk Operations**: Efficient bulk create and delete operations
- **Data Export**: Export records to CSV format
- **LMPG Architecture**: Work with RushDB's revolutionary property-first graph model

## Quick Start

1. **Install the package**:
```bash
npm install -g @rushdb/mcp-server
```

2. **Get your RushDB API key** from [rushdb.com](https://rushdb.com)

3. **Configure your MCP client** (e.g., Claude Desktop):
```json
{
"mcpServers": {
"rushdb": {
"command": "npx",
"args": ["@rushdb/mcp-server"],
"env": {
"RUSHDB_API_KEY": "your-rushdb-api-key-here"
}
}
}
}
```

## Available Tools

### Database Discovery
- `GetLabels` - List all record labels and their counts
- `GetProperties` - List all properties in the database

### Record Operations
- `CreateRecord` - Create a new record
- `UpdateRecord` - Update an existing record
- `DeleteRecord` - Delete a record by ID
- `GetRecord` - Retrieve a record by ID
- `FindRecords` - Search for records using query conditions

### Relationship Management
- `AttachRelation` - Create relationships between records
- `DetachRelation` - Remove relationships between records
- `FindRelations` - Search for relationships

### Bulk Operations
- `BulkCreateRecords` - Create multiple records at once
- `BulkDeleteRecords` - Delete multiple records matching a query

### Data Export
- `ExportRecords` - Export records to CSV format

### Utilities
- `OpenBrowser` - Open URLs in browser
- `HelpAddToClient` - Get setup instructions

## Environment Variables

- `RUSHDB_API_KEY` - Your RushDB API key (required)

## About RushDB's LMPG Architecture

RushDB uses a revolutionary Labeled Meta Property Graph (LMPG) architecture where:

- **Properties are first-class citizens** with their own nodes
- **Records are connected through shared properties**
- **Relationships emerge automatically** based on property overlap
- **No rigid schemas** - data structure evolves naturally
- **Cross-domain insights** through property traversal

This enables unprecedented flexibility in data modeling and querying.

## Development

To build from source:

```bash
git clone <repository>
cd rushdb/packages/mcp-server
npm install
npm run build
```

## License

Apache 2.0
93 changes: 93 additions & 0 deletions packages/mcp-server/esbuild.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// Copyright Collect Software, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import { build } from 'esbuild'
import { fileURLToPath } from 'url'
import { dirname, resolve } from 'path'
import fs from 'fs'

const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)

// Check if watch mode is enabled
const isWatch = process.argv.includes('--watch')
// Check if production mode is enabled
const isProd = process.argv.includes('--prod')

const buildOptions = {
entryPoints: ['index.ts'],
bundle: true,
platform: 'node',
target: 'node18',
format: 'esm',
outfile: 'build/index.js',
banner: {
js: '#!/usr/bin/env node'
},
external: [
// External packages that should not be bundled
'@rushdb/javascript-sdk',
'@modelcontextprotocol/sdk',
'jsonschema',
'dotenv'
],
minify: isProd,
sourcemap: !isProd,
logLevel: 'info'
}

async function runBuild() {
try {
if (isWatch) {
// Watch mode
const ctx = await build({
...buildOptions,
watch: {
onRebuild(error, result) {
if (error) {
console.error('Watch build failed:', error)
} else {
// Make the output file executable
fs.chmodSync('build/index.js', '755')
console.log('Watch build succeeded:', new Date().toLocaleTimeString())
}
}
}
})

// Make the output file executable after initial build
fs.chmodSync('build/index.js', '755')
console.log('Watch mode started, waiting for changes...')

// Keep the process running
process.stdin.on('close', () => {
ctx.stop()
process.exit(0)
})
} else {
// One-time build
await build(buildOptions)

// Make the output file executable
fs.chmodSync('build/index.js', '755')

console.log(`Build completed successfully in ${isProd ? 'production' : 'development'} mode!`)
}
} catch (error) {
console.error('Build failed:', error)
process.exit(1)
}
}

runBuild()
7 changes: 7 additions & 0 deletions packages/mcp-server/glama.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://glama.ai/mcp/schemas/server.json",
"maintainers": [
"1pxone",
"h3yAlias"
]
}
Loading