@aigentyc/mcp 0.1.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/AGENTS.md +197 -0
- package/LICENSE +21 -0
- package/README.md +112 -0
- package/context7.json +3 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +289 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +10 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +70 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +31 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +79 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +10 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +28 -0
- package/dist/errors.js.map +1 -0
- package/dist/fs-safety.d.ts +29 -0
- package/dist/fs-safety.d.ts.map +1 -0
- package/dist/fs-safety.js +107 -0
- package/dist/fs-safety.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/llms-full.txt +659 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +57 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/analytics.d.ts +4 -0
- package/dist/tools/analytics.d.ts.map +1 -0
- package/dist/tools/analytics.js +82 -0
- package/dist/tools/analytics.js.map +1 -0
- package/dist/tools/backups.d.ts +4 -0
- package/dist/tools/backups.d.ts.map +1 -0
- package/dist/tools/backups.js +99 -0
- package/dist/tools/backups.js.map +1 -0
- package/dist/tools/config.d.ts +4 -0
- package/dist/tools/config.d.ts.map +1 -0
- package/dist/tools/config.js +84 -0
- package/dist/tools/config.js.map +1 -0
- package/dist/tools/corrections.d.ts +4 -0
- package/dist/tools/corrections.d.ts.map +1 -0
- package/dist/tools/corrections.js +69 -0
- package/dist/tools/corrections.js.map +1 -0
- package/dist/tools/data_stores.d.ts +4 -0
- package/dist/tools/data_stores.d.ts.map +1 -0
- package/dist/tools/data_stores.js +244 -0
- package/dist/tools/data_stores.js.map +1 -0
- package/dist/tools/documents.d.ts +4 -0
- package/dist/tools/documents.d.ts.map +1 -0
- package/dist/tools/documents.js +162 -0
- package/dist/tools/documents.js.map +1 -0
- package/dist/tools/extract.d.ts +4 -0
- package/dist/tools/extract.d.ts.map +1 -0
- package/dist/tools/extract.js +61 -0
- package/dist/tools/extract.js.map +1 -0
- package/dist/tools/files.d.ts +4 -0
- package/dist/tools/files.d.ts.map +1 -0
- package/dist/tools/files.js +198 -0
- package/dist/tools/files.js.map +1 -0
- package/dist/tools/golden_answers.d.ts +4 -0
- package/dist/tools/golden_answers.d.ts.map +1 -0
- package/dist/tools/golden_answers.js +117 -0
- package/dist/tools/golden_answers.js.map +1 -0
- package/dist/tools/helpers.d.ts +5 -0
- package/dist/tools/helpers.d.ts.map +1 -0
- package/dist/tools/helpers.js +10 -0
- package/dist/tools/helpers.js.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +35 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/jobs.d.ts +4 -0
- package/dist/tools/jobs.d.ts.map +1 -0
- package/dist/tools/jobs.js +78 -0
- package/dist/tools/jobs.js.map +1 -0
- package/dist/tools/link_sources.d.ts +4 -0
- package/dist/tools/link_sources.d.ts.map +1 -0
- package/dist/tools/link_sources.js +155 -0
- package/dist/tools/link_sources.js.map +1 -0
- package/dist/tools/misc.d.ts +8 -0
- package/dist/tools/misc.d.ts.map +1 -0
- package/dist/tools/misc.js +73 -0
- package/dist/tools/misc.js.map +1 -0
- package/dist/tools/page_questions.d.ts +4 -0
- package/dist/tools/page_questions.d.ts.map +1 -0
- package/dist/tools/page_questions.js +77 -0
- package/dist/tools/page_questions.js.map +1 -0
- package/dist/tools/personas.d.ts +4 -0
- package/dist/tools/personas.d.ts.map +1 -0
- package/dist/tools/personas.js +78 -0
- package/dist/tools/personas.js.map +1 -0
- package/dist/tools/tools_crud.d.ts +4 -0
- package/dist/tools/tools_crud.d.ts.map +1 -0
- package/dist/tools/tools_crud.js +207 -0
- package/dist/tools/tools_crud.js.map +1 -0
- package/dist/tools/types.d.ts +25 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +15 -0
- package/dist/tools/types.js.map +1 -0
- package/llms.txt +150 -0
- package/package.json +53 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# AGENTS.md — @aigentyc/mcp
|
|
2
|
+
|
|
3
|
+
Guide for AI coding assistants (Claude Code, Cursor, Windsurf, Claude Desktop, Codex) using or contributing to this MCP server. Humans: read `README.md` first.
|
|
4
|
+
|
|
5
|
+
**Live docs (always current):** see `context7.json` in this repo for the URL Context7 mirrors.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## What this package is
|
|
10
|
+
|
|
11
|
+
A Model Context Protocol (MCP) server that lets an LLM agent drive the **content & authoring** side of an Aigentyc project: documents, files, link-source crawling, custom tools, data stores, project config, backups, analytics. It is NOT a chat client — for embedding chat into your own app use the sister package `@aigentyc/chat-sdk`.
|
|
12
|
+
|
|
13
|
+
- Package name: `@aigentyc/mcp`
|
|
14
|
+
- Binary: `aigentyc-mcp` (Node 20+, ESM)
|
|
15
|
+
- Transport: stdio (default), wire into Claude Desktop / Cursor MCP config
|
|
16
|
+
- Auth: project-scoped API keys (`tyco_pk_...`) verified by Aigentyc auth-service
|
|
17
|
+
- Storage: `~/.aigentyc/config.json` (0600, refuses to start otherwise)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Canonical install + usage (paste-ready)
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# 1. Save + verify an API key (one-time per profile)
|
|
25
|
+
npx @aigentyc/mcp login \
|
|
26
|
+
--api-key tyco_pk_XXXX \
|
|
27
|
+
--project-id proj_XXXX
|
|
28
|
+
|
|
29
|
+
# 2. Wire into Claude Desktop / Cursor (one-time)
|
|
30
|
+
# See README for the JSON snippet. Restart the client.
|
|
31
|
+
|
|
32
|
+
# 3. Sanity check
|
|
33
|
+
npx @aigentyc/mcp doctor
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
For local dev against a self-hosted backend on a different port:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx @aigentyc/mcp login --api-key ... --project-id ... \
|
|
40
|
+
--base-url http://localhost:3000 \
|
|
41
|
+
--allow-insecure
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Decision tree: which tool to use
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
Need to add markdown / text content to the KB? → files_upload (paths)
|
|
50
|
+
Need to add raw text without a file? → documents_create_from_text
|
|
51
|
+
Need to crawl a public website into the KB? → link_sources_create + jobs_wait
|
|
52
|
+
Need to extract from a list of public URLs? → extract_from_urls + jobs_wait
|
|
53
|
+
Need to add a structured table (rows of data)? → data_stores_create + bulk_upsert
|
|
54
|
+
Need to scrape a website into a data store? → data_stores_scan_website + jobs_wait
|
|
55
|
+
Need to expose a custom action to chat? → tools_create (rest_api / custom_execute / hybrid)
|
|
56
|
+
Need to chain tools? → flows_create
|
|
57
|
+
Need to tweak system prompt or chat model? → config_update
|
|
58
|
+
Need to back up before a risky change? → backups_create + jobs_wait
|
|
59
|
+
Need to inspect what's already in the KB? → search_kb_search (read-only, non-streaming)
|
|
60
|
+
Need to see analytics? → analytics_overview / sessions / comments
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Important behaviors agents should know
|
|
66
|
+
|
|
67
|
+
### 1. Tool inputs are validated by Zod
|
|
68
|
+
|
|
69
|
+
Required string fields enforce `min(1)` server-side via the chat-tools layer. Don't try to call a tool with `""` to "see what happens" — Zod will 400 and the LLM will be told to ask the user for real values.
|
|
70
|
+
|
|
71
|
+
### 2. Async ops return jobIds
|
|
72
|
+
|
|
73
|
+
These tools are intentionally non-blocking:
|
|
74
|
+
`backups_create`, `backups_restore`, `extract_from_urls`, `data_stores_scan_website`, `page_questions_auto_generate`, `files_upload` (when `indexAsDocuments=true` and the batch is large).
|
|
75
|
+
|
|
76
|
+
Pattern:
|
|
77
|
+
```
|
|
78
|
+
const { jobId } = await tool({ ... })
|
|
79
|
+
const result = await jobs_wait({ jobId })
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
There's a per-project concurrency cap of 3 active jobs. If exceeded you get 429.
|
|
83
|
+
|
|
84
|
+
### 3. Destructive ops require `confirm: true`
|
|
85
|
+
|
|
86
|
+
`documents_delete`, `files_delete`, `data_stores_delete`, `tools_delete`, `flows_delete`, `personas_delete`, `link_sources_delete`, `golden_answers_delete`, `backups_restore`, `data_stores_bulk_delete`. The agent should ALWAYS state what's about to be deleted and ask the user to approve before passing `confirm: true`.
|
|
87
|
+
|
|
88
|
+
### 4. Secrets are server-rejected, not just client-warned
|
|
89
|
+
|
|
90
|
+
Calling `config_update({ patch: { openaiApiKey: "..." } })` returns 403 from the server, not a client warning. Same for `customHttpHeaders` and `neonConnectionString`. To rotate secrets, use the dashboard.
|
|
91
|
+
|
|
92
|
+
### 5. Custom tool code can't reference `process.env`
|
|
93
|
+
|
|
94
|
+
`tools_create` / `tools_update` rejects `transformCode` / `executeCode` containing `process.env`. The right way to inject secrets is `apiConfig.headers` with template placeholders that the executor resolves.
|
|
95
|
+
|
|
96
|
+
### 6. URL inputs are SSRF-prefiltered
|
|
97
|
+
|
|
98
|
+
`extract_from_urls`, `link_sources_create` reject RFC1918 / loopback / cloud-metadata hosts both client-side AND server-side. Don't try `192.168.x.x` or `169.254.169.254` — they 400.
|
|
99
|
+
|
|
100
|
+
### 7. File uploads are FS-sandboxed
|
|
101
|
+
|
|
102
|
+
`files_upload` rejects paths outside `$CWD` and `$HOME`, refuses non-regular files, refuses symlinks that escape, caps 50MB/file and 500MB/batch. Text formats only (`.md .txt .json .csv .html .yaml .xml .rtf .log`). Binary formats (PDF/DOC/DOCX) need to go through the dashboard's file upload — out of scope for v0.1.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Common pitfalls
|
|
107
|
+
|
|
108
|
+
- **"Tool created but agent doesn't see it"** → fully quit + relaunch the MCP client. The MCP server registers tools at startup.
|
|
109
|
+
|
|
110
|
+
- **"Created a doc but it's not under /knowledge-base/text"** → check `sourceType`. `documents_create_from_text` always uses `manual`. URLs sourced docs need `extract_from_urls` (which links them to a `link_source`).
|
|
111
|
+
|
|
112
|
+
- **"Tool fires with empty fields"** → the tool's `inputSchema` declared a string param without `required: true`. Update the tool schema.
|
|
113
|
+
|
|
114
|
+
- **"Persona writes return 404"** → upgrade your client; older agents may hit endpoints that didn't have writes.
|
|
115
|
+
|
|
116
|
+
- **"401 from a tool that worked yesterday"** → the API key was probably revoked. Re-run `aigentyc-mcp login`.
|
|
117
|
+
|
|
118
|
+
- **"Tool calls work for me but not from my CI"** → `~/.aigentyc/config.json` doesn't exist in the CI environment. Either run `login` in a build step or set `AIGENTYC_CONFIG=/path/to/config.json` env var pointing at a CI-safe location.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Repository layout
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
src/
|
|
126
|
+
├── cli.ts # entry: serve | login | logout | doctor
|
|
127
|
+
├── server.ts # stdio MCP bootstrap (uses @modelcontextprotocol/sdk)
|
|
128
|
+
├── client.ts # HTTP client (Bearer + X-Request-Id + retries + error map)
|
|
129
|
+
├── config.ts # ~/.aigentyc/config.json read/write (0600 enforced)
|
|
130
|
+
├── errors.ts # AigentycError + httpStatusToCode
|
|
131
|
+
├── fs-safety.ts # path resolve + glob + size cap (used by files_upload)
|
|
132
|
+
└── tools/ # one file per domain; each exports defineTool([])
|
|
133
|
+
├── documents.ts
|
|
134
|
+
├── files.ts
|
|
135
|
+
├── extract.ts
|
|
136
|
+
├── link_sources.ts
|
|
137
|
+
├── page_questions.ts
|
|
138
|
+
├── data_stores.ts
|
|
139
|
+
├── tools_crud.ts # custom tools + flows
|
|
140
|
+
├── golden_answers.ts
|
|
141
|
+
├── corrections.ts
|
|
142
|
+
├── personas.ts
|
|
143
|
+
├── config.ts
|
|
144
|
+
├── backups.ts
|
|
145
|
+
├── analytics.ts
|
|
146
|
+
├── misc.ts # branches, unified_links, audience, kb_search
|
|
147
|
+
├── jobs.ts # status / list / wait
|
|
148
|
+
└── helpers.ts # pid() + projectIdArg
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Adding a new tool
|
|
154
|
+
|
|
155
|
+
1. Pick a domain file (or create a new one if it's a new domain).
|
|
156
|
+
2. Use `defineTool({ name, title, description, inputSchema, handler })` from `./types.js`.
|
|
157
|
+
3. The handler gets parsed args (Zod-validated by the SDK) and an injected `DashboardClient`. Call `client.get/post/patch/delete(path, body|query)`.
|
|
158
|
+
4. Register it in `src/tools/index.ts` if a new domain.
|
|
159
|
+
5. Run `npm run build && npm run smoke` — the smoke test asserts no duplicate names + tool count.
|
|
160
|
+
|
|
161
|
+
Conventions:
|
|
162
|
+
- Tool names: `domain_action` (snake_case). Example: `documents_create_from_text`.
|
|
163
|
+
- Title: short human label.
|
|
164
|
+
- Description: tells the LLM **when** to call the tool, not **how**. Cross-reference adjacent tools when ambiguity is likely (e.g. "for URL-sourced content use extract_from_urls instead").
|
|
165
|
+
- Always use `pid(client, args.projectId)` to default to the active profile's projectId.
|
|
166
|
+
- Destructive tools: include `confirm: z.boolean().default(false)` and short-circuit when `false`.
|
|
167
|
+
- For long-running ops: assume the backend returns `{ jobId, status }` and don't try to wait inline. The user can chain `jobs_wait`.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Releasing a new version
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
node scripts/release.mjs # patch bump (default)
|
|
175
|
+
node scripts/release.mjs minor # minor bump
|
|
176
|
+
node scripts/release.mjs major # major bump
|
|
177
|
+
node scripts/release.mjs 1.2.3 # explicit
|
|
178
|
+
node scripts/release.mjs --dry # rehearsal (no publish)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
The script:
|
|
182
|
+
1. Bumps `package.json` version
|
|
183
|
+
2. Rewrites `context7.json` URL to self-reference the new version on jsdelivr
|
|
184
|
+
3. Runs `npm run build` (TypeScript + llms-full.txt)
|
|
185
|
+
4. `npm publish --access public`
|
|
186
|
+
5. Polls jsdelivr until the published tarball is mirrored
|
|
187
|
+
6. Prints the Context7 URLs for re-registration if needed
|
|
188
|
+
|
|
189
|
+
Requires npm credentials with publish rights on `@aigentyc`.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Where to ask for help
|
|
194
|
+
|
|
195
|
+
- Bugs / feature requests → file in this repo
|
|
196
|
+
- Questions about the **platform** (`app.aigentyc.com`) → main monorepo
|
|
197
|
+
- Questions about embedding a chat UI → `@aigentyc/chat-sdk`
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 aiGentyc
|
|
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,112 @@
|
|
|
1
|
+
# @aigentyc/mcp
|
|
2
|
+
|
|
3
|
+
Model Context Protocol server for [aiGentyc](https://aigentyc.com) — lets
|
|
4
|
+
Claude Code, Cursor, Windsurf, and any other MCP-compatible agent drive the
|
|
5
|
+
content/authoring side of your aiGentyc project (documents, crawling, data
|
|
6
|
+
stores, custom tools, config, backups, …) without clicking through the
|
|
7
|
+
dashboard.
|
|
8
|
+
|
|
9
|
+
Chat/search embedding is **not** part of this package — use the separate
|
|
10
|
+
`aigentyc-chat-sdk` (React) for user-facing chat.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx @aigentyc/mcp login \
|
|
16
|
+
--api-key tyco_pk_XXXX \
|
|
17
|
+
--project-id proj_XXXX
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`login` verifies the key against `/api/auth/api-keys/verify` and writes
|
|
21
|
+
`~/.aigentyc/config.json` with `0600` perms.
|
|
22
|
+
|
|
23
|
+
**Dev-only flag**: pass `--allow-insecure` to permit plaintext HTTP against
|
|
24
|
+
non-loopback hosts (e.g. a staging box without TLS). Never use this against
|
|
25
|
+
production — all real traffic must be HTTPS.
|
|
26
|
+
|
|
27
|
+
Then wire it into your agent:
|
|
28
|
+
|
|
29
|
+
### Claude Desktop / Claude Code
|
|
30
|
+
|
|
31
|
+
`~/Library/Application Support/Claude/claude_desktop_config.json` (macOS):
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"mcpServers": {
|
|
36
|
+
"aigentyc": {
|
|
37
|
+
"command": "npx",
|
|
38
|
+
"args": ["-y", "@aigentyc/mcp"]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Cursor
|
|
45
|
+
|
|
46
|
+
Settings → MCP → add server:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"aigentyc": {
|
|
51
|
+
"command": "npx",
|
|
52
|
+
"args": ["-y", "@aigentyc/mcp"]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Commands
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
aigentyc-mcp serve Run the stdio MCP server (default when invoked with no args)
|
|
61
|
+
aigentyc-mcp login Save + verify an API key profile
|
|
62
|
+
aigentyc-mcp logout Remove a profile
|
|
63
|
+
aigentyc-mcp doctor Verify config + dashboard reachability
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Tools (v0.1)
|
|
67
|
+
|
|
68
|
+
Vertical slice shipped in this release:
|
|
69
|
+
|
|
70
|
+
- `documents_list`, `documents_get`, `documents_delete`, `documents_create_from_text`
|
|
71
|
+
- `jobs_status`, `jobs_list`, `jobs_wait`
|
|
72
|
+
|
|
73
|
+
More domains (files, link sources, data stores, custom tools, config,
|
|
74
|
+
backups, analytics) land in subsequent releases.
|
|
75
|
+
|
|
76
|
+
## Security
|
|
77
|
+
|
|
78
|
+
- API keys are project-scoped; a key for project A cannot read/write B.
|
|
79
|
+
- `~/.aigentyc/config.json` is written `0600`. The server refuses to start
|
|
80
|
+
with wider perms.
|
|
81
|
+
- The HTTP client refuses plaintext HTTP to non-loopback hosts.
|
|
82
|
+
- Destructive operations (e.g. `documents_delete`) require `confirm: true`.
|
|
83
|
+
- Per-API-key rate limits: 300 reads/min, 60 writes/min (429 over limit).
|
|
84
|
+
- Every API-key-authed request is logged server-side
|
|
85
|
+
(`api_key_audit_log` table) with `keyId`, `projectId`, `route`,
|
|
86
|
+
`method`, `status`, and `X-Request-Id` for tracing.
|
|
87
|
+
- `files_upload` refuses paths that escape `$CWD` or `$HOME`, rejects
|
|
88
|
+
non-regular files, and caps batches at 50MB/file, 500MB total.
|
|
89
|
+
- `extract_from_urls` prefilters RFC1918 / loopback / cloud-metadata URLs.
|
|
90
|
+
|
|
91
|
+
## Publishing
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
cd mcp-server
|
|
95
|
+
npm run build
|
|
96
|
+
npm run smoke # stdio JSON-RPC smoke test
|
|
97
|
+
npm pack --dry-run # inspect what would ship
|
|
98
|
+
npm publish --access public
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Deferred features
|
|
102
|
+
|
|
103
|
+
Tracked for v0.2+:
|
|
104
|
+
|
|
105
|
+
- **`backups_download_all` (ZIP) secret redaction** for API-key callers.
|
|
106
|
+
Current implementation redacts JSON downloads but not the archived ZIP.
|
|
107
|
+
Session callers are unaffected. Recommendation: use session for now.
|
|
108
|
+
- **`/api/extract/*` dual-auth + binary-file uploads** (PDF/DOC/DOCX).
|
|
109
|
+
The extract proxy currently has no auth guard — not exposed to MCP.
|
|
110
|
+
`files_upload` is therefore restricted to UTF-8 text formats only.
|
|
111
|
+
- **Analytics sessions/comments write paths** — MCP is read-only by design.
|
|
112
|
+
- **Custom rate-limit overrides per-key** — one limit for all keys today.
|
package/context7.json
ADDED
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { parseArgs } from "node:util";
|
|
3
|
+
import { assertSafePerms, configPath, DEFAULT_BASE_URL, loadConfig, saveConfig, upsertProfile, } from "./config.js";
|
|
4
|
+
import { runStdioServer } from "./server.js";
|
|
5
|
+
async function main() {
|
|
6
|
+
const [cmd, ...rest] = process.argv.slice(2);
|
|
7
|
+
switch (cmd) {
|
|
8
|
+
case undefined:
|
|
9
|
+
case "serve":
|
|
10
|
+
await runStdioServer();
|
|
11
|
+
return;
|
|
12
|
+
case "login":
|
|
13
|
+
await loginCmd(rest);
|
|
14
|
+
return;
|
|
15
|
+
case "logout":
|
|
16
|
+
await logoutCmd(rest);
|
|
17
|
+
return;
|
|
18
|
+
case "doctor":
|
|
19
|
+
await doctorCmd();
|
|
20
|
+
return;
|
|
21
|
+
case "--help":
|
|
22
|
+
case "-h":
|
|
23
|
+
case "help":
|
|
24
|
+
printHelp();
|
|
25
|
+
return;
|
|
26
|
+
default:
|
|
27
|
+
console.error(`Unknown command: ${cmd}`);
|
|
28
|
+
printHelp();
|
|
29
|
+
process.exit(2);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function printHelp() {
|
|
33
|
+
console.log(`aigentyc-mcp — MCP server for aiGentyc content authoring
|
|
34
|
+
|
|
35
|
+
USAGE
|
|
36
|
+
aigentyc-mcp [serve] Start stdio MCP server (default)
|
|
37
|
+
aigentyc-mcp login --api-key <k> --project-id <p> [opts]
|
|
38
|
+
aigentyc-mcp logout [--profile <name>]
|
|
39
|
+
aigentyc-mcp doctor Verify config + reachability
|
|
40
|
+
|
|
41
|
+
LOGIN OPTIONS
|
|
42
|
+
--api-key <k> aiGentyc API key (tyco_pk_...)
|
|
43
|
+
--project-id <p> Project UUID the key is scoped to
|
|
44
|
+
--profile <name> Named profile (default: "default")
|
|
45
|
+
--base-url <url> Dashboard base URL (default: ${DEFAULT_BASE_URL})
|
|
46
|
+
--no-activate Do not set this profile as active
|
|
47
|
+
--allow-insecure Dev-only: allow plaintext HTTP to non-loopback hosts
|
|
48
|
+
|
|
49
|
+
CONFIG FILE
|
|
50
|
+
${configPath()} (0600 perms)
|
|
51
|
+
`);
|
|
52
|
+
}
|
|
53
|
+
async function loginCmd(argv) {
|
|
54
|
+
const { values } = parseArgs({
|
|
55
|
+
args: argv,
|
|
56
|
+
strict: true,
|
|
57
|
+
options: {
|
|
58
|
+
"api-key": { type: "string" },
|
|
59
|
+
"project-id": { type: "string" },
|
|
60
|
+
profile: { type: "string", default: "default" },
|
|
61
|
+
"base-url": { type: "string", default: DEFAULT_BASE_URL },
|
|
62
|
+
"no-activate": { type: "boolean", default: false },
|
|
63
|
+
"allow-insecure": { type: "boolean", default: false },
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const apiKey = values["api-key"];
|
|
67
|
+
const projectId = values["project-id"];
|
|
68
|
+
if (!apiKey || !projectId) {
|
|
69
|
+
console.error("login requires both --api-key and --project-id. See --help.");
|
|
70
|
+
process.exit(2);
|
|
71
|
+
}
|
|
72
|
+
// Verify the key. In production, auth-service is fronted by nginx at the
|
|
73
|
+
// same base URL, so POST /api/auth/api-keys/verify works. In local dev,
|
|
74
|
+
// auth is on a different port and we get a 404 — fall back to pinging the
|
|
75
|
+
// dashboard documents endpoint, which is the canonical authenticated surface.
|
|
76
|
+
const baseUrl = values["base-url"].replace(/\/$/, "");
|
|
77
|
+
const verifyUrl = `${baseUrl}/api/auth/api-keys/verify`;
|
|
78
|
+
const pingUrl = `${baseUrl}/api/dashboard/${encodeURIComponent(projectId)}/documents?pageSize=1`;
|
|
79
|
+
let verified = false;
|
|
80
|
+
try {
|
|
81
|
+
const res = await fetch(verifyUrl, {
|
|
82
|
+
method: "POST",
|
|
83
|
+
headers: { "Content-Type": "application/json" },
|
|
84
|
+
body: JSON.stringify({ key: apiKey }),
|
|
85
|
+
});
|
|
86
|
+
if (res.status === 404) {
|
|
87
|
+
// Auth endpoint not at this origin (dev). Fall through to dashboard ping.
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
const body = (await res.json().catch(() => ({})));
|
|
91
|
+
if (!res.ok || !body.valid) {
|
|
92
|
+
console.error(`Key verification failed: ${body.error || `HTTP ${res.status}`}`);
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
if (body.projectId && body.projectId !== projectId) {
|
|
96
|
+
console.error(`API key is scoped to project ${body.projectId}, not ${projectId}. Refusing to save.`);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
verified = true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
console.error(`Could not reach ${verifyUrl}: ${err.message}`);
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
if (!verified) {
|
|
107
|
+
// Dashboard ping fallback.
|
|
108
|
+
try {
|
|
109
|
+
const res = await fetch(pingUrl, {
|
|
110
|
+
method: "GET",
|
|
111
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
112
|
+
});
|
|
113
|
+
if (res.status === 401) {
|
|
114
|
+
console.error("Key rejected by dashboard (401). Refusing to save.");
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
if (res.status === 403) {
|
|
118
|
+
console.error("Key accepted but not authorized for this project (403). Refusing to save.");
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
// 200 or 404 (project not found) → key was accepted by auth layer.
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
console.error(`Could not reach ${pingUrl}: ${err.message}`);
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const allowInsecure = !!values["allow-insecure"];
|
|
129
|
+
if (allowInsecure) {
|
|
130
|
+
console.warn("WARNING: --allow-insecure is enabled. Plaintext HTTP will be permitted. Use for local dev only.");
|
|
131
|
+
}
|
|
132
|
+
const existing = await loadConfig();
|
|
133
|
+
const next = upsertProfile(existing, values.profile, { baseUrl, projectId, apiKey, allowInsecure }, !values["no-activate"]);
|
|
134
|
+
await saveConfig(next);
|
|
135
|
+
console.log(`Saved profile "${values.profile}" → ${configPath()} (active: ${next.activeProfile})`);
|
|
136
|
+
}
|
|
137
|
+
async function logoutCmd(argv) {
|
|
138
|
+
const { values } = parseArgs({
|
|
139
|
+
args: argv,
|
|
140
|
+
strict: true,
|
|
141
|
+
options: { profile: { type: "string", default: "default" } },
|
|
142
|
+
});
|
|
143
|
+
const cfg = await loadConfig();
|
|
144
|
+
if (!cfg) {
|
|
145
|
+
console.log("No config file found, nothing to do.");
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const profile = values.profile;
|
|
149
|
+
if (!cfg.profiles[profile]) {
|
|
150
|
+
console.log(`Profile "${profile}" not found.`);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
delete cfg.profiles[profile];
|
|
154
|
+
if (cfg.activeProfile === profile) {
|
|
155
|
+
const remaining = Object.keys(cfg.profiles);
|
|
156
|
+
cfg.activeProfile = remaining[0] ?? "";
|
|
157
|
+
}
|
|
158
|
+
await saveConfig(cfg);
|
|
159
|
+
console.log(`Removed profile "${profile}".`);
|
|
160
|
+
}
|
|
161
|
+
async function doctorCmd() {
|
|
162
|
+
const results = [];
|
|
163
|
+
const record = (ok, label, detail) => {
|
|
164
|
+
results.push({ ok, label, detail });
|
|
165
|
+
const mark = ok ? "✓" : "✗";
|
|
166
|
+
const suffix = detail ? ` — ${detail}` : "";
|
|
167
|
+
console.log(`${mark} ${label}${suffix}`);
|
|
168
|
+
};
|
|
169
|
+
const cfg = await loadConfig();
|
|
170
|
+
if (!cfg) {
|
|
171
|
+
console.error(`No config found at ${configPath()}. Run: aigentyc-mcp login`);
|
|
172
|
+
process.exit(1);
|
|
173
|
+
}
|
|
174
|
+
console.log(`Config: ${configPath()}`);
|
|
175
|
+
console.log(`Active profile: ${cfg.activeProfile}`);
|
|
176
|
+
const profile = cfg.profiles[cfg.activeProfile];
|
|
177
|
+
if (!profile) {
|
|
178
|
+
console.error("Active profile does not exist.");
|
|
179
|
+
process.exit(1);
|
|
180
|
+
}
|
|
181
|
+
console.log(` baseUrl: ${profile.baseUrl}`);
|
|
182
|
+
console.log(` projectId: ${profile.projectId}`);
|
|
183
|
+
console.log(` apiKey: ${profile.apiKey.slice(0, 10)}…`);
|
|
184
|
+
console.log("");
|
|
185
|
+
// Config permissions (0600)
|
|
186
|
+
try {
|
|
187
|
+
await assertSafePerms();
|
|
188
|
+
record(true, "Config permissions 0600");
|
|
189
|
+
}
|
|
190
|
+
catch (err) {
|
|
191
|
+
record(false, "Config permissions", err.message);
|
|
192
|
+
}
|
|
193
|
+
// Base URL scheme / HTTPS check
|
|
194
|
+
let parsed = null;
|
|
195
|
+
try {
|
|
196
|
+
parsed = new URL(profile.baseUrl);
|
|
197
|
+
if (parsed.protocol === "https:") {
|
|
198
|
+
record(true, "Transport", "HTTPS");
|
|
199
|
+
}
|
|
200
|
+
else if (parsed.hostname === "localhost" ||
|
|
201
|
+
parsed.hostname === "127.0.0.1" ||
|
|
202
|
+
parsed.hostname === "::1") {
|
|
203
|
+
record(true, "Transport", `HTTP loopback (${parsed.hostname})`);
|
|
204
|
+
}
|
|
205
|
+
else if (profile.allowInsecure) {
|
|
206
|
+
record(true, "Transport", "HTTP (allow-insecure flag set)");
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
record(false, "Transport", `Plaintext HTTP to non-loopback host ${parsed.hostname}`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
catch (err) {
|
|
213
|
+
record(false, "Transport", `Invalid baseUrl: ${err.message}`);
|
|
214
|
+
}
|
|
215
|
+
// Clock skew — HEAD /api/health, parse Date header
|
|
216
|
+
try {
|
|
217
|
+
const start = Date.now();
|
|
218
|
+
const healthUrl = `${profile.baseUrl.replace(/\/$/, "")}/api/health`;
|
|
219
|
+
let res = await fetch(healthUrl, { method: "HEAD" });
|
|
220
|
+
// Some Next.js deployments don't accept HEAD — fall back to GET
|
|
221
|
+
if (res.status === 405 || res.status === 404) {
|
|
222
|
+
res = await fetch(healthUrl, { method: "GET" });
|
|
223
|
+
}
|
|
224
|
+
const dateHdr = res.headers.get("date");
|
|
225
|
+
if (!dateHdr) {
|
|
226
|
+
record(false, "Clock skew", "No Date header on /api/health response");
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
const serverMs = Date.parse(dateHdr);
|
|
230
|
+
const localMs = start + (Date.now() - start) / 2;
|
|
231
|
+
const deltaSec = Math.abs(localMs - serverMs) / 1000;
|
|
232
|
+
const deltaStr = `${deltaSec.toFixed(1)}s`;
|
|
233
|
+
if (deltaSec > 300) {
|
|
234
|
+
record(false, "Clock skew", `${deltaStr} (> 300s threshold)`);
|
|
235
|
+
}
|
|
236
|
+
else if (deltaSec > 60) {
|
|
237
|
+
record(false, "Clock skew", `WARN ${deltaStr} (> 60s — auth may fail intermittently)`);
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
record(true, "Clock skew", deltaStr);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
catch (err) {
|
|
245
|
+
record(false, "Clock skew", `Health endpoint unreachable: ${err.message}`);
|
|
246
|
+
}
|
|
247
|
+
// Outbound HTTPS — implicit in fetch; we just verified base-url reachable
|
|
248
|
+
if (parsed && parsed.protocol === "https:") {
|
|
249
|
+
try {
|
|
250
|
+
const res = await fetch(profile.baseUrl);
|
|
251
|
+
record(true, "Outbound HTTPS", `HTTP ${res.status}`);
|
|
252
|
+
}
|
|
253
|
+
catch (err) {
|
|
254
|
+
record(false, "Outbound HTTPS", err.message);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
record(true, "Outbound HTTPS", "skipped (non-HTTPS baseUrl)");
|
|
259
|
+
}
|
|
260
|
+
// API key + project reachability
|
|
261
|
+
try {
|
|
262
|
+
const res = await fetch(`${profile.baseUrl}/api/dashboard/${profile.projectId}/documents?pageSize=1`, { headers: { Authorization: `Bearer ${profile.apiKey}` } });
|
|
263
|
+
if (res.ok) {
|
|
264
|
+
record(true, "Dashboard reachability", `HTTP ${res.status}`);
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
const body = await res.text();
|
|
268
|
+
record(false, "Dashboard reachability", `HTTP ${res.status} — ${body.slice(0, 200)}`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
catch (err) {
|
|
272
|
+
record(false, "Dashboard reachability", err.message);
|
|
273
|
+
}
|
|
274
|
+
const failed = results.filter((r) => !r.ok).length;
|
|
275
|
+
console.log("");
|
|
276
|
+
if (failed === 0) {
|
|
277
|
+
console.log(`All ${results.length} checks passed.`);
|
|
278
|
+
process.exit(0);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
console.error(`${failed} of ${results.length} checks failed.`);
|
|
282
|
+
process.exit(1);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
main().catch((err) => {
|
|
286
|
+
console.error(err);
|
|
287
|
+
process.exit(1);
|
|
288
|
+
});
|
|
289
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACL,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,KAAK,UAAU,IAAI;IACjB,MAAM,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE7C,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,SAAS,CAAC;QACf,KAAK,OAAO;YACV,MAAM,cAAc,EAAE,CAAC;YACvB,OAAO;QACT,KAAK,OAAO;YACV,MAAM,QAAQ,CA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nB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ProfileConfig } from "./config.js";
|
|
2
|
+
export interface DashboardClient {
|
|
3
|
+
profile: ProfileConfig;
|
|
4
|
+
get<T = unknown>(path: string, query?: Record<string, unknown>): Promise<T>;
|
|
5
|
+
post<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
6
|
+
patch<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
7
|
+
delete<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
8
|
+
}
|
|
9
|
+
export declare function createClient(profile: ProfileConfig): DashboardClient;
|
|
10
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,aAAa,CAAC;IACvB,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5E,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5D,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC7D,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,eAAe,CAsFpE"}
|