Skip to content

Commit eca14d5

Browse files
authored
Merge pull request #23 from vcon-dev/VCON-254-docs-for-newly-created-rest-api
Add REST API documentation
2 parents 26f25e7 + bde577e commit eca14d5

6 files changed

Lines changed: 897 additions & 42 deletions

File tree

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,54 @@ curl -X DELETE http://127.0.0.1:3000 \
372372

373373
See [MCP Streamable HTTP Specification](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports) for protocol details.
374374

375+
## REST API
376+
377+
When running in HTTP transport mode, the server also exposes a RESTful HTTP API for vCon operations, designed for programmatic integration with external systems.
378+
379+
### Endpoints
380+
381+
| Method | Endpoint | Description |
382+
|--------|----------|-------------|
383+
| `GET` | `/api/v1/health` | Health check (no auth required) |
384+
| `POST` | `/api/v1/vcons` | Create/ingest a single vCon |
385+
| `POST` | `/api/v1/vcons/batch` | Batch ingest up to 100 vCons |
386+
| `GET` | `/api/v1/vcons` | List recent vCons |
387+
| `GET` | `/api/v1/vcons/:uuid` | Get a vCon by UUID |
388+
| `DELETE` | `/api/v1/vcons/:uuid` | Delete a vCon |
389+
390+
### Configuration
391+
392+
```bash
393+
# REST API settings (optional - defaults work for most cases)
394+
REST_API_BASE_PATH=/api/v1 # Base path for endpoints
395+
REST_API_ENABLED=true # Enable/disable REST API
396+
397+
# API Key Authentication
398+
VCON_API_KEYS=key1,key2 # Comma-separated valid API keys
399+
API_AUTH_REQUIRED=true # Set to false to disable auth
400+
```
401+
402+
### Quick Example
403+
404+
```bash
405+
# Health check
406+
curl http://localhost:3000/api/v1/health
407+
408+
# Create a vCon (requires API key)
409+
curl -X POST http://localhost:3000/api/v1/vcons \
410+
-H "Content-Type: application/json" \
411+
-H "x-api-key: your-api-key" \
412+
-d '{"vcon":"0.3.0","subject":"Support Call","parties":[{"name":"Agent","tel":"+1111"}]}'
413+
414+
# Batch create
415+
curl -X POST http://localhost:3000/api/v1/vcons/batch \
416+
-H "Content-Type: application/json" \
417+
-H "x-api-key: your-api-key" \
418+
-d '[{"vcon":"0.3.0","parties":[{"name":"A","tel":"+1"}]},{"vcon":"0.3.0","parties":[{"name":"B","tel":"+2"}]}]'
419+
```
420+
421+
See the complete [REST API Reference](docs/api/rest-api.md) for detailed documentation.
422+
375423
## Available MCP Tools
376424

377425
### 1. **create_vcon**
@@ -865,6 +913,7 @@ vcon-mcp/
865913

866914
### API Reference
867915

916+
- **[REST API](docs/api/rest-api.md)** - HTTP REST API for vCon ingestion
868917
- **[Tools API](docs/api/tools.md)** - MCP tools reference
869918
- **[Prompts API](docs/api/prompts.md)** - MCP prompts reference
870919
- **[Resources API](docs/api/resources.md)** - MCP resources reference

