@atlascompiler/mcp 1.0.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/LICENSE +21 -0
- package/README.md +365 -0
- package/dist/chunk-QNNAZCBS.js +1164 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +612 -0
- package/dist/index.d.ts +595 -0
- package/dist/index.js +84 -0
- package/package.json +48 -0
- package/skills/atlas/SKILL.md +193 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Atlas Compiler
|
|
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,365 @@
|
|
|
1
|
+
# @atlascompiler/mcp
|
|
2
|
+
|
|
3
|
+
The official [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for [Atlas](https://atlas-compiler.com).
|
|
4
|
+
|
|
5
|
+
Connects AI coding assistants, agents, and LLMs (Cursor, Claude Desktop, Windsurf, ChatGPT, MCP Inspector) directly to Atlas's zero-LLM web compilation pipeline. Provides deterministic, clean markdown extraction, site topology discovery, batch compilation, and bounded crawling without LLM hallucinations or context bloat.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **0-LLM Deterministic Compilation**: Content is parsed and structured purely through the Atlas web compiler engine—no hallucinated summaries, no injected noise, and no missing data.
|
|
12
|
+
- **Context-Window Protection**: Automatic Table of Contents (TOC), section splitting, token budgeting, and explicit truncation banners protect LLM context limits.
|
|
13
|
+
- **Modern Protocol Standard**: Implements the `2026-07-28` protocol era with native prompt caching hints (`cacheHints: { ttlMs, cacheScope }`) and asynchronous task tracking via `io.modelcontextprotocol/tasks`.
|
|
14
|
+
- **Dual Transports**:
|
|
15
|
+
- **Stdio CLI Bridge**: Run locally with `npx @atlascompiler/mcp` or configure directly into desktop IDEs.
|
|
16
|
+
- **Edge Streamable HTTP**: Native Cloudflare Worker endpoint mounted at `POST /mcp` for remote clients and web agents.
|
|
17
|
+
- **Enterprise-Grade Security**:
|
|
18
|
+
- Rejects CLI credential flags (`--api-key`, `-k`) with exit code 1 to eliminate secret exposure in `ps aux` and process inspection.
|
|
19
|
+
- Strict tenant isolation (`WHERE workspace_id = ?1 AND id = ?2`) on all `atlas://` resources.
|
|
20
|
+
- Hostile `Origin` blocking prevents browser-based cross-origin drive-by attacks.
|
|
21
|
+
- All outbound network requests are delegated to `atlas-egress` for zero-trust SSRF protection.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
### 1. Interactive Setup Wizard (Recommended)
|
|
28
|
+
|
|
29
|
+
Run the 1-click interactive setup wizard to validate your API key and automatically configure your desktop editors (Claude Desktop, Cursor, VS Code, Windsurf):
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Interactive mode (prompts for scope: Global, Project, or Both):
|
|
33
|
+
npx -y @atlascompiler/mcp init
|
|
34
|
+
|
|
35
|
+
# Or preselect scope directly via CLI flags:
|
|
36
|
+
npx -y @atlascompiler/mcp init --global # User-level (Claude, ~/.cursor, Windsurf)
|
|
37
|
+
npx -y @atlascompiler/mcp init --project # Repo-level (.cursor/mcp.json, .vscode/mcp.json)
|
|
38
|
+
npx -y @atlascompiler/mcp init --both # Both user-level and project-level
|
|
39
|
+
npx -y @atlascompiler/mcp init --skip-editors # Save credentials only
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The wizard:
|
|
43
|
+
- Prompts for your Atlas API key (`atlas_...`).
|
|
44
|
+
- Stores it securely in `~/.atlas/credentials.json` (POSIX `0600` permissions).
|
|
45
|
+
- Detects installed editors and merges the Atlas MCP server definition non-destructively without hardcoding sensitive tokens into editor configuration files.
|
|
46
|
+
- Distinguishes standard clients (`mcpServers`) from VS Code workspace format (`servers`).
|
|
47
|
+
- Optionally installs the canonical Atlas Agent Skill for local or global agent discovery.
|
|
48
|
+
|
|
49
|
+
### 2. Run Stdio Server Directly
|
|
50
|
+
|
|
51
|
+
Once configured via `init`, you can run the MCP server with zero flags or environment variables:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx -y @atlascompiler/mcp
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 3. CI/CD & Headless Environments
|
|
58
|
+
|
|
59
|
+
In automated pipelines, containerized environments, or ephemeral workers, supply credentials via the `ATLAS_API_KEY` environment variable:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
export ATLAS_API_KEY="atlas_your_api_key_here"
|
|
63
|
+
npx -y @atlascompiler/mcp
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
> **Security Note:** Passing API keys via CLI flags (`--api-key` or `-k`) is strictly prohibited and blocked by the CLI to avoid process table inspection leaks. Always use `init` or the `ATLAS_API_KEY` environment variable.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## CLI Commands
|
|
71
|
+
|
|
72
|
+
| Command | Description |
|
|
73
|
+
| :--- | :--- |
|
|
74
|
+
| `npx @atlascompiler/mcp` | Start stdio MCP server for Claude, Cursor, and other MCP clients. |
|
|
75
|
+
| `npx @atlascompiler/mcp init` | Interactive credential setup wizard, editor config, and Agent Skill install. |
|
|
76
|
+
| `npx @atlascompiler/mcp init --global` | Setup credentials and configure user-level editors (Claude, ~/.cursor, Windsurf). |
|
|
77
|
+
| `npx @atlascompiler/mcp init --project` | Setup credentials and configure repo-level editors (.cursor, .vscode). |
|
|
78
|
+
| `npx @atlascompiler/mcp skill` | Install canonical Atlas Agent Skill into project (`.agents/skills/atlas/SKILL.md`). |
|
|
79
|
+
| `npx @atlascompiler/mcp skill --global` | Install canonical Atlas Agent Skill globally (`~/.agents/skills/atlas/SKILL.md`). |
|
|
80
|
+
| `npx @atlascompiler/mcp whoami` | Inspect active credentials and resolution source (`env` vs `~/.atlas/credentials.json`). |
|
|
81
|
+
| `npx @atlascompiler/mcp logout` | Clear saved credentials from `~/.atlas/credentials.json`. |
|
|
82
|
+
| `npx @atlascompiler/mcp --help` | Show command line usage. |
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Agent Skill Installation
|
|
87
|
+
|
|
88
|
+
Atlas publishes an official Agent Skill for AI coding agents (Claude Code, Cursor, Antigravity, Windsurf) providing progressive disclosure playbooks for web compilation, scraping, mapping, crawling, and batch extraction.
|
|
89
|
+
|
|
90
|
+
### Option 1: Via `@atlascompiler/mcp` CLI (Fastest)
|
|
91
|
+
```bash
|
|
92
|
+
# In your current project:
|
|
93
|
+
npx -y @atlascompiler/mcp skill
|
|
94
|
+
|
|
95
|
+
# Or globally for all projects:
|
|
96
|
+
npx -y @atlascompiler/mcp skill --global
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Option 2: Via Skills Ecosystem CLI (`npx skills`)
|
|
100
|
+
```bash
|
|
101
|
+
# Via domain discovery (RFC 8615):
|
|
102
|
+
npx skills add atlas-compiler.com
|
|
103
|
+
|
|
104
|
+
# Or via GitHub repository:
|
|
105
|
+
npx skills add redcliffe0003/Atlas
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Option 3: Direct Download / Curl
|
|
109
|
+
```bash
|
|
110
|
+
curl -fsSL https://atlas-compiler.com/skill.md -o .agents/skills/atlas/SKILL.md
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Client Setup Configurations
|
|
116
|
+
|
|
117
|
+
Because `@atlascompiler/mcp` resolves credentials directly from `~/.atlas/credentials.json`, your editor configuration files never need hardcoded API keys!
|
|
118
|
+
|
|
119
|
+
### Cursor IDE
|
|
120
|
+
|
|
121
|
+
Add the server to your Cursor MCP settings (`~/.cursor/mcp.json` for global, or `.cursor/mcp.json` in your repository for project scope):
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"mcpServers": {
|
|
126
|
+
"atlas": {
|
|
127
|
+
"command": "npx",
|
|
128
|
+
"args": ["-y", "@atlascompiler/mcp"]
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### VS Code
|
|
135
|
+
|
|
136
|
+
Add the server to your project's `.vscode/mcp.json`:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"servers": {
|
|
141
|
+
"atlas": {
|
|
142
|
+
"command": "npx",
|
|
143
|
+
"args": ["-y", "@atlascompiler/mcp"]
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
> **Note:** VS Code expects the root key `"servers"`, whereas Cursor, Claude Desktop, and Windsurf use `"mcpServers"`. The `atlas-mcp init` wizard automatically applies the correct format for each editor target.
|
|
150
|
+
|
|
151
|
+
### Claude Desktop
|
|
152
|
+
|
|
153
|
+
Add the server to your Claude Desktop configuration:
|
|
154
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
155
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
156
|
+
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"mcpServers": {
|
|
161
|
+
"atlas": {
|
|
162
|
+
"command": "npx",
|
|
163
|
+
"args": ["-y", "@atlascompiler/mcp"]
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Windsurf / Codeium
|
|
170
|
+
|
|
171
|
+
Add the server to `~/.codeium/windsurf/mcp_config.json`:
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"mcpServers": {
|
|
176
|
+
"atlas": {
|
|
177
|
+
"command": "npx",
|
|
178
|
+
"args": ["-y", "@atlascompiler/mcp"]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Remote / Hosted Streamable HTTP (`POST /mcp`)
|
|
185
|
+
|
|
186
|
+
For remote agents or the official [MCP Inspector](https://github.com/modelcontextprotocol/inspector):
|
|
187
|
+
|
|
188
|
+
- **Server URL**: `https://api.atlas-compiler.com/mcp`
|
|
189
|
+
- **Transport**: Streamable HTTP
|
|
190
|
+
- **HTTP Headers**:
|
|
191
|
+
- `Authorization: Bearer atlas_YOUR_API_KEY_HERE`
|
|
192
|
+
- `Content-Type: application/json`
|
|
193
|
+
- `Accept: application/json`
|
|
194
|
+
- **OAuth Discovery**: Supports RFC 8414 protected resource discovery at `GET /.well-known/oauth-protected-resource`.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Available MCP Tools
|
|
199
|
+
|
|
200
|
+
### 1. `atlas_compile`
|
|
201
|
+
Compile any web page into a structured, high-density markdown document optimized for LLM reasoning.
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
{
|
|
205
|
+
url: string; // Required: Absolute HTTP/HTTPS URL
|
|
206
|
+
format?: 'markdown' | 'semantic'; // 'semantic' includes heading boundaries & section IDs
|
|
207
|
+
max_output_chars?: number; // Maximum characters to return in the tool response (default: 25000)
|
|
208
|
+
include_toc?: boolean; // Prepend a structured Table of Contents (default: true)
|
|
209
|
+
force_fresh?: boolean; // Bypass CDN and cache layers (default: false)
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Example Agent Invocation:**
|
|
214
|
+
> *"Compile the Stripe payment intents documentation at `https://docs.stripe.com/api/payment_intents` and show me the API parameters."*
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
### 2. `atlas_scrape`
|
|
219
|
+
Fast, lightweight single-page extraction when deep compilation isn't required.
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
{
|
|
223
|
+
url: string; // Required: Absolute HTTP/HTTPS URL
|
|
224
|
+
formats?: Array<'markdown' | 'links' | 'text'>; // Formats to extract (default: ['markdown'])
|
|
225
|
+
max_output_chars?: number; // Capping threshold (default: 20000)
|
|
226
|
+
timeout_ms?: number; // Maximum fetch timeout (default: 15000)
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Example Agent Invocation:**
|
|
231
|
+
> *"Scrape the main text and links from `https://news.ycombinator.com`."*
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
### 3. `atlas_map`
|
|
236
|
+
Discover site topology, sitemaps, and reachable URLs on a target domain without downloading page bodies.
|
|
237
|
+
|
|
238
|
+
```ts
|
|
239
|
+
{
|
|
240
|
+
url: string; // Required: Root URL or domain
|
|
241
|
+
limit?: number; // Maximum URLs to return (1-500, default: 100)
|
|
242
|
+
include_subdomains?: boolean; // Follow subdomains (default: false)
|
|
243
|
+
sitemap?: 'include' | 'only' | 'ignore'; // Sitemap handling strategy (default: 'include')
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**Example Agent Invocation:**
|
|
248
|
+
> *"Map the documentation pages on `https://docs.github.com` so we know what guides are available."*
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
### 4. `atlas_batch_compile`
|
|
253
|
+
Compile multiple pages in parallel (up to 20 URLs) with per-document success/failure aggregation.
|
|
254
|
+
|
|
255
|
+
```ts
|
|
256
|
+
{
|
|
257
|
+
urls: string[]; // Required: Array of 1 to 20 URLs
|
|
258
|
+
format?: 'markdown' | 'semantic'; // Content format
|
|
259
|
+
max_output_chars_per_page?: number; // Character cap per document (default: 15000)
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Example Agent Invocation:**
|
|
264
|
+
> *"Compile these 3 release note pages simultaneously: `['https://site.com/v1', 'https://site.com/v2', 'https://site.com/v3']`."*
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
### 5. `atlas_crawl`
|
|
269
|
+
Bounded crawl of a website starting from a seed URL with link discovery, depth limits, and path filtering.
|
|
270
|
+
|
|
271
|
+
```ts
|
|
272
|
+
{
|
|
273
|
+
url: string; // Required: Seed URL to begin crawling
|
|
274
|
+
max_pages?: number; // Maximum pages to process (1-20, default: 10)
|
|
275
|
+
max_depth?: number; // Maximum link hops (1-3, default: 2)
|
|
276
|
+
include_paths?: string[]; // URL path substrings to require (e.g. ['/docs/', '/guides/'])
|
|
277
|
+
exclude_paths?: string[]; // URL path substrings to skip (e.g. ['/changelog/', '/blog/'])
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
**Example Agent Invocation:**
|
|
282
|
+
> *"Crawl up to 10 pages in `/docs/` starting from `https://example.com/docs/welcome`."*
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Available MCP Resources (`atlas://`)
|
|
287
|
+
|
|
288
|
+
The server exposes deterministic resource URIs that allow AI agents to retrieve full document contents on demand without polluting tool call logs:
|
|
289
|
+
|
|
290
|
+
| Resource URI Template | Description |
|
|
291
|
+
| :--- | :--- |
|
|
292
|
+
| `atlas://compilations/{id}` | Complete compiled markdown document corresponding to compilation `{id}`. |
|
|
293
|
+
| `atlas://compilations/{id}/sections/{section_id}` | Specific heading section or slice from compilation `{id}`. |
|
|
294
|
+
| `atlas://crawls/{id}` | Full crawl manifest, discovered URLs, HTTP status codes, and artifact pointers. |
|
|
295
|
+
|
|
296
|
+
All resource reads enforce workspace tenant isolation (`WHERE workspace_id = ?1 AND id = ?2`). Cross-tenant access fails closed with `ATLAS_RESOURCE_NOT_FOUND` to eliminate data leakage.
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Programmatic Usage
|
|
301
|
+
|
|
302
|
+
You can also embed and customize `@atlascompiler/mcp` inside your own Node.js or TypeScript applications:
|
|
303
|
+
|
|
304
|
+
```ts
|
|
305
|
+
import { createAtlasMcpServer } from '@atlascompiler/mcp';
|
|
306
|
+
import { StdioServerTransport } from '@modelcontextprotocol/server';
|
|
307
|
+
|
|
308
|
+
const server = createAtlasMcpServer({
|
|
309
|
+
context: {
|
|
310
|
+
apiKey: process.env.ATLAS_API_KEY,
|
|
311
|
+
baseUrl: 'https://api.atlas-compiler.com',
|
|
312
|
+
},
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
const transport = new StdioServerTransport();
|
|
316
|
+
await server.connect(transport);
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### Providing Custom Executors (Testing / Stubs)
|
|
320
|
+
|
|
321
|
+
```ts
|
|
322
|
+
const server = createAtlasMcpServer({
|
|
323
|
+
scrapeExecutor: async (args) => ({
|
|
324
|
+
url: args.url,
|
|
325
|
+
markdown: '# Mock Content',
|
|
326
|
+
status: 200,
|
|
327
|
+
}),
|
|
328
|
+
});
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## Environment Variables
|
|
334
|
+
|
|
335
|
+
| Variable | Required | Default | Description |
|
|
336
|
+
| :--- | :--- | :--- | :--- |
|
|
337
|
+
| `ATLAS_API_KEY` | **Yes** | — | Your Atlas workspace API key (`atlas_...`). |
|
|
338
|
+
| `ATLAS_BASE_URL` | No | `https://api.atlas-compiler.com` | Base URL of the Atlas API or self-hosted backend. |
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Development & Testing
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
# Install dependencies
|
|
346
|
+
pnpm install
|
|
347
|
+
|
|
348
|
+
# Run unit and conformance tests (Vitest)
|
|
349
|
+
pnpm test
|
|
350
|
+
|
|
351
|
+
# Check types
|
|
352
|
+
pnpm typecheck
|
|
353
|
+
|
|
354
|
+
# Check code formatting & linting (Biome)
|
|
355
|
+
pnpm lint
|
|
356
|
+
|
|
357
|
+
# Build ESM & TypeScript declaration bundle
|
|
358
|
+
pnpm build
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## License
|
|
364
|
+
|
|
365
|
+
MIT © [Atlas Compiler](https://atlas-compiler.com)
|