@cencori/mcp 0.2.0
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 +180 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +955 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +954 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +64 -0
package/README.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# @cencori/mcp
|
|
2
|
+
|
|
3
|
+
**MCP server for Cencori — docs, gateway, memory, agents, sessions, governance, and multimodal inference for AI agents.**
|
|
4
|
+
|
|
5
|
+
Expose Cencori documentation and authenticated platform operations to AI clients (Cursor, Claude Desktop, etc.) via the [Model Context Protocol](https://modelcontextprotocol.io).
|
|
6
|
+
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## What this package does
|
|
12
|
+
|
|
13
|
+
`@cencori/mcp` is a **thin stdio adapter**. It does not embed business logic — each MCP tool maps to an existing Cencori HTTP endpoint, and the platform enforces its own auth, tier gating, and governance rules.
|
|
14
|
+
|
|
15
|
+
Tools are organized into **action tiers**:
|
|
16
|
+
|
|
17
|
+
| Tier | Gate | What |
|
|
18
|
+
|------|------|------|
|
|
19
|
+
| **Read** | API key present | metrics, health, quota, list/get across memory, sessions, agents, governance |
|
|
20
|
+
| **Write** (inference) | `CENCORI_MCP_WRITE=1` | run models: chat, RAG, embeddings, vision, documents, images, moderation |
|
|
21
|
+
| **Destructive** | `CENCORI_MCP_DESTRUCTIVE=1` | *(Phase 2+)* delete / approve / reject |
|
|
22
|
+
| **Manual (never executed)** | — guidance only | API keys, governance activation, billing, member/access changes → `how_to_*` tools return steps + a dashboard link |
|
|
23
|
+
|
|
24
|
+
Reads are safe by default. Anything that costs money or changes state is opt-in. Security-sensitive actions (API keys, billing, access, policy activation) are **never** performed by the MCP — it only tells the user how to do them.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Quick start
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx @cencori/mcp
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Docs + `how_to_*` guidance tools work with **no API key**. Add `CENCORI_API_KEY` for reads; add `CENCORI_MCP_WRITE=1` to enable inference.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Tools
|
|
39
|
+
|
|
40
|
+
### Public — no API key
|
|
41
|
+
|
|
42
|
+
| Tool | Description |
|
|
43
|
+
|------|-------------|
|
|
44
|
+
| `search_docs` / `get_doc` / `list_docs` | Search / fetch / list Cencori documentation |
|
|
45
|
+
| `how_to_create_api_key`, `how_to_edit_api_key`, `how_to_revoke_api_key` | Guidance: API-key lifecycle (manual) |
|
|
46
|
+
| `how_to_activate_policy`, `how_to_respond_to_change_request` | Guidance: governance checker steps (manual) |
|
|
47
|
+
| `how_to_change_plan`, `how_to_manage_billing` | Guidance: billing / plan / credits (manual) |
|
|
48
|
+
| `how_to_manage_members` | Guidance: members / roles / SSO (manual) |
|
|
49
|
+
|
|
50
|
+
### Read — requires `CENCORI_API_KEY`
|
|
51
|
+
|
|
52
|
+
| Area | Tools |
|
|
53
|
+
|------|-------|
|
|
54
|
+
| Gateway | `list_models`, `get_metrics`, `get_health`, `check_quota` |
|
|
55
|
+
| Agents | `list_agents`, `get_agent`, `poll_agent_actions` |
|
|
56
|
+
| Memory | `list_memories`, `search_memory`, `get_memory`, `list_memory_entities`, `get_memory_graph`, `get_forget_suggestions` |
|
|
57
|
+
| Sessions | `list_sessions`, `get_session`, `get_session_events` |
|
|
58
|
+
| Governance | `list_policies`, `list_roles`, `list_change_requests`, `get_governance_ledger`, `get_governance_evidence`, `list_governance_templates` |
|
|
59
|
+
|
|
60
|
+
### Inference (Write-tier) — requires `CENCORI_MCP_WRITE=1`
|
|
61
|
+
|
|
62
|
+
`generate_text`, `generate_rag`, `create_embeddings`, `moderate_content`, `generate_image`, `describe_image`, `ocr_image`, `classify_image`, `extract_document`, `summarize_document`, `query_document`.
|
|
63
|
+
|
|
64
|
+
> Roadmap: Phase 2 adds memory/agent/session write + destructive tools; Phase 3 adds governance policy *drafting*. Audio (TTS/STT) is planned once binary/multipart transport lands.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Cursor / Claude Desktop config
|
|
69
|
+
|
|
70
|
+
### Docs + guidance only (zero setup)
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"mcpServers": {
|
|
75
|
+
"cencori": { "command": "npx", "args": ["-y", "@cencori/mcp"] }
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Reads across the platform
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"mcpServers": {
|
|
85
|
+
"cencori": {
|
|
86
|
+
"command": "npx",
|
|
87
|
+
"args": ["-y", "@cencori/mcp"],
|
|
88
|
+
"env": { "CENCORI_API_KEY": "csk_..." }
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Reads + inference
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"mcpServers": {
|
|
99
|
+
"cencori": {
|
|
100
|
+
"command": "npx",
|
|
101
|
+
"args": ["-y", "@cencori/mcp"],
|
|
102
|
+
"env": { "CENCORI_API_KEY": "csk_...", "CENCORI_MCP_WRITE": "1" }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
See [`mcp.example.json`](./mcp.example.json) for a copy-paste template.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Environment variables
|
|
113
|
+
|
|
114
|
+
| Variable | Required | Default | Description |
|
|
115
|
+
|----------|----------|---------|-------------|
|
|
116
|
+
| `CENCORI_DOCS_BASE_URL` | No | `https://cencori.com` | Host for docs API (`/api/docs/*`) |
|
|
117
|
+
| `CENCORI_BASE_URL` | No | `https://cencori.com` | Host for platform API (`/api/v1/*`, `/api/ai/*`) |
|
|
118
|
+
| `CENCORI_API_KEY` | For platform tools | — | Project API key (`csk_...`). **Must be spelled `CENCORI_API_KEY`** |
|
|
119
|
+
| `CENCORI_MCP_WRITE` | No | `false` | Enable inference (and, later, additive writes) |
|
|
120
|
+
| `CENCORI_MCP_DESTRUCTIVE` | No | `false` | Enable destructive actions (implies `WRITE`). No effect until Phase 2 |
|
|
121
|
+
| `CENCORI_MCP_FEATURES` | No | all enabled | Comma list: `docs`, `guidance`, `gateway`, `agents`, `memory`, `sessions`, `governance`, `multimodal` |
|
|
122
|
+
|
|
123
|
+
### Behavior
|
|
124
|
+
|
|
125
|
+
| `CENCORI_API_KEY` | `CENCORI_MCP_WRITE` | Registered |
|
|
126
|
+
|-------------------|---------------------|-----------|
|
|
127
|
+
| unset | — | docs + `how_to_*` guidance only |
|
|
128
|
+
| set | unset | guidance + all **reads** |
|
|
129
|
+
| set | `1` | guidance + reads + **inference** |
|
|
130
|
+
|
|
131
|
+
Restart the MCP server after changing env vars.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Development
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
cd packages/mcp
|
|
139
|
+
npm install
|
|
140
|
+
npm run build # tsup → dist/index.js (stdio entry)
|
|
141
|
+
npm start # run server on stdio
|
|
142
|
+
npm test # build + integration tests
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Package layout
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
src/
|
|
149
|
+
├── index.ts # stdio entrypoint
|
|
150
|
+
├── server.ts # McpServer wiring + tiered registration
|
|
151
|
+
├── config.ts # env parsing + capability flags
|
|
152
|
+
├── client.ts # PlatformClient (Bearer → /api/*, get/post/patch/del)
|
|
153
|
+
├── http.ts # shared fetch timeout + error body parsing
|
|
154
|
+
├── tools.ts # barrel exports
|
|
155
|
+
├── docs/client.ts # DocsClient (fetch → /api/docs/*)
|
|
156
|
+
└── tools/
|
|
157
|
+
├── shared.ts # annotation tiers + jsonResult()
|
|
158
|
+
├── docs.ts, gateway.ts, agents.ts
|
|
159
|
+
├── memory.ts, sessions.ts, governance.ts
|
|
160
|
+
├── multimodal.ts # inference (Write-tier)
|
|
161
|
+
└── guidance.ts # how_to_* manual-only guidance
|
|
162
|
+
test/
|
|
163
|
+
└── integration.test.mjs
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Build notes
|
|
167
|
+
|
|
168
|
+
- **Shebang:** Added by `tsup.config.ts` banner. Do not add `#!/usr/bin/env node` to `src/index.ts`.
|
|
169
|
+
- **Logging:** `console.error()` only — stdout is JSON-RPC.
|
|
170
|
+
- **Auth:** `Authorization: Bearer <key>` works for both `/api/v1/*` and `/api/ai/*` (gateway accepts it alongside `CENCORI_API_KEY`).
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Testing
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
npm test
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Runs HTTP + MCP-stdio tests. Tool-composition/tiering tests run offline (no key). Set `CENCORI_API_KEY` to also run authenticated read tests.
|
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
ADDED