naro-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.
Files changed (3) hide show
  1. package/README.md +7 -0
  2. package/dist/index.js +85 -0
  3. package/package.json +30 -0
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # naro-mcp
2
+
3
+ MCP server that deploys the current project to naro.
4
+
5
+ claude mcp add naro -- npx -y naro-mcp
6
+
7
+ Run `npx naro-cli login` once to authenticate (GitHub).
package/dist/index.js ADDED
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/index.ts
4
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
5
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
+ import {
7
+ CallToolRequestSchema,
8
+ ListToolsRequestSchema
9
+ } from "@modelcontextprotocol/sdk/types.js";
10
+ import { deployDirectory, readProjectEnv } from "naro-cli";
11
+ console.log = (...args) => {
12
+ process.stderr.write(`${args.map(String).join(" ")}
13
+ `);
14
+ };
15
+ var DEPLOY_TOOL = {
16
+ name: "deploy",
17
+ description: "Deploy the current Next.js project to naro using the naro login session. Builds it locally and publishes to Cloudflare, returning a live {name}.naro.sh URL. No Cloudflare credentials required \u2014 run `naro login` first to authenticate.",
18
+ inputSchema: {
19
+ type: "object",
20
+ properties: {
21
+ directory: {
22
+ type: "string",
23
+ description: "Absolute path to the project directory. Defaults to the current working directory."
24
+ },
25
+ name: {
26
+ type: "string",
27
+ description: "Deployment name / subdomain label. Defaults to the package.json name."
28
+ },
29
+ production: {
30
+ type: "boolean",
31
+ description: "Publish to production ({name}.naro.sh). Defaults to false, which deploys a preview at {name}-preview.naro.sh."
32
+ }
33
+ }
34
+ }
35
+ };
36
+ var server = new Server(
37
+ { name: "naro", version: "0.1.0" },
38
+ { capabilities: { tools: {} } }
39
+ );
40
+ server.setRequestHandler(ListToolsRequestSchema, () => ({
41
+ tools: [DEPLOY_TOOL]
42
+ }));
43
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
44
+ if (request.params.name !== "deploy") {
45
+ throw new Error(`Unknown tool: ${request.params.name}`);
46
+ }
47
+ const args = request.params.arguments ?? {};
48
+ const directory = args.directory ?? process.cwd();
49
+ const logs = [];
50
+ try {
51
+ const result = await deployDirectory(
52
+ directory,
53
+ {
54
+ name: args.name,
55
+ production: args.production ?? false,
56
+ env: readProjectEnv(directory)
57
+ },
58
+ (message) => logs.push(message)
59
+ );
60
+ return {
61
+ content: [
62
+ {
63
+ type: "text",
64
+ text: `Deployed ${directory} to ${result.url}
65
+
66
+ ${logs.join("\n")}`
67
+ }
68
+ ]
69
+ };
70
+ } catch (error) {
71
+ const message = error instanceof Error ? error.message : String(error);
72
+ return {
73
+ isError: true,
74
+ content: [
75
+ {
76
+ type: "text",
77
+ text: `Deploy failed: ${message}
78
+
79
+ ${logs.join("\n")}`
80
+ }
81
+ ]
82
+ };
83
+ }
84
+ });
85
+ await server.connect(new StdioServerTransport());
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "naro-mcp",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "bin": {
6
+ "naro-mcp": "./dist/index.js"
7
+ },
8
+ "files": [
9
+ "dist",
10
+ "README.md"
11
+ ],
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "dependencies": {
16
+ "@modelcontextprotocol/sdk": "^1.0.0",
17
+ "naro-cli": "0.1.0"
18
+ },
19
+ "devDependencies": {
20
+ "tsup": "8.5.0",
21
+ "tsx": "4.23.12",
22
+ "typescript": "7.0.2",
23
+ "@next-deploy/config": "0.1.0"
24
+ },
25
+ "scripts": {
26
+ "build": "tsup",
27
+ "typecheck": "tsc --noEmit",
28
+ "lint": "tsc --noEmit"
29
+ }
30
+ }