refine-backlog-mcp 1.0.6 → 1.0.7

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/glama.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://glama.ai/mcp/schemas/server.json",
3
+ "maintainers": [
4
+ "DavidNielsen1031"
5
+ ]
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "refine-backlog-mcp",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "MCP server for Refine Backlog — AI-powered backlog refinement",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -20,5 +20,28 @@
20
20
  "typescript": "^5.0.0",
21
21
  "@types/node": "^22.0.0",
22
22
  "ts-node": "^10.9.0"
23
- }
23
+ },
24
+ "author": "David Nielsen <refinebacklog@gmail.com>",
25
+ "homepage": "https://refinebacklog.com",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/DavidNielsen1031/refine-backlog.git",
29
+ "directory": "mcp"
30
+ },
31
+ "keywords": [
32
+ "mcp",
33
+ "backlog",
34
+ "refinement",
35
+ "agile",
36
+ "scrum",
37
+ "product-management",
38
+ "ai",
39
+ "claude"
40
+ ],
41
+ "files": [
42
+ "dist",
43
+ "README.md",
44
+ "LICENSE",
45
+ "glama.json"
46
+ ]
24
47
  }
package/Dockerfile DELETED
@@ -1,9 +0,0 @@
1
- FROM node:22-alpine
2
-
3
- # Install the published MCP server package
4
- RUN npm install -g refine-backlog-mcp@1.0.5
5
-
6
- # Run as non-root for security
7
- USER node
8
-
9
- ENTRYPOINT ["refine-backlog-mcp"]
package/server.ts DELETED
@@ -1,277 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Refine Backlog MCP Server
4
- *
5
- * Exposes Refine Backlog (https://refinebacklog.com) as a Model Context Protocol tool.
6
- * Compatible with Claude Desktop, Cursor, and any MCP-capable client.
7
- *
8
- * Usage: npx refine-backlog-mcp
9
- */
10
-
11
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
12
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
13
- import {
14
- CallToolRequestSchema,
15
- ListToolsRequestSchema,
16
- Tool,
17
- } from "@modelcontextprotocol/sdk/types.js";
18
-
19
- const API_BASE = "https://refinebacklog.com";
20
-
21
- // License key from MCP server environment — set REFINE_BACKLOG_KEY in Claude Desktop config.
22
- // This is the preferred way for MCP users with a paid subscription.
23
- const ENV_LICENSE_KEY = process.env.REFINE_BACKLOG_KEY ?? null;
24
-
25
- interface RefinedItem {
26
- title: string;
27
- problem: string;
28
- acceptanceCriteria: string[];
29
- estimate: "XS" | "S" | "M" | "L" | "XL";
30
- priority: string;
31
- tags: string[];
32
- assumptions?: string[];
33
- }
34
-
35
- interface RefineResponse {
36
- items: RefinedItem[];
37
- _meta: {
38
- requestId: string;
39
- model: string;
40
- inputTokens: number;
41
- outputTokens: number;
42
- costUsd: number;
43
- latencyMs: number;
44
- tier: string;
45
- };
46
- }
47
-
48
- const ESTIMATE_LABELS: Record<string, string> = {
49
- XS: "< 1 day",
50
- S: "1–2 days",
51
- M: "3–5 days",
52
- L: "1–2 weeks",
53
- XL: "2+ weeks",
54
- };
55
-
56
- function formatRefinedItems(items: RefinedItem[]): string {
57
- return items
58
- .map((item, i) => {
59
- const lines = [
60
- `## ${i + 1}. ${item.title}`,
61
- ``,
62
- `**Problem:** ${item.problem}`,
63
- ``,
64
- `**Estimate:** ${item.estimate} (${ESTIMATE_LABELS[item.estimate] ?? item.estimate})`,
65
- `**Priority:** ${item.priority}`,
66
- `**Tags:** ${item.tags.join(", ")}`,
67
- ``,
68
- `**Acceptance Criteria:**`,
69
- ...item.acceptanceCriteria.map((ac) => `- ${ac}`),
70
- ];
71
-
72
- if (item.assumptions && item.assumptions.length > 0) {
73
- lines.push(``, `**Assumptions / Open Questions:**`);
74
- item.assumptions.forEach((a) => lines.push(`- ${a}`));
75
- }
76
-
77
- return lines.join("\n");
78
- })
79
- .join("\n\n---\n\n");
80
- }
81
-
82
- const REFINE_TOOL: Tool = {
83
- name: "refine_backlog",
84
- description:
85
- "Refine messy backlog items into structured, actionable work items. " +
86
- "Returns each item with a clean title, problem statement, acceptance criteria, " +
87
- "T-shirt size estimate (XS/S/M/L/XL), priority with rationale, tags, and optional assumptions. " +
88
- "Free tier: up to 5 items per request. Pro: 25. Team: 50.\n\n" +
89
- "BEFORE calling this tool, ask the user TWO quick questions if they haven't already specified:\n" +
90
- "1. Would you like titles formatted as user stories? (\"As a [user], I want [goal], so that [benefit]\")\n" +
91
- "2. Would you like acceptance criteria in Gherkin format? (Given/When/Then)\n" +
92
- "Set useUserStories and useGherkin accordingly based on their answers. Both default to false.\n\n" +
93
- "LICENSE KEY: For unlimited requests and higher item limits, set REFINE_BACKLOG_KEY in your MCP server " +
94
- "environment config (Claude Desktop → claude_desktop_config.json → env section). " +
95
- "Get a key at https://refinebacklog.com/pricing",
96
- inputSchema: {
97
- type: "object",
98
- required: ["items"],
99
- properties: {
100
- items: {
101
- type: "array",
102
- items: { type: "string" },
103
- minItems: 1,
104
- maxItems: 50,
105
- description:
106
- "Array of raw backlog item strings to refine. " +
107
- "Each string is a rough description of work to be done.",
108
- },
109
- context: {
110
- type: "string",
111
- description:
112
- "Optional project context to improve relevance. " +
113
- 'Example: "B2B SaaS CRM for enterprise sales teams" or "Mobile fitness app for casual runners".',
114
- },
115
- licenseKey: {
116
- type: "string",
117
- description:
118
- "Optional. Refine Backlog license key for Pro or Team tier. " +
119
- "Preferred: set REFINE_BACKLOG_KEY in your MCP server env config instead of passing inline. " +
120
- "Get a key at https://refinebacklog.com/pricing. Free tier (5 items, 3 req/day) works without a key.",
121
- },
122
- useUserStories: {
123
- type: "boolean",
124
- description:
125
- 'Format titles as user stories: "As a [user], I want [goal], so that [benefit]". Default: false.',
126
- },
127
- useGherkin: {
128
- type: "boolean",
129
- description:
130
- "Format acceptance criteria as Gherkin: Given/When/Then. Default: false.",
131
- },
132
- },
133
- },
134
- };
135
-
136
- const server = new Server(
137
- {
138
- name: "refine-backlog",
139
- version: "1.0.0",
140
- },
141
- {
142
- capabilities: {
143
- tools: {},
144
- },
145
- }
146
- );
147
-
148
- server.setRequestHandler(ListToolsRequestSchema, async () => ({
149
- tools: [REFINE_TOOL],
150
- }));
151
-
152
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
153
- if (request.params.name !== "refine_backlog") {
154
- return {
155
- content: [{ type: "text", text: `Unknown tool: ${request.params.name}` }],
156
- isError: true,
157
- };
158
- }
159
-
160
- const args = request.params.arguments as {
161
- items: string[];
162
- context?: string;
163
- licenseKey?: string;
164
- useUserStories?: boolean;
165
- useGherkin?: boolean;
166
- };
167
-
168
- if (!args.items || args.items.length === 0) {
169
- return {
170
- content: [{ type: "text", text: "Error: items array is required and must not be empty." }],
171
- isError: true,
172
- };
173
- }
174
-
175
- const headers: Record<string, string> = {
176
- "Content-Type": "application/json",
177
- };
178
-
179
- // Inline arg takes precedence; env var is the recommended approach for MCP configs
180
- const resolvedKey = args.licenseKey ?? ENV_LICENSE_KEY;
181
- if (resolvedKey) {
182
- headers["x-license-key"] = resolvedKey;
183
- }
184
-
185
- const body: Record<string, unknown> = {
186
- items: args.items,
187
- };
188
-
189
- if (args.context) body.context = args.context;
190
- if (args.useUserStories !== undefined) body.useUserStories = args.useUserStories;
191
- if (args.useGherkin !== undefined) body.useGherkin = args.useGherkin;
192
-
193
- try {
194
- const response = await fetch(`${API_BASE}/api/refine`, {
195
- method: "POST",
196
- headers,
197
- body: JSON.stringify(body),
198
- });
199
-
200
- if (response.status === 429) {
201
- const body = await response.json().catch(() => ({})) as { error?: string; upgrade?: string };
202
- const msg = body.error ?? "Daily request limit reached on the free tier.";
203
- return {
204
- content: [{
205
- type: "text",
206
- text: `⚠️ ${msg}\n\n👉 Upgrade at https://refinebacklog.com/pricing\n\nOnce you have a key, add it to your Claude Desktop config:\n{\n "mcpServers": {\n "refine-backlog": {\n "command": "npx",\n "args": ["-y", "refine-backlog-mcp"],\n "env": { "REFINE_BACKLOG_KEY": "your-key-here" }\n }\n }\n}`,
207
- }],
208
- isError: true,
209
- };
210
- }
211
-
212
- if (response.status === 503) {
213
- return {
214
- content: [{ type: "text", text: "Refine Backlog AI service is temporarily unavailable. Please try again in a moment." }],
215
- isError: true,
216
- };
217
- }
218
-
219
- if (!response.ok) {
220
- const body = await response.json().catch(() => ({ error: "Unknown error" })) as {
221
- error?: string;
222
- upgrade?: string;
223
- itemsReceived?: number;
224
- itemsAllowed?: number;
225
- };
226
-
227
- // Item limit exceeded — clear upgrade prompt
228
- if (body.upgrade) {
229
- return {
230
- content: [{
231
- type: "text",
232
- text: `⚠️ ${body.error}\n\n👉 Upgrade at https://refinebacklog.com/pricing\n\nOnce you have a license key, pass it in your request as the \`licenseKey\` parameter.`,
233
- }],
234
- isError: true,
235
- };
236
- }
237
-
238
- return {
239
- content: [{ type: "text", text: `Error from Refine Backlog API: ${body.error ?? response.statusText}` }],
240
- isError: true,
241
- };
242
- }
243
-
244
- const data = await response.json() as RefineResponse;
245
- const formatted = formatRefinedItems(data.items);
246
-
247
- const meta = data._meta;
248
- const summary = [
249
- `\n\n---`,
250
- `*Refined ${data.items.length} item${data.items.length !== 1 ? "s" : ""} · ` +
251
- `${meta.latencyMs}ms · ` +
252
- `Tier: ${meta.tier} · ` +
253
- `Cost: $${meta.costUsd.toFixed(6)}*`,
254
- ].join("\n");
255
-
256
- return {
257
- content: [{ type: "text", text: formatted + summary }],
258
- };
259
- } catch (err) {
260
- const message = err instanceof Error ? err.message : String(err);
261
- return {
262
- content: [{ type: "text", text: `Failed to reach Refine Backlog API: ${message}` }],
263
- isError: true,
264
- };
265
- }
266
- });
267
-
268
- async function main() {
269
- const transport = new StdioServerTransport();
270
- await server.connect(transport);
271
- console.error("Refine Backlog MCP server running on stdio");
272
- }
273
-
274
- main().catch((err) => {
275
- console.error("Fatal error:", err);
276
- process.exit(1);
277
- });
package/tsconfig.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "Node16",
5
- "moduleResolution": "Node16",
6
- "outDir": "./dist",
7
- "rootDir": ".",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "declaration": true
12
- },
13
- "include": ["server.ts"],
14
- "exclude": ["node_modules", "dist"]
15
- }