docs/.vitepress/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export default defineConfig({
7878
text: 'API Reference',
7979
items: [
8080
{ text: 'Overview', link: '/api/' },
81+
{ text: 'REST API', link: '/api/rest-api' },
8182
{ text: 'MCP Tools', link: '/api/tools' },
8283
{ text: 'MCP Resources', link: '/api/resources' },
8384
{ text: 'MCP Prompts', link: '/api/prompts' },

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
## API Reference
1717

1818
* [Overview](api/index.md)
19+
* [REST API](api/rest-api.md)
1920
* [MCP Tools](api/tools.md)
2021
* [MCP Resources](api/resources.md)
2122
* [MCP Prompts](api/prompts.md)

docs/api/index.md

Lines changed: 61 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ The vCon MCP Server provides a comprehensive API for managing virtual conversati
1010

1111
## API Components
1212

13+
### 🌐 [REST API](./rest-api.md)
14+
15+
HTTP REST API for vCon ingestion:
16+
17+
- **POST /vcons** - Create/ingest a single vCon
18+
- **POST /vcons/batch** - Batch ingest up to 100 vCons
19+
- **GET /vcons/:uuid** - Get a vCon by UUID
20+
- **GET /vcons** - List recent vCons
21+
- **DELETE /vcons/:uuid** - Delete a vCon
22+
- **GET /health** - Health check endpoint
23+
24+
[View REST API Reference →](./rest-api.md)
25+
26+
---
27+
1328
### 🛠️ [Tools](./tools.md)
1429

1530
20+ MCP tools for vCon operations:
@@ -168,32 +183,54 @@ const prompt = await getPrompt("find_by_exact_tags", {
168183

169184
## Architecture
170185

171-
### MCP Protocol Flow
186+
### Protocol Flow
172187

173188
```
174-
┌─────────────┐
175-
│ Client │ (Claude Desktop, Custom Client)
176-
│ (MCP SDK) │
177-
└──────┬──────┘
178-
│ MCP Protocol (stdio/HTTP)
179-
180-
┌──────▼──────┐
181-
│ vCon MCP │
182-
│ Server │
183-
└──────┬──────┘
184-
185-
├─── Tools ────────┐
186-
│ │
187-
├─── Resources ────┤
188-
│ │
189-
├─── Prompts ──────┤
190-
│ │
191-
└─── Database ─────┘
192-
193-
┌──────▼───────┐
194-
│ PostgreSQL │
195-
│ (Supabase) │
196-
└──────────────┘
189+
┌──────────────────────────────────────────────────────────────┐
190+
│ Clients │
191+
├─────────────────────────────────┬────────────────────────────┤
192+
│ AI Assistants (MCP) │ External Systems (REST) │
193+
│ (Claude Desktop, Custom) │ (Integrations, Pipelines)│
194+
└───────────────┬─────────────────┴──────────────┬─────────────┘
195+
│ MCP (stdio/HTTP) │ HTTP/JSON
196+
│ │
197+
┌───────────────▼─────────────────────────────────▼────────────┐
198+
│ vCon MCP Server │
199+
│ ┌──────────────────────────┬───────────────────────────┐ │
200+
│ │ MCP Handlers │ REST API │ │
201+
│ │ - Tools (30+) │ - POST /vcons │ │
202+
│ │ - Resources │ - POST /vcons/batch │ │
203+
│ │ - Prompts │ - GET /vcons/:uuid │ │
204+
│ │ │ - GET /vcons │ │
205+
│ │ │ - DELETE /vcons/:uuid │ │
206+
│ │ │ - GET /health │ │
207+
│ └────────────┬─────────────┴────────────┬──────────────┘ │
208+
│ │ │ │
209+
│ ┌────────────▼──────────────────────────▼──────────────┐ │
210+
│ │ VCon Service │ │
211+
│ │ - Lifecycle hooks (beforeCreate, afterCreate, ...) │ │
212+
│ │ - Validation │ │
213+
│ │ - Metrics │ │
214+
│ └────────────────────────┬─────────────────────────────┘ │
215+
│ │ │
216+
│ ┌────────────────────────▼─────────────────────────────┐ │
217+
│ │ Plugin Manager │ │
218+
│ │ - Privacy plugins │ │
219+
│ │ - Access control │ │
220+
│ │ - Custom extensions │ │
221+
│ └────────────────────────┬─────────────────────────────┘ │
222+
│ │ │
223+
└───────────────────────────┼──────────────────────────────────┘
224+
│ Supabase Client
225+
226+
┌──────────▼───────────┐
227+
│ PostgreSQL │
228+
│ (Supabase) │
229+
│ │
230+
│ - vCon Tables │
231+
│ - pgvector │
232+
│ - GIN/GiST Indexes │
233+
└──────────────────────┘
197234
```
198235

199236
### Data Flow
@@ -301,19 +338,6 @@ For production deployments:
301338

302339
---
303340

304-
## Rate Limits
305-
306-
Default rate limits (configurable):
307-
308-
| Operation Type | Limit |
309-
|---------------|-------|
310-
| Search operations | 100/min |
311-
| Create operations | 50/min |
312-
| Other operations | 200/min |
313-
| Embedding generation | 10/min |
314-
315-
---
316-
317341
## Error Handling
318342

319343
All API responses include error information:
@@ -332,7 +356,6 @@ interface ErrorResponse {
332356
- `NOT_FOUND` - vCon or resource not found
333357
- `DATABASE_ERROR` - Database operation failed
334358
- `PERMISSION_DENIED` - Insufficient permissions
335-
- `RATE_LIMIT_EXCEEDED` - Too many requests
336359

337360
---
338361

0 commit comments

Comments
 (0)