@rebasepro/mcp 0.0.1-canary.4829d6e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +143 -0
- package/bin/rebase-mcp.js +2 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1211 -0
- package/dist/index.js.map +1 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rebase
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# @rebasepro/mcp
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) server that exposes Rebase schema, database, document CRUD, user management, and dev server tools to AI assistants.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @rebasepro/mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or run directly:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx rebase-mcp
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## What This Package Does
|
|
18
|
+
|
|
19
|
+
`@rebasepro/mcp` implements the [Model Context Protocol](https://modelcontextprotocol.io) over stdio, allowing AI assistants (Gemini, Claude, Cursor, etc.) to interact with a Rebase project. It provides tools and exposes collection definitions and generated schemas as MCP resources. It has native support for managing multiple local and remote projects.
|
|
20
|
+
|
|
21
|
+
## Multi-Project Support
|
|
22
|
+
|
|
23
|
+
The MCP server supports managing multiple Rebase projects simultaneously. This is ideal when working in an IDE with multiple open workspaces or when interacting with both local development servers and remote staging/production environments.
|
|
24
|
+
|
|
25
|
+
- **Registry**: Project configurations are stored in `~/.rebase/projects.json`.
|
|
26
|
+
- **Auto-Discovery**: If `rebase dev` is running locally, the MCP server automatically discovers the active development port and service key from `.rebase/state.json` inside the project directory, giving you **zero-config local development**.
|
|
27
|
+
- **Default Project**: If no project registry exists, a default project named `default` is created using `REBASE_PROJECT_DIR` (or current working directory), `REBASE_BASE_URL`, and `REBASE_API_TOKEN`.
|
|
28
|
+
|
|
29
|
+
## Configuration
|
|
30
|
+
|
|
31
|
+
The server reads configuration from environment variables and `.env` files:
|
|
32
|
+
|
|
33
|
+
| Variable | Default | Description |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| `REBASE_PROJECT_DIR` | `process.cwd()` | Project root directory (fallback if no registry) |
|
|
36
|
+
| `REBASE_BASE_URL` | `http://localhost:3001` | Rebase backend URL (fallback if no registry) |
|
|
37
|
+
| `REBASE_API_TOKEN` / `REBASE_TOKEN` | (empty) | Auth token for API calls (fallback if no registry) |
|
|
38
|
+
|
|
39
|
+
The server attempts to load `.env` from `$REBASE_PROJECT_DIR/.env` or `$REBASE_PROJECT_DIR/app/.env`.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Tools
|
|
44
|
+
|
|
45
|
+
### Project Management Tools (6) [NEW]
|
|
46
|
+
|
|
47
|
+
Manage multiple local projects or remote environments.
|
|
48
|
+
|
|
49
|
+
| Tool | Required Args | Description |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| `rebase_project_list` | (none) | List all registered projects and show which one is currently active |
|
|
52
|
+
| `rebase_project_switch` | `name` | Switch the active project to another registered project |
|
|
53
|
+
| `rebase_project_add` | `name` | Register a new project (requires `baseUrl` and optional `projectDir`, `token`/`serviceKey`) |
|
|
54
|
+
| `rebase_project_remove` | `name` | Remove a project from the registry (cannot remove the default project) |
|
|
55
|
+
| `rebase_project_current` | (none) | Show details of the active project (name, directory, base URL, auth token status) |
|
|
56
|
+
| `rebase_project_status` | (none) | Perform a health check on the active project's backend URL |
|
|
57
|
+
|
|
58
|
+
### CLI Tools (6)
|
|
59
|
+
|
|
60
|
+
Spawn `npx rebase <command>` in the active project directory.
|
|
61
|
+
|
|
62
|
+
| Tool | Description |
|
|
63
|
+
|---|---|
|
|
64
|
+
| `rebase_schema_generate` | Generate Drizzle schema from collection definitions |
|
|
65
|
+
| `rebase_db_push` | Apply schema directly to DB (dev shortcut) |
|
|
66
|
+
| `rebase_schema_introspect` | Introspect live DB → collection definitions |
|
|
67
|
+
| `rebase_db_generate` | Generate SQL migration files from schema diff |
|
|
68
|
+
| `rebase_db_migrate` | Run pending SQL migrations |
|
|
69
|
+
| `rebase_generate_sdk` | Generate typed TypeScript SDK |
|
|
70
|
+
|
|
71
|
+
### Data Tools (5)
|
|
72
|
+
|
|
73
|
+
CRUD operations via `@rebasepro/client` on the active project.
|
|
74
|
+
|
|
75
|
+
| Tool | Required Args | Description |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| `list_documents` | `collection` | List with optional `limit`, `offset`, `orderBy`, `where` |
|
|
78
|
+
| `get_document` | `collection`, `id` | Get single document by ID |
|
|
79
|
+
| `create_document` | `collection`, `data` | Create a new document |
|
|
80
|
+
| `update_document` | `collection`, `id`, `data` | Update existing document |
|
|
81
|
+
| `delete_document` | `collection`, `id` | Delete a document |
|
|
82
|
+
|
|
83
|
+
### Admin Tools (6)
|
|
84
|
+
|
|
85
|
+
User and role management.
|
|
86
|
+
|
|
87
|
+
| Tool | Required Args | Description |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| `list_users` | (none) | List all users with roles |
|
|
90
|
+
| `create_user` | `email` | Create user (optional: `displayName`, `password`, `roles`) |
|
|
91
|
+
| `update_user` | `userId` | Update user (optional: `email`, `displayName`, `roles`) |
|
|
92
|
+
| `delete_user` | `userId` | Delete a user |
|
|
93
|
+
| `list_roles` | (none) | List all defined roles |
|
|
94
|
+
| `rebase_auth_reset_password` | `email` | Reset a user's password using the admin API (optional: `password`) |
|
|
95
|
+
|
|
96
|
+
> [!NOTE]
|
|
97
|
+
> `rebase_auth_reset_password` now calls the running admin endpoint instead of performing direct database queries. This makes it compatible with both local development and remote servers.
|
|
98
|
+
|
|
99
|
+
### Dev Server Tools (3)
|
|
100
|
+
|
|
101
|
+
Manage the local development server.
|
|
102
|
+
|
|
103
|
+
| Tool | Description |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `rebase_dev_start` | Start `pnpm run dev` in the `app/` directory |
|
|
106
|
+
| `rebase_dev_logs` | Read recent output (default: 50 lines, max buffer: 500) |
|
|
107
|
+
| `rebase_dev_stop` | Send SIGTERM to the dev server process |
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Resources
|
|
112
|
+
|
|
113
|
+
The server exposes MCP resources for AI context:
|
|
114
|
+
|
|
115
|
+
| URI | Description |
|
|
116
|
+
|---|---|
|
|
117
|
+
| `rebase://collections/{name}` | TypeScript source of a collection definition |
|
|
118
|
+
| `rebase://schema` | Generated Drizzle schema (`schema.generated.ts`) |
|
|
119
|
+
|
|
120
|
+
Collection files are discovered from `app/config/collections/`, `config/collections/`, or `collections/` under the active project directory.
|
|
121
|
+
|
|
122
|
+
## Quick Start
|
|
123
|
+
|
|
124
|
+
Add to your AI assistant's MCP config (e.g. `.gemini/settings.json`):
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"mcpServers": {
|
|
129
|
+
"rebase": {
|
|
130
|
+
"command": "npx",
|
|
131
|
+
"args": ["rebase-mcp"],
|
|
132
|
+
"env": {
|
|
133
|
+
"REBASE_PROJECT_DIR": "/path/to/your/project"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Related Packages
|
|
141
|
+
|
|
142
|
+
- `@rebasepro/client` — Used internally for data and admin API calls
|
|
143
|
+
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
|
+
export type PackageManager = "pnpm" | "yarn" | "npm";
|
|
3
|
+
/**
|
|
4
|
+
* Detect the project's package manager by checking for lock files.
|
|
5
|
+
* Falls back to pnpm (Rebase's default) if no lock file is found.
|
|
6
|
+
*/
|
|
7
|
+
export declare function detectPackageManager(projectDir: string): PackageManager;
|
|
8
|
+
/** Return the exec command and its arguments prefix for running a package binary. */
|
|
9
|
+
export declare function getExecCommand(pm: PackageManager): {
|
|
10
|
+
command: string;
|
|
11
|
+
args: string[];
|
|
12
|
+
};
|
|
13
|
+
/** Return the run command for executing package.json scripts. */
|
|
14
|
+
export declare function getRunCommand(pm: PackageManager): {
|
|
15
|
+
command: string;
|
|
16
|
+
args: string[];
|
|
17
|
+
};
|
|
18
|
+
/** Configuration for a single Rebase project. */
|
|
19
|
+
export interface ProjectConfig {
|
|
20
|
+
name: string;
|
|
21
|
+
/** Absolute path to the project directory (for local projects). */
|
|
22
|
+
projectDir?: string;
|
|
23
|
+
/** Backend URL (e.g. http://localhost:3001 or https://staging.myapp.com). */
|
|
24
|
+
baseUrl: string;
|
|
25
|
+
/** Auth token — a service key, API key, or JWT. */
|
|
26
|
+
token: string;
|
|
27
|
+
/** ISO timestamp when the project was registered. */
|
|
28
|
+
addedAt: string;
|
|
29
|
+
}
|
|
30
|
+
export declare const server: Server<{
|
|
31
|
+
method: string;
|
|
32
|
+
params?: {
|
|
33
|
+
[x: string]: unknown;
|
|
34
|
+
_meta?: {
|
|
35
|
+
[x: string]: unknown;
|
|
36
|
+
progressToken?: string | number | undefined;
|
|
37
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
38
|
+
taskId: string;
|
|
39
|
+
} | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
method: string;
|
|
44
|
+
params?: {
|
|
45
|
+
[x: string]: unknown;
|
|
46
|
+
_meta?: {
|
|
47
|
+
[x: string]: unknown;
|
|
48
|
+
progressToken?: string | number | undefined;
|
|
49
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
50
|
+
taskId: string;
|
|
51
|
+
} | undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
} | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
[x: string]: unknown;
|
|
56
|
+
_meta?: {
|
|
57
|
+
[x: string]: unknown;
|
|
58
|
+
progressToken?: string | number | undefined;
|
|
59
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
60
|
+
taskId: string;
|
|
61
|
+
} | undefined;
|
|
62
|
+
} | undefined;
|
|
63
|
+
}>;
|
|
64
|
+
interface ToolDef {
|
|
65
|
+
name: string;
|
|
66
|
+
description: string;
|
|
67
|
+
inputSchema: {
|
|
68
|
+
type: "object";
|
|
69
|
+
properties: Record<string, unknown>;
|
|
70
|
+
required?: string[];
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export declare const ALL_TOOLS: ToolDef[];
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAgBnE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAErD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,CAevE;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,EAAE,EAAE,cAAc,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAStF;AAED,iEAAiE;AACjE,wBAAgB,aAAa,CAAC,EAAE,EAAE,cAAc,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CASrF;AAcD,iDAAiD;AACjD,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;CACnB;AA2QD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKlB,CAAC;AAIF,UAAU,OAAO;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACT,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACvB,CAAC;CACL;AA+bD,eAAO,MAAM,SAAS,EAAE,OAAO,EAS9B,CAAC"}
|