@lovelybunch/mcp 1.0.75-alpha.8 → 1.0.75

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.
@@ -1,175 +0,0 @@
1
- import type { ChangeProposal } from '@lovelybunch/types'
2
- import { proposalJsonSchemas } from '@lovelybunch/core'
3
-
4
- export interface MCPTool {
5
- name: string
6
- description: string
7
- parameters: {
8
- type: 'object'
9
- properties: Record<string, any>
10
- required?: string[]
11
- additionalProperties?: boolean
12
- }
13
- }
14
-
15
- export interface MCPToolCall {
16
- name: string
17
- arguments: Record<string, any>
18
- }
19
-
20
- // Use pre-computed JSON schemas from core
21
- const filtersProperties = proposalJsonSchemas.filters
22
- const createProperties = proposalJsonSchemas.create
23
- const updateProperties = proposalJsonSchemas.update
24
- const createRequired = proposalJsonSchemas.createRequired
25
-
26
- export const listProposalsTool: MCPTool = {
27
- name: "list_proposals",
28
- description: "List all change proposals with metadata only (title, ID, status, priority, tags)",
29
- parameters: {
30
- type: "object",
31
- properties: {
32
- filters: {
33
- type: "object",
34
- description: "Optional filters for the proposal list",
35
- properties: filtersProperties
36
- }
37
- }
38
- }
39
- }
40
-
41
- export const proposalsTool: MCPTool = {
42
- name: "change_proposals",
43
- description: "Manage change proposals - create, read, update, delete proposals. IMPORTANT: When searching for proposals by topic or keyword, always use filters.search to filter results server-side. The returned count reflects filtered results.",
44
- parameters: {
45
- type: "object",
46
- properties: {
47
- operation: {
48
- type: "string",
49
- enum: ["list", "get", "create", "update", "delete"],
50
- description: "The operation to perform on proposals"
51
- },
52
- id: {
53
- type: "string",
54
- description: "Proposal ID (required for get, update, delete operations)"
55
- },
56
- // Filters for list operation - auto-generated from Zod schema
57
- filters: {
58
- type: "object",
59
- description: "Filters for list operation. Use search to find proposals by keyword - results are filtered server-side for accuracy.",
60
- properties: filtersProperties
61
- },
62
- // Proposal data for create operation - auto-generated from Zod schema
63
- proposal: {
64
- type: "object",
65
- description: "Proposal data for create/update operations. For create: intent and content are required. For update: at least one field is required.",
66
- properties: createProperties,
67
- required: [...createRequired]
68
- }
69
- },
70
- required: ["operation"]
71
- }
72
- }
73
-
74
- /**
75
- * Read-only version of the proposals tool for AI assistant.
76
- * Only exposes list and get operations - no create/update/delete.
77
- * Creating proposals should be done by coding agents (Claude Code, Cursor, etc.) or via the UI.
78
- */
79
- export const proposalsReadOnlyTool: MCPTool = {
80
- name: "change_proposals",
81
- description: "READ-ONLY: Search and read change proposals. You can ONLY use 'list' and 'get' operations. You CANNOT create, update, or delete proposals — that should be done by coding agents (Claude Code, Cursor, etc.) which have broader codebase context, or via the Proposals UI.",
82
- parameters: {
83
- type: "object",
84
- properties: {
85
- operation: {
86
- type: "string",
87
- enum: ["list", "get"],
88
- description: "ONLY 'list' or 'get' are allowed. 'list' to search/browse proposals, 'get' to retrieve a specific proposal by ID"
89
- },
90
- id: {
91
- type: "string",
92
- description: "Proposal ID (required for get operation)"
93
- },
94
- // Filters auto-generated from Zod schema
95
- filters: {
96
- type: "object",
97
- description: "Filters for list operation. Use search to find proposals by keyword.",
98
- properties: filtersProperties
99
- }
100
- },
101
- required: ["operation"]
102
- }
103
- }
104
-
105
- /**
106
- * Full CRUD proposals tool that includes create and update operations.
107
- * Uses Zod schemas for validation.
108
- */
109
- export const proposalsFullTool: MCPTool = {
110
- name: "change_proposals",
111
- description: "Full CRUD for change proposals - create, read, update, delete. Use this when you need to create or modify proposals via MCP.",
112
- parameters: {
113
- type: "object",
114
- properties: {
115
- operation: {
116
- type: "string",
117
- enum: ["list", "get", "create", "update", "delete"],
118
- description: "The operation to perform"
119
- },
120
- id: {
121
- type: "string",
122
- description: "Proposal ID (required for get, update, delete operations)"
123
- },
124
- filters: {
125
- type: "object",
126
- description: "Filters for list operation",
127
- properties: filtersProperties
128
- },
129
- // For create - all fields from CreateProposalInputSchema
130
- proposal: {
131
- type: "object",
132
- description: "Proposal data for create operation",
133
- properties: createProperties,
134
- required: [...createRequired]
135
- },
136
- // For update - partial fields from UpdateProposalInputSchema
137
- updates: {
138
- type: "object",
139
- description: "Fields to update (for update operation). At least one field required.",
140
- properties: updateProperties
141
- }
142
- },
143
- required: ["operation"]
144
- }
145
- }
146
-
147
- export function validateProposalData(data: any): Partial<ChangeProposal> {
148
- const proposal: Partial<ChangeProposal> = {}
149
-
150
- if (data.intent) proposal.intent = data.intent
151
- if (data.content) proposal.content = data.content
152
- if (data.author) proposal.author = data.author
153
- if (data.planSteps) proposal.planSteps = data.planSteps
154
- if (data.evidence) proposal.evidence = data.evidence
155
- if (data.policies) proposal.policies = data.policies
156
- if (data.featureFlags) proposal.featureFlags = data.featureFlags
157
- if (data.experiments) proposal.experiments = data.experiments
158
- if (data.telemetryContracts) proposal.telemetryContracts = data.telemetryContracts
159
- if (data.releasePlan) proposal.releasePlan = data.releasePlan
160
- if (data.status) proposal.status = data.status
161
- if (data.metadata) proposal.metadata = data.metadata
162
- if (data.productSpecRef) proposal.productSpecRef = data.productSpecRef
163
-
164
- return proposal
165
- }
166
-
167
- export function createToolCall(operation: string, args: any): MCPToolCall {
168
- return {
169
- name: "change_proposals",
170
- arguments: {
171
- operation,
172
- ...args
173
- }
174
- }
175
- }