@surfaceapi/mastra 0.1.0 → 0.1.2

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.
Files changed (3) hide show
  1. package/README.md +33 -4
  2. package/index.js +2 -2
  3. package/package.json +34 -8
package/README.md CHANGED
@@ -1,8 +1,24 @@
1
1
  # @surfaceapi/mastra
2
2
 
3
- Surface for Mastra: **the link-safety layer between an AI agent and the open web.**
3
+ Surface checks a short link before your agent opens it. The answer is fetch or skip. It never returns the page. A hop or a 1×1 pixel counts the same way, with no install. Free for the first million requests a month. https://nova-otter-delta-cloud.grok.me
4
4
 
5
- `surface_preflight` unwraps short links (t.co, bit.ly, lnkd.in, youtu.be), follows redirects and answers `fetch` or `skip`, without returning the page. On any error it answers `skip`.
5
+ This package adds that check to Mastra as one tool: `surface_preflight`.
6
+
7
+ Surface by Canada Site Ops. Ontario, Canada.
8
+
9
+ ## Get a free API key in about 10 seconds
10
+
11
+ No email, no card. Then set `SURFACE_KEY` or `SURFACE_API_KEY`, or pass `apiKey`. The tool sends it as `Authorization: Bearer <key>`.
12
+
13
+ ```bash
14
+ curl -s -X POST https://nova-otter-delta-cloud.grok.me/v1/keys
15
+ # returns {"key","created_at","free_monthly":1000000,"usage_url"}
16
+ export SURFACE_KEY=... # or SURFACE_API_KEY; paste the key value
17
+ ```
18
+
19
+ A key gets its own million free requests a month. Anonymous calls still work on a shared demo limit.
20
+
21
+ ## Install
6
22
 
7
23
  ```bash
8
24
  npm i @surfaceapi/mastra @mastra/core zod
@@ -14,6 +30,19 @@ import { surface_preflight } from "@surfaceapi/mastra";
14
30
  const agent = new Agent({ name: "reader", instructions: "Preflight every link before fetching it.", model, tools: { surface_preflight } });
15
31
  ```
16
32
 
17
- Free up to 1M requests/month; optional `SURFACE_API_KEY`. Remote MCP: `https://nova-otter-delta-cloud.grok.me/mcp` (tool `preflight_url`).
33
+ On any error the tool answers `skip`. You can also call `preflight(url, { apiKey })` directly.
34
+
35
+ ## Prefer MCP?
36
+
37
+ Point any MCP client at `https://nova-otter-delta-cloud.grok.me/mcp` (tool `preflight_url`), with the same key in `Authorization: Bearer <key>`.
38
+
39
+ ## Also listed
40
+
41
+ - Official MCP Registry: `me.grok.nova-otter-delta-cloud/surface`
42
+ - https://www.curatedmcp.com/marketplace/surface
43
+ - https://www.npmjs.com/package/@surfaceapi/mastra
44
+ - https://www.npmjs.com/package/@surfaceapi/surface
45
+ - https://pypi.org/project/surfaceapi/
46
+ - https://huggingface.co/spaces/surfaceapi/surface-preflight
18
47
 
19
- Homepage: https://otter-sand-wolf-spring.grok.me · MIT · Canada Site Ops
48
+ CLI and GitHub Action are coming soon.
package/index.js CHANGED
@@ -12,13 +12,13 @@ const env = (k) => (typeof process !== "undefined" && process.env ? process.env[
12
12
 
13
13
  export async function preflight(url, { apiKey, baseUrl, headers, timeoutMs = 15000 } = {}) {
14
14
  const base = (baseUrl || env("SURFACE_BASE_URL") || DEFAULT_BASE_URL).replace(/\/$/, "");
15
- const key = apiKey || env("SURFACE_API_KEY");
15
+ const key = apiKey || env("SURFACE_KEY") || env("SURFACE_API_KEY");
16
16
  const res = await fetch(base + "/v1/preflight", {
17
17
  method: "POST",
18
18
  headers: {
19
19
  "content-type": "application/json",
20
20
  accept: "application/json",
21
- "user-agent": "@surfaceapi/mastra/0.1.0",
21
+ "user-agent": "@surfaceapi/mastra/0.1.2",
22
22
  ...(key ? { authorization: "Bearer " + key } : {}),
23
23
  ...(headers || {}),
24
24
  },
package/package.json CHANGED
@@ -1,17 +1,43 @@
1
1
  {
2
2
  "name": "@surfaceapi/mastra",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Surface for Mastra: the link-safety layer between an AI agent and the open web. One tool, surface_preflight, that answers fetch or skip without returning the page.",
5
5
  "type": "module",
6
6
  "main": "./index.js",
7
7
  "types": "./index.d.ts",
8
- "exports": { ".": { "types": "./index.d.ts", "import": "./index.js" } },
9
- "files": ["index.js", "index.d.ts", "README.md", "LICENSE"],
10
- "keywords": ["mastra", "ai-agents", "tools", "link-safety", "url", "preflight", "mcp", "surface"],
8
+ "exports": {
9
+ ".": {
10
+ "types": "./index.d.ts",
11
+ "import": "./index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "index.js",
16
+ "index.d.ts",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "keywords": [
21
+ "mastra",
22
+ "ai-agents",
23
+ "tools",
24
+ "link-safety",
25
+ "url",
26
+ "preflight",
27
+ "mcp",
28
+ "surface"
29
+ ],
11
30
  "author": "Canada Site Ops <canada.site.ops@gmail.com>",
12
31
  "license": "MIT",
13
- "homepage": "https://otter-sand-wolf-spring.grok.me",
14
- "peerDependencies": { "@mastra/core": ">=0.10.0", "zod": ">=3.22.0" },
15
- "engines": { "node": ">=18" },
16
- "publishConfig": { "access": "public" }
32
+ "homepage": "https://nova-otter-delta-cloud.grok.me",
33
+ "peerDependencies": {
34
+ "@mastra/core": ">=0.10.0",
35
+ "zod": ">=3.22.0"
36
+ },
37
+ "engines": {
38
+ "node": ">=18"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ }
17
43
  }