opalserve 2.0.0 → 3.0.1
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/README.md +493 -67
- package/assets/logo.svg +36 -39
- package/dist/auth/api-keys.d.ts +7 -0
- package/dist/auth/api-keys.d.ts.map +1 -0
- package/dist/auth/api-keys.js +12 -0
- package/dist/auth/api-keys.js.map +1 -0
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +4 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/middleware.d.ts +11 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/middleware.js +46 -0
- package/dist/auth/middleware.js.map +1 -0
- package/dist/auth/passwords.d.ts +3 -0
- package/dist/auth/passwords.d.ts.map +1 -0
- package/dist/auth/passwords.js +33 -0
- package/dist/auth/passwords.js.map +1 -0
- package/dist/cli/commands/admin.d.ts +13 -0
- package/dist/cli/commands/admin.d.ts.map +1 -0
- package/dist/cli/commands/admin.js +261 -0
- package/dist/cli/commands/admin.js.map +1 -0
- package/dist/cli/commands/auth.d.ts +4 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/auth.js +77 -0
- package/dist/cli/commands/auth.js.map +1 -0
- package/dist/cli/commands/context.d.ts +5 -0
- package/dist/cli/commands/context.d.ts.map +1 -0
- package/dist/cli/commands/context.js +162 -0
- package/dist/cli/commands/context.js.map +1 -0
- package/dist/cli/commands/sync.d.ts +2 -0
- package/dist/cli/commands/sync.d.ts.map +1 -0
- package/dist/cli/commands/sync.js +58 -0
- package/dist/cli/commands/sync.js.map +1 -0
- package/dist/cli/index.js +75 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/ui/banner.js +2 -2
- package/dist/config/credentials.d.ts +10 -0
- package/dist/config/credentials.d.ts.map +1 -0
- package/dist/config/credentials.js +33 -0
- package/dist/config/credentials.js.map +1 -0
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +2 -0
- package/dist/config/defaults.js.map +1 -1
- package/dist/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -0
- package/dist/context/chunker.d.ts +2 -0
- package/dist/context/chunker.d.ts.map +1 -0
- package/dist/context/chunker.js +81 -0
- package/dist/context/chunker.js.map +1 -0
- package/dist/context/index.d.ts +26 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +97 -0
- package/dist/context/index.js.map +1 -0
- package/dist/core/registry.d.ts +3 -1
- package/dist/core/registry.d.ts.map +1 -1
- package/dist/core/registry.js +8 -6
- package/dist/core/registry.js.map +1 -1
- package/dist/core/secrets.d.ts +4 -0
- package/dist/core/secrets.d.ts.map +1 -0
- package/dist/core/secrets.js +40 -0
- package/dist/core/secrets.js.map +1 -0
- package/dist/core/server-manager.js +1 -1
- package/dist/dashboard/assets/index-BNOtcUPs.js +257 -0
- package/dist/dashboard/assets/index-Duwp34GW.css +1 -0
- package/dist/dashboard/index.html +14 -0
- package/dist/index.d.ts +13 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/github.d.ts +5 -0
- package/dist/integrations/github.d.ts.map +1 -0
- package/dist/integrations/github.js +63 -0
- package/dist/integrations/github.js.map +1 -0
- package/dist/integrations/slack.d.ts +21 -0
- package/dist/integrations/slack.d.ts.map +1 -0
- package/dist/integrations/slack.js +61 -0
- package/dist/integrations/slack.js.map +1 -0
- package/dist/monitoring/tracker.d.ts +31 -0
- package/dist/monitoring/tracker.d.ts.map +1 -0
- package/dist/monitoring/tracker.js +86 -0
- package/dist/monitoring/tracker.js.map +1 -0
- package/dist/server/app.d.ts.map +1 -1
- package/dist/server/app.js +46 -0
- package/dist/server/app.js.map +1 -1
- package/dist/server/mcp-gateway.js +1 -1
- package/dist/server/routes/auth.d.ts +4 -0
- package/dist/server/routes/auth.d.ts.map +1 -0
- package/dist/server/routes/auth.js +117 -0
- package/dist/server/routes/auth.js.map +1 -0
- package/dist/server/routes/context.d.ts +4 -0
- package/dist/server/routes/context.d.ts.map +1 -0
- package/dist/server/routes/context.js +107 -0
- package/dist/server/routes/context.js.map +1 -0
- package/dist/server/routes/health.js +1 -1
- package/dist/server/routes/stats.d.ts +4 -0
- package/dist/server/routes/stats.d.ts.map +1 -0
- package/dist/server/routes/stats.js +97 -0
- package/dist/server/routes/stats.js.map +1 -0
- package/dist/server/routes/team-servers.d.ts +4 -0
- package/dist/server/routes/team-servers.d.ts.map +1 -0
- package/dist/server/routes/team-servers.js +108 -0
- package/dist/server/routes/team-servers.js.map +1 -0
- package/dist/server/routes/webhooks.d.ts +4 -0
- package/dist/server/routes/webhooks.d.ts.map +1 -0
- package/dist/server/routes/webhooks.js +77 -0
- package/dist/server/routes/webhooks.js.map +1 -0
- package/dist/storage/database.d.ts +10 -3
- package/dist/storage/database.d.ts.map +1 -1
- package/dist/storage/database.js +269 -115
- package/dist/storage/database.js.map +1 -1
- package/dist/types/index.d.ts +102 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
<strong>
|
|
6
|
+
<strong>The control plane for your team's AI tools</strong>
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
@@ -11,133 +11,559 @@
|
|
|
11
11
|
<a href="https://www.npmjs.com/package/opalserve"><img src="https://img.shields.io/npm/dm/opalserve?style=flat-square" alt="downloads" /></a>
|
|
12
12
|
<a href="https://github.com/adityaidev/opalserve/blob/master/LICENSE"><img src="https://img.shields.io/github/license/adityaidev/opalserve?style=flat-square" alt="license" /></a>
|
|
13
13
|
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen?style=flat-square" alt="node version" /></a>
|
|
14
|
+
<a href="https://github.com/adityaidev/opalserve"><img src="https://img.shields.io/github/stars/adityaidev/opalserve?style=flat-square" alt="GitHub stars" /></a>
|
|
14
15
|
</p>
|
|
15
16
|
|
|
16
17
|
---
|
|
17
18
|
|
|
18
|
-
**OpalServe**
|
|
19
|
+
**OpalServe** is an open-source platform that gives engineering teams a single place to register, discover, and govern the MCP (Model Context Protocol) servers their AI coding tools depend on. Instead of every developer manually configuring Claude Desktop, Cursor, Codex, or Windsurf with scattered server definitions, OpalServe provides a centralized registry with shared knowledge bases, usage analytics, role-based access control, and a built-in MCP gateway -- so your team's AI tools stay consistent, observable, and secure.
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Feature Highlights
|
|
24
|
+
|
|
25
|
+
| | Feature | Description |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| :books: | **Team MCP Registry** | Admin registers servers once; every developer pulls them with `opalserve sync` |
|
|
28
|
+
| :brain: | **Shared Knowledge Base** | Upload architecture docs, coding standards, and API specs -- AI tools query them automatically via MCP |
|
|
29
|
+
| :bar_chart: | **Usage Analytics Dashboard** | React SPA showing tool calls, token usage, active users, and error rates in real time |
|
|
30
|
+
| :lock: | **Auth & Access Control** | User accounts, JWT tokens, API keys, rate limits, and per-role tool permissions |
|
|
31
|
+
| :electric_plug: | **GitHub + Slack Integrations** | Webhooks auto-update context; Slack slash commands for search and notifications |
|
|
32
|
+
| :globe_with_meridians: | **MCP Gateway** | OpalServe itself is an MCP server -- connect any AI client to access every tool from one endpoint |
|
|
33
|
+
| :art: | **Beautiful CLI** | Interactive setup wizard, gradient banners, color-coded tables, 20+ commands |
|
|
34
|
+
| :seedling: | **100% Open Source** | MIT licensed, self-host for free, no vendor lock-in |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Architecture
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
|
42
|
+
│ GitHub │ │ Slack │ │ Filesystem │ │ PostgreSQL │
|
|
43
|
+
│ MCP Server │ │ MCP Server │ │ MCP Server │ │ MCP Server │
|
|
44
|
+
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘
|
|
45
|
+
│ │ │ │
|
|
46
|
+
└────────────────┼────────────────┼────────────────┘
|
|
47
|
+
│ MCP Protocol (stdio / SSE)
|
|
48
|
+
│
|
|
49
|
+
┌──────────┴──────────────────────────────┐
|
|
50
|
+
│ OpalServe Team Server │
|
|
51
|
+
│ │
|
|
52
|
+
│ ┌─────────────┐ ┌──────────────────┐ │
|
|
53
|
+
│ │ MCP Server │ │ Shared Knowledge │ │
|
|
54
|
+
│ │ Registry │ │ Base (FTS) │ │
|
|
55
|
+
│ └─────────────┘ └──────────────────┘ │
|
|
56
|
+
│ ┌─────────────┐ ┌──────────────────┐ │
|
|
57
|
+
│ │ Usage │ │ Auth / API Keys │ │
|
|
58
|
+
│ │ Analytics │ │ Rate Limiting │ │
|
|
59
|
+
│ └─────────────┘ └──────────────────┘ │
|
|
60
|
+
│ ┌─────────────┐ ┌──────────────────┐ │
|
|
61
|
+
│ │ MCP Gateway │ │ React Dashboard │ │
|
|
62
|
+
│ │ (stdio/SSE) │ │ (/dashboard) │ │
|
|
63
|
+
│ └─────────────┘ └──────────────────┘ │
|
|
64
|
+
│ │
|
|
65
|
+
│ SQLite DB ── Fastify HTTP API (:3456) │
|
|
66
|
+
└──────────────────┬──────────────────────┘
|
|
67
|
+
│
|
|
68
|
+
HTTPS API + MCP Protocol (stdio / SSE)
|
|
69
|
+
│
|
|
70
|
+
┌──────────────────────┼──────────────────────┐
|
|
71
|
+
│ │ │
|
|
72
|
+
┌────────┴─────────┐ ┌────────┴─────────┐ ┌────────┴─────────┐
|
|
73
|
+
│ Dev A │ │ Dev B │ │ Dev C │
|
|
74
|
+
│ Claude Code │ │ Cursor │ │ Codex / Windsurf │
|
|
75
|
+
│ opalserve sync │ │ opalserve sync │ │ opalserve sync │
|
|
76
|
+
└──────────────────┘ └──────────────────┘ └──────────────────┘
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
26
80
|
|
|
27
81
|
## Quick Start
|
|
28
82
|
|
|
29
83
|
```bash
|
|
30
|
-
# Install globally
|
|
84
|
+
# 1. Install globally
|
|
31
85
|
npm install -g opalserve
|
|
32
86
|
|
|
33
|
-
#
|
|
87
|
+
# 2. Run the interactive setup wizard
|
|
34
88
|
opalserve init
|
|
35
89
|
|
|
36
|
-
# Start the
|
|
90
|
+
# 3. Start the server
|
|
37
91
|
opalserve start
|
|
92
|
+
|
|
93
|
+
# 4. Register your first MCP server
|
|
94
|
+
opalserve server add --name files --stdio "npx -y @modelcontextprotocol/server-filesystem ."
|
|
95
|
+
|
|
96
|
+
# 5. Discover available tools
|
|
97
|
+
opalserve tools search "read file"
|
|
38
98
|
```
|
|
39
99
|
|
|
40
|
-
|
|
100
|
+
> **Tip:** OpalServe runs on port **3456** by default. Visit `http://localhost:3456/dashboard` after starting.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Team Mode Setup
|
|
105
|
+
|
|
106
|
+
Team mode turns OpalServe into a shared server that your entire engineering org connects to.
|
|
107
|
+
|
|
108
|
+
### 1. Initialize the team server
|
|
41
109
|
|
|
42
110
|
```bash
|
|
43
|
-
|
|
44
|
-
|
|
111
|
+
opalserve admin init
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
This creates an admin account, generates encryption keys, and prepares the SQLite database.
|
|
115
|
+
|
|
116
|
+
### 2. Configure team mode
|
|
45
117
|
|
|
46
|
-
|
|
47
|
-
opalserve server add --name github --stdio "npx -y @modelcontextprotocol/server-github" --env GITHUB_TOKEN=ghp_xxx
|
|
118
|
+
Edit `opalserve.config.json` and set the mode:
|
|
48
119
|
|
|
49
|
-
|
|
50
|
-
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"mode": "team-server",
|
|
123
|
+
"port": 3456,
|
|
124
|
+
"host": "0.0.0.0"
|
|
125
|
+
}
|
|
51
126
|
```
|
|
52
127
|
|
|
53
|
-
|
|
128
|
+
### 3. Start the server
|
|
54
129
|
|
|
55
130
|
```bash
|
|
56
|
-
|
|
57
|
-
|
|
131
|
+
opalserve start
|
|
132
|
+
```
|
|
58
133
|
|
|
59
|
-
|
|
60
|
-
opalserve tools search "create issue"
|
|
134
|
+
### 4. Invite team members
|
|
61
135
|
|
|
62
|
-
|
|
63
|
-
opalserve
|
|
136
|
+
```bash
|
|
137
|
+
opalserve admin invite alice@company.com
|
|
138
|
+
opalserve admin invite bob@company.com
|
|
64
139
|
```
|
|
65
140
|
|
|
66
|
-
|
|
141
|
+
### 5. Developers connect
|
|
67
142
|
|
|
68
|
-
|
|
143
|
+
On each developer's machine:
|
|
69
144
|
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
145
|
+
```bash
|
|
146
|
+
npm install -g opalserve
|
|
147
|
+
|
|
148
|
+
# Login to the team server
|
|
149
|
+
opalserve login
|
|
150
|
+
|
|
151
|
+
# Pull all registered servers to local config
|
|
152
|
+
opalserve sync
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 6. Manage access
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Set rate limits by role
|
|
159
|
+
opalserve admin limits --set developer:calls_per_hour:500
|
|
160
|
+
|
|
161
|
+
# Set tool permissions
|
|
162
|
+
opalserve admin permissions --set developer:filesystem:*:allow
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Knowledge Base
|
|
168
|
+
|
|
169
|
+
The knowledge base lets you upload documents that become searchable context for every AI tool connected through OpalServe.
|
|
170
|
+
|
|
171
|
+
### Adding documents
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Upload architecture docs
|
|
175
|
+
opalserve context add ./docs/architecture.md
|
|
176
|
+
|
|
177
|
+
# Upload API specifications
|
|
178
|
+
opalserve context add ./docs/api-spec.md
|
|
179
|
+
|
|
180
|
+
# Upload coding standards
|
|
181
|
+
opalserve context add ./docs/coding-standards.md
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Searching context
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Search by natural language query
|
|
188
|
+
opalserve context search "authentication flow"
|
|
189
|
+
|
|
190
|
+
# List all uploaded documents
|
|
191
|
+
opalserve context list
|
|
192
|
+
|
|
193
|
+
# Remove a document
|
|
194
|
+
opalserve context remove <document-id>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
When connected via the MCP gateway, AI tools like Claude Desktop can automatically search the knowledge base to ground their responses in your team's actual documentation.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Admin Dashboard
|
|
202
|
+
|
|
203
|
+
OpalServe ships with a built-in React SPA accessible at `/dashboard` when the server is running.
|
|
204
|
+
|
|
205
|
+
The dashboard provides:
|
|
206
|
+
|
|
207
|
+
- **Usage overview** -- charts for tool calls, token consumption, and active users over time
|
|
208
|
+
- **Server monitoring** -- live status of every registered MCP server with health indicators
|
|
209
|
+
- **User management** -- view team members, roles, and activity
|
|
210
|
+
- **Tool browser** -- searchable catalog of all discovered tools across servers
|
|
211
|
+
- **Knowledge base manager** -- upload, browse, and remove context documents
|
|
212
|
+
- **Settings** -- API key management, integration configuration, rate limits
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
http://localhost:3456/dashboard
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
> The dashboard is available in team-server mode. Authentication is required for all management operations.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## CLI Commands
|
|
223
|
+
|
|
224
|
+
| Command | Description |
|
|
225
|
+
|---|---|
|
|
226
|
+
| `opalserve init` | Interactive setup wizard -- configures mode, port, and first server |
|
|
227
|
+
| `opalserve start` | Start the registry server (HTTP API + MCP gateway) |
|
|
228
|
+
| `opalserve status` | Show server status, connected servers, and tool counts |
|
|
229
|
+
| `opalserve health` | Health check all registered servers |
|
|
230
|
+
| `opalserve health --server <name>` | Health check a specific server |
|
|
231
|
+
| `opalserve login` | Authenticate with a team server |
|
|
232
|
+
| `opalserve logout` | Clear stored credentials |
|
|
233
|
+
| `opalserve whoami` | Show current authenticated user info |
|
|
234
|
+
| `opalserve sync` | Pull team server configurations to local machine |
|
|
235
|
+
| `opalserve server list` | List all registered MCP servers |
|
|
236
|
+
| `opalserve server add` | Register a new MCP server (stdio, SSE, or streamable-http) |
|
|
237
|
+
| `opalserve server remove <name>` | Remove a registered server |
|
|
238
|
+
| `opalserve tools list` | List all discovered tools across servers |
|
|
239
|
+
| `opalserve tools search <query>` | Search for tools by natural language query |
|
|
240
|
+
| `opalserve context add <file>` | Upload a file to the shared knowledge base |
|
|
241
|
+
| `opalserve context list` | List all context documents |
|
|
242
|
+
| `opalserve context search <query>` | Search the knowledge base |
|
|
243
|
+
| `opalserve context remove <id>` | Remove a context document |
|
|
244
|
+
| `opalserve admin init` | Initialize team mode with an admin user |
|
|
245
|
+
| `opalserve admin stats` | Show usage statistics for the team |
|
|
246
|
+
| `opalserve admin users` | List all team members |
|
|
247
|
+
| `opalserve admin invite <email>` | Invite a user to the team |
|
|
248
|
+
| `opalserve admin limits` | View and manage rate limits |
|
|
249
|
+
| `opalserve admin permissions` | View and manage tool permissions |
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## HTTP API
|
|
254
|
+
|
|
255
|
+
OpalServe exposes a RESTful API under `/api/v1`. All endpoints return JSON.
|
|
256
|
+
|
|
257
|
+
### Health
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
curl http://localhost:3456/api/v1/health
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Servers
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# List all servers
|
|
267
|
+
curl http://localhost:3456/api/v1/servers
|
|
268
|
+
|
|
269
|
+
# Register a new server
|
|
270
|
+
curl -X POST http://localhost:3456/api/v1/servers \
|
|
271
|
+
-H "Content-Type: application/json" \
|
|
272
|
+
-d '{
|
|
273
|
+
"name": "filesystem",
|
|
274
|
+
"transport": {
|
|
275
|
+
"type": "stdio",
|
|
74
276
|
"command": "npx",
|
|
75
|
-
"args": ["-y", "
|
|
277
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
|
|
76
278
|
}
|
|
77
|
-
}
|
|
78
|
-
|
|
279
|
+
}'
|
|
280
|
+
|
|
281
|
+
# Remove a server
|
|
282
|
+
curl -X DELETE http://localhost:3456/api/v1/servers/filesystem
|
|
283
|
+
|
|
284
|
+
# Health check a specific server
|
|
285
|
+
curl http://localhost:3456/api/v1/servers/filesystem/health
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Tools
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
# List all tools
|
|
292
|
+
curl http://localhost:3456/api/v1/tools
|
|
293
|
+
|
|
294
|
+
# Search tools
|
|
295
|
+
curl "http://localhost:3456/api/v1/tools/search?q=read+file&limit=5"
|
|
296
|
+
|
|
297
|
+
# Call a tool
|
|
298
|
+
curl -X POST http://localhost:3456/api/v1/tools/filesystem__read_file/call \
|
|
299
|
+
-H "Content-Type: application/json" \
|
|
300
|
+
-d '{"arguments": {"path": "./README.md"}}'
|
|
79
301
|
```
|
|
80
302
|
|
|
303
|
+
### Authentication (team mode)
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
# Register
|
|
307
|
+
curl -X POST http://localhost:3456/api/v1/auth/register \
|
|
308
|
+
-H "Content-Type: application/json" \
|
|
309
|
+
-d '{"email": "dev@company.com", "password": "...", "name": "Alice"}'
|
|
310
|
+
|
|
311
|
+
# Login
|
|
312
|
+
curl -X POST http://localhost:3456/api/v1/auth/login \
|
|
313
|
+
-H "Content-Type: application/json" \
|
|
314
|
+
-d '{"email": "dev@company.com", "password": "..."}'
|
|
315
|
+
|
|
316
|
+
# Get current user
|
|
317
|
+
curl http://localhost:3456/api/v1/auth/me \
|
|
318
|
+
-H "Authorization: Bearer <token>"
|
|
319
|
+
|
|
320
|
+
# Create API key
|
|
321
|
+
curl -X POST http://localhost:3456/api/v1/auth/keys \
|
|
322
|
+
-H "Authorization: Bearer <token>" \
|
|
323
|
+
-H "Content-Type: application/json" \
|
|
324
|
+
-d '{"name": "ci-pipeline"}'
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### Knowledge Base (team mode)
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
# Upload a document
|
|
331
|
+
curl -X POST http://localhost:3456/api/v1/context/documents \
|
|
332
|
+
-H "Authorization: Bearer <token>" \
|
|
333
|
+
-H "Content-Type: application/json" \
|
|
334
|
+
-d '{"title": "Architecture", "content": "...", "type": "markdown"}'
|
|
335
|
+
|
|
336
|
+
# Search documents
|
|
337
|
+
curl "http://localhost:3456/api/v1/context/search?q=authentication+flow" \
|
|
338
|
+
-H "Authorization: Bearer <token>"
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Usage Stats (team mode)
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
# Overview
|
|
345
|
+
curl http://localhost:3456/api/v1/stats/overview \
|
|
346
|
+
-H "Authorization: Bearer <token>"
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
81
351
|
## Library Usage
|
|
82
352
|
|
|
83
|
-
|
|
84
|
-
import { OpalServeRegistry } from 'opalserve';
|
|
353
|
+
Use OpalServe programmatically in your Node.js applications:
|
|
85
354
|
|
|
355
|
+
```typescript
|
|
356
|
+
import {
|
|
357
|
+
OpalServeRegistry,
|
|
358
|
+
McpGateway,
|
|
359
|
+
KnowledgeBase,
|
|
360
|
+
UsageTracker,
|
|
361
|
+
} from 'opalserve';
|
|
362
|
+
|
|
363
|
+
// Create the registry with server definitions
|
|
86
364
|
const registry = await OpalServeRegistry.create({
|
|
87
|
-
servers: [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
365
|
+
servers: [
|
|
366
|
+
{
|
|
367
|
+
name: 'filesystem',
|
|
368
|
+
transport: {
|
|
369
|
+
type: 'stdio',
|
|
370
|
+
command: 'npx',
|
|
371
|
+
args: ['-y', '@modelcontextprotocol/server-filesystem', '.'],
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
name: 'github',
|
|
376
|
+
transport: {
|
|
377
|
+
type: 'sse',
|
|
378
|
+
url: 'https://mcp-github.example.com/sse',
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
],
|
|
91
382
|
});
|
|
92
383
|
|
|
384
|
+
// Start the registry -- connects to all servers and indexes tools
|
|
93
385
|
await registry.start();
|
|
94
386
|
|
|
387
|
+
// List all discovered tools
|
|
95
388
|
const tools = registry.listTools();
|
|
96
|
-
|
|
97
|
-
const result = await registry.callTool('my-files:read_file', { path: './README.md' });
|
|
389
|
+
console.log(`Discovered ${tools.length} tools`);
|
|
98
390
|
|
|
391
|
+
// Search with natural language
|
|
392
|
+
const results = registry.searchTools('read file contents');
|
|
393
|
+
for (const result of results) {
|
|
394
|
+
console.log(`${result.tool.name} (score: ${result.score})`);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// Graceful shutdown
|
|
99
398
|
await registry.stop();
|
|
100
399
|
```
|
|
101
400
|
|
|
102
|
-
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## MCP Gateway
|
|
404
|
+
|
|
405
|
+
OpalServe can act as an MCP server itself, exposing every registered tool through a single endpoint. This lets you point Claude Desktop, Cursor, or any MCP-compatible client at OpalServe instead of configuring each server individually.
|
|
406
|
+
|
|
407
|
+
### Claude Desktop
|
|
408
|
+
|
|
409
|
+
Add to your `claude_desktop_config.json`:
|
|
410
|
+
|
|
411
|
+
```json
|
|
412
|
+
{
|
|
413
|
+
"mcpServers": {
|
|
414
|
+
"opalserve": {
|
|
415
|
+
"command": "opalserve",
|
|
416
|
+
"args": ["start", "--mcp"]
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### Cursor
|
|
423
|
+
|
|
424
|
+
Add to your Cursor MCP settings:
|
|
425
|
+
|
|
426
|
+
```json
|
|
427
|
+
{
|
|
428
|
+
"mcpServers": {
|
|
429
|
+
"opalserve": {
|
|
430
|
+
"command": "opalserve",
|
|
431
|
+
"args": ["start", "--mcp"]
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
Once connected, your AI client gains access to:
|
|
103
438
|
|
|
104
|
-
|
|
439
|
+
- **`opalserve_search`** -- search across all registered tools by natural language query
|
|
440
|
+
- **`opalserve_context_search`** -- search the shared knowledge base
|
|
441
|
+
- **All proxied tools** -- every tool from every registered server, available through the single gateway
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
## Integrations
|
|
446
|
+
|
|
447
|
+
### GitHub
|
|
448
|
+
|
|
449
|
+
Set up GitHub webhooks to automatically update context when code changes:
|
|
105
450
|
|
|
106
451
|
```bash
|
|
107
|
-
#
|
|
108
|
-
|
|
452
|
+
# Add GitHub MCP server
|
|
453
|
+
opalserve server add --name github --stdio "npx -y @modelcontextprotocol/server-github"
|
|
109
454
|
|
|
110
|
-
#
|
|
111
|
-
|
|
455
|
+
# Configure webhook (point your repo's webhook to):
|
|
456
|
+
# POST http://your-server:3456/api/v1/webhooks/github
|
|
457
|
+
```
|
|
112
458
|
|
|
113
|
-
|
|
114
|
-
curl "http://localhost:3456/api/v1/tools/search?q=read+file"
|
|
459
|
+
Environment variables:
|
|
115
460
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
-d '{"path": "./README.md"}'
|
|
461
|
+
```
|
|
462
|
+
GITHUB_TOKEN=ghp_...
|
|
463
|
+
GITHUB_WEBHOOK_SECRET=your-secret
|
|
120
464
|
```
|
|
121
465
|
|
|
122
|
-
|
|
466
|
+
### Slack
|
|
467
|
+
|
|
468
|
+
Enable Slack integration for search commands and notifications:
|
|
469
|
+
|
|
470
|
+
```bash
|
|
471
|
+
# Add Slack MCP server
|
|
472
|
+
opalserve server add --name slack --stdio "npx -y @modelcontextprotocol/server-slack"
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
Configure your Slack app to send events and commands to:
|
|
476
|
+
|
|
477
|
+
```
|
|
478
|
+
Events: POST http://your-server:3456/api/v1/slack/events
|
|
479
|
+
Commands: POST http://your-server:3456/api/v1/slack/commands
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
Environment variables:
|
|
483
|
+
|
|
484
|
+
```
|
|
485
|
+
SLACK_BOT_TOKEN=xoxb-...
|
|
486
|
+
SLACK_SIGNING_SECRET=your-secret
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
## Configuration
|
|
123
492
|
|
|
493
|
+
OpalServe is configured via `opalserve.config.json` in your project root or home directory.
|
|
494
|
+
|
|
495
|
+
```json
|
|
496
|
+
{
|
|
497
|
+
"mode": "local",
|
|
498
|
+
"port": 3456,
|
|
499
|
+
"host": "127.0.0.1",
|
|
500
|
+
"servers": [
|
|
501
|
+
{
|
|
502
|
+
"name": "filesystem",
|
|
503
|
+
"transport": {
|
|
504
|
+
"type": "stdio",
|
|
505
|
+
"command": "npx",
|
|
506
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
]
|
|
510
|
+
}
|
|
124
511
|
```
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
512
|
+
|
|
513
|
+
| Option | Default | Description |
|
|
514
|
+
|---|---|---|
|
|
515
|
+
| `mode` | `"local"` | `"local"` for single-user, `"team-server"` for shared |
|
|
516
|
+
| `port` | `3456` | HTTP API port |
|
|
517
|
+
| `host` | `"127.0.0.1"` | Bind address (`0.0.0.0` for team server) |
|
|
518
|
+
| `servers` | `[]` | Array of MCP server configurations |
|
|
519
|
+
|
|
520
|
+
Modes: **local** (single developer, no auth) and **team-server** (multi-user with auth, analytics, knowledge base).
|
|
521
|
+
|
|
522
|
+
> See the [full configuration reference](https://opalserve.vercel.app/config) for all options.
|
|
523
|
+
|
|
524
|
+
---
|
|
525
|
+
|
|
526
|
+
## Contributing
|
|
527
|
+
|
|
528
|
+
Contributions are welcome. To get started:
|
|
529
|
+
|
|
530
|
+
```bash
|
|
531
|
+
# Clone the repo
|
|
532
|
+
git clone https://github.com/adityaidev/opalserve.git
|
|
533
|
+
cd opalserve
|
|
534
|
+
|
|
535
|
+
# Install dependencies
|
|
536
|
+
pnpm install
|
|
537
|
+
|
|
538
|
+
# Start in dev mode (watch + auto-reload)
|
|
539
|
+
pnpm dev
|
|
540
|
+
|
|
541
|
+
# Type-check
|
|
542
|
+
pnpm typecheck
|
|
543
|
+
|
|
544
|
+
# Lint
|
|
545
|
+
pnpm lint
|
|
546
|
+
|
|
547
|
+
# Run tests
|
|
548
|
+
pnpm test
|
|
129
549
|
```
|
|
130
550
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
551
|
+
Please open an issue before submitting large PRs. Follow the existing code style -- strict TypeScript, Zod schemas for validation, and `.js` extensions in imports.
|
|
552
|
+
|
|
553
|
+
---
|
|
554
|
+
|
|
555
|
+
## Links
|
|
136
556
|
|
|
137
|
-
|
|
557
|
+
- **Documentation:** [opalserve.vercel.app](https://opalserve.vercel.app)
|
|
558
|
+
- **npm:** [npmjs.com/package/opalserve](https://www.npmjs.com/package/opalserve)
|
|
559
|
+
- **GitHub:** [github.com/adityaidev/opalserve](https://github.com/adityaidev/opalserve)
|
|
560
|
+
- **Releases:** [github.com/adityaidev/opalserve/releases](https://github.com/adityaidev/opalserve/releases)
|
|
561
|
+
- **Issues:** [github.com/adityaidev/opalserve/issues](https://github.com/adityaidev/opalserve/issues)
|
|
138
562
|
|
|
139
|
-
|
|
563
|
+
---
|
|
140
564
|
|
|
141
565
|
## License
|
|
142
566
|
|
|
143
|
-
MIT
|
|
567
|
+
MIT -- 100% open source, free to self-host.
|
|
568
|
+
|
|
569
|
+
See [LICENSE](./LICENSE) for details.
|