salesflare-mcp-server 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.
Files changed (73) hide show
  1. package/API.md +691 -0
  2. package/CHANGELOG.md +49 -0
  3. package/CLAUDE.md +117 -0
  4. package/CONTRIBUTING.md +399 -0
  5. package/FIX_PLAN.md +70 -0
  6. package/INSPECTOR.md +191 -0
  7. package/LICENSE +21 -0
  8. package/PUBLISH.md +73 -0
  9. package/README.md +383 -0
  10. package/dist/auth/api-key-auth.d.ts +75 -0
  11. package/dist/auth/api-key-auth.d.ts.map +1 -0
  12. package/dist/auth/api-key-auth.js +103 -0
  13. package/dist/auth/oauth-auth.d.ts +81 -0
  14. package/dist/auth/oauth-auth.d.ts.map +1 -0
  15. package/dist/auth/oauth-auth.js +123 -0
  16. package/dist/auth/token-manager.d.ts +105 -0
  17. package/dist/auth/token-manager.d.ts.map +1 -0
  18. package/dist/auth/token-manager.js +87 -0
  19. package/dist/client/salesflare-client.d.ts +219 -0
  20. package/dist/client/salesflare-client.d.ts.map +1 -0
  21. package/dist/client/salesflare-client.js +484 -0
  22. package/dist/index.d.ts +15 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +82 -0
  25. package/dist/server.d.ts +39 -0
  26. package/dist/server.d.ts.map +1 -0
  27. package/dist/server.js +140 -0
  28. package/dist/tools/companies.d.ts +45 -0
  29. package/dist/tools/companies.d.ts.map +1 -0
  30. package/dist/tools/companies.js +392 -0
  31. package/dist/tools/contacts.d.ts +45 -0
  32. package/dist/tools/contacts.d.ts.map +1 -0
  33. package/dist/tools/contacts.js +290 -0
  34. package/dist/tools/deals.d.ts +46 -0
  35. package/dist/tools/deals.d.ts.map +1 -0
  36. package/dist/tools/deals.js +442 -0
  37. package/dist/tools/pipeline.d.ts +43 -0
  38. package/dist/tools/pipeline.d.ts.map +1 -0
  39. package/dist/tools/pipeline.js +328 -0
  40. package/dist/tools/tasks.d.ts +44 -0
  41. package/dist/tools/tasks.d.ts.map +1 -0
  42. package/dist/tools/tasks.js +406 -0
  43. package/dist/transport/http-transport.d.ts +36 -0
  44. package/dist/transport/http-transport.d.ts.map +1 -0
  45. package/dist/transport/http-transport.js +173 -0
  46. package/dist/transport/stdio-transport.d.ts +37 -0
  47. package/dist/transport/stdio-transport.d.ts.map +1 -0
  48. package/dist/transport/stdio-transport.js +129 -0
  49. package/dist/types/company.d.ts +223 -0
  50. package/dist/types/company.d.ts.map +1 -0
  51. package/dist/types/company.js +8 -0
  52. package/dist/types/contact.d.ts +166 -0
  53. package/dist/types/contact.d.ts.map +1 -0
  54. package/dist/types/contact.js +8 -0
  55. package/dist/types/deal.d.ts +203 -0
  56. package/dist/types/deal.d.ts.map +1 -0
  57. package/dist/types/deal.js +8 -0
  58. package/dist/types/pipeline.d.ts +116 -0
  59. package/dist/types/pipeline.d.ts.map +1 -0
  60. package/dist/types/pipeline.js +8 -0
  61. package/dist/types/task.d.ts +154 -0
  62. package/dist/types/task.d.ts.map +1 -0
  63. package/dist/types/task.js +8 -0
  64. package/dist/utils/errors.d.ts +128 -0
  65. package/dist/utils/errors.d.ts.map +1 -0
  66. package/dist/utils/errors.js +205 -0
  67. package/dist/utils/validation.d.ts +354 -0
  68. package/dist/utils/validation.d.ts.map +1 -0
  69. package/dist/utils/validation.js +716 -0
  70. package/package.json +49 -0
  71. package/test-tasks-debug.js +21 -0
  72. package/test-tasks-params.js +52 -0
  73. package/test-tools.js +171 -0
@@ -0,0 +1,129 @@
1
+ /**
2
+ * stdio transport implementation for MCP protocol communication
3
+ *
4
+ * Handles MCP protocol communication over stdin/stdout with proper error handling
5
+ * and graceful shutdown. All logging goes to stderr to avoid protocol corruption.
6
+ *
7
+ * @module transport/stdio-transport
8
+ */
9
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
10
+ import { SalesflareError, ErrorCode } from '../utils/errors.js';
11
+ /**
12
+ * Check if stdin and stdout are available (TTY check)
13
+ *
14
+ * @returns true if stdio transport can be used
15
+ */
16
+ function isStdioAvailable() {
17
+ // Check if stdin is readable and stdout is writable
18
+ // Note: In MCP context, we might not be in a TTY but still have valid stdin/stdout pipes
19
+ return process.stdin.readable && process.stdout.writable;
20
+ }
21
+ /**
22
+ * Create a new stdio transport instance
23
+ *
24
+ * @param config - Transport configuration with server instance
25
+ * @returns Configured StdioServerTransport instance
26
+ * @throws SalesflareError if stdio is not available
27
+ */
28
+ export function createStdioTransport(config) {
29
+ try {
30
+ // Validate stdio availability
31
+ if (!isStdioAvailable()) {
32
+ throw new SalesflareError({
33
+ code: ErrorCode.CONFIG_ERROR,
34
+ message: 'stdio transport requires stdin/stdout',
35
+ fix: 'Run this server from an MCP client like Claude Desktop',
36
+ retryable: false,
37
+ });
38
+ }
39
+ // Create the transport instance
40
+ const transport = new StdioServerTransport();
41
+ return transport;
42
+ }
43
+ catch (error) {
44
+ // If already a SalesflareError, re-throw
45
+ if (error instanceof SalesflareError) {
46
+ throw error;
47
+ }
48
+ // Wrap other errors
49
+ throw new SalesflareError({
50
+ code: ErrorCode.API_ERROR,
51
+ message: `Failed to create stdio transport: ${error instanceof Error ? error.message : 'Unknown error'}`,
52
+ fix: 'Ensure the server is running in an environment with valid stdin/stdout',
53
+ retryable: false,
54
+ });
55
+ }
56
+ }
57
+ /**
58
+ * Start the MCP server with stdio transport
59
+ *
60
+ * Connects the server to stdio transport, sets up graceful shutdown,
61
+ * and logs status to stderr.
62
+ *
63
+ * @param config - Transport configuration with server instance
64
+ * @returns Promise that resolves when server is connected and ready
65
+ * @throws SalesflareError if connection fails
66
+ */
67
+ export async function startStdioServer(config) {
68
+ let transport = null;
69
+ try {
70
+ // Create transport
71
+ transport = createStdioTransport(config);
72
+ // Set up graceful shutdown handlers
73
+ setupShutdownHandlers(transport);
74
+ // Connect server to transport
75
+ await config.server.connect(transport);
76
+ // Log to stderr (never stdout to avoid protocol corruption)
77
+ console.error('Salesflare MCP server running on stdio');
78
+ }
79
+ catch (error) {
80
+ // Log error details to stderr
81
+ if (error instanceof SalesflareError) {
82
+ console.error(`Transport error: ${error.message}`);
83
+ if (error.fix) {
84
+ console.error(`Fix: ${error.fix}`);
85
+ }
86
+ }
87
+ else {
88
+ console.error(`Transport error: ${error instanceof Error ? error.message : 'Unknown error'}`);
89
+ }
90
+ // Re-throw as SalesflareError
91
+ if (error instanceof SalesflareError) {
92
+ throw error;
93
+ }
94
+ throw new SalesflareError({
95
+ code: ErrorCode.API_ERROR,
96
+ message: `Failed to start stdio server: ${error instanceof Error ? error.message : 'Unknown error'}`,
97
+ fix: 'Check the server logs and ensure all dependencies are properly configured',
98
+ retryable: false,
99
+ });
100
+ }
101
+ }
102
+ /**
103
+ * Set up graceful shutdown handlers for SIGINT and SIGTERM
104
+ *
105
+ * @param transport - The stdio transport to close on shutdown
106
+ */
107
+ function setupShutdownHandlers(transport) {
108
+ const shutdown = async (signal) => {
109
+ console.error(`Shutting down... (${signal})`);
110
+ try {
111
+ // Close the transport gracefully
112
+ await transport.close();
113
+ console.error('Transport closed successfully');
114
+ }
115
+ catch (error) {
116
+ console.error(`Error during shutdown: ${error instanceof Error ? error.message : 'Unknown error'}`);
117
+ }
118
+ // Exit cleanly
119
+ process.exit(0);
120
+ };
121
+ // Handle SIGINT (Ctrl+C)
122
+ process.on('SIGINT', () => {
123
+ void shutdown('SIGINT');
124
+ });
125
+ // Handle SIGTERM (termination signal)
126
+ process.on('SIGTERM', () => {
127
+ void shutdown('SIGTERM');
128
+ });
129
+ }
@@ -0,0 +1,223 @@
1
+ /**
2
+ * Company types for Salesflare MCP Server
3
+ *
4
+ * TypeScript interfaces and type definitions for Company CRUD operations.
5
+ *
6
+ * @module types/company
7
+ */
8
+ import { z } from 'zod';
9
+ import { createCompanyListSchema, createCompanyCreateSchema, createCompanyUpdateSchema } from '../utils/validation.js';
10
+ /**
11
+ * Core company entity interface
12
+ * Represents a company/organization in Salesflare CRM with essential fields
13
+ */
14
+ export interface Company {
15
+ /** Unique identifier (UUID) */
16
+ id: string;
17
+ /** Company name (required per D-01) */
18
+ name: string;
19
+ /** Company website URL (optional per D-02) */
20
+ website?: string;
21
+ /** Industry category (optional per D-02) */
22
+ industry?: string;
23
+ /** Phone number (optional per D-02) */
24
+ phone?: string;
25
+ /** Company description (optional per D-02) */
26
+ description?: string;
27
+ /** Address information (nested object per D-03) */
28
+ address?: {
29
+ /** Street address */
30
+ street?: string;
31
+ /** City */
32
+ city?: string;
33
+ /** State or province */
34
+ state?: string;
35
+ /** ZIP or postal code */
36
+ zip?: string;
37
+ /** Country */
38
+ country?: string;
39
+ };
40
+ /** Social media profiles (nested object per D-04) */
41
+ social_media?: {
42
+ /** LinkedIn profile URL */
43
+ linkedin?: string;
44
+ /** Twitter/X handle or URL */
45
+ twitter?: string;
46
+ /** Facebook page URL */
47
+ facebook?: string;
48
+ };
49
+ /** Tags associated with the company (per D-05) */
50
+ tags?: string[];
51
+ /** Owner/assigned user information (per D-06) */
52
+ owner?: {
53
+ /** User UUID */
54
+ id: string;
55
+ /** User name */
56
+ name: string;
57
+ };
58
+ /** Creation timestamp (ISO 8601) */
59
+ created_at: string;
60
+ /** Last update timestamp (ISO 8601) */
61
+ updated_at: string;
62
+ }
63
+ /**
64
+ * Paginated company list response
65
+ * Returned by the list companies endpoint
66
+ */
67
+ export interface CompanyListResponse {
68
+ /** Array of companies for the current page */
69
+ companies: Company[];
70
+ /** Total number of companies matching the filter */
71
+ total: number;
72
+ /** Current page number (1-indexed) */
73
+ page: number;
74
+ /** Number of items per page */
75
+ limit: number;
76
+ /** Whether there are more pages available */
77
+ has_more: boolean;
78
+ }
79
+ /**
80
+ * Filter parameters for listing companies
81
+ * All fields are optional - omit to skip filtering
82
+ */
83
+ export interface CompanyListFilters {
84
+ /** Filter by name (partial match, case-insensitive per D-12) */
85
+ name?: string;
86
+ /** Filter by industry (exact match per D-13) */
87
+ industry?: string;
88
+ /** Filter by tags (companies must have all specified tags, AND logic per D-14) */
89
+ tags?: string[];
90
+ /** Filter by owner ID or name (per D-15) */
91
+ owner?: string;
92
+ /** Free-text search across company fields (per D-16) */
93
+ search?: string;
94
+ /** Page number (default: 1) */
95
+ page?: number;
96
+ /** Items per page (default: 20, max: 100) */
97
+ limit?: number;
98
+ }
99
+ /**
100
+ * Input data for creating a new company
101
+ * Name is required, all other fields are optional
102
+ */
103
+ export interface CompanyCreateInput {
104
+ /** Company name (required per D-01) */
105
+ name: string;
106
+ /** Company website URL (optional per D-02) */
107
+ website?: string;
108
+ /** Industry category (optional per D-02) */
109
+ industry?: string;
110
+ /** Phone number (optional per D-02) */
111
+ phone?: string;
112
+ /** Company description (optional per D-02) */
113
+ description?: string;
114
+ /** Address information (nested object per D-03) */
115
+ address?: {
116
+ /** Street address */
117
+ street?: string;
118
+ /** City */
119
+ city?: string;
120
+ /** State or province */
121
+ state?: string;
122
+ /** ZIP or postal code */
123
+ zip?: string;
124
+ /** Country */
125
+ country?: string;
126
+ };
127
+ /** Social media profiles (nested object per D-04) */
128
+ social_media?: {
129
+ /** LinkedIn profile URL */
130
+ linkedin?: string;
131
+ /** Twitter/X handle or URL */
132
+ twitter?: string;
133
+ /** Facebook page URL */
134
+ facebook?: string;
135
+ };
136
+ /** Tags to assign to the company (per D-05) */
137
+ tags?: string[];
138
+ /** Owner/user ID to assign the company to (per D-06) */
139
+ owner_id?: string;
140
+ }
141
+ /**
142
+ * Input data for updating an existing company
143
+ * All fields are optional - only provided fields will be updated (PATCH semantics per D-18)
144
+ */
145
+ export interface CompanyUpdateInput {
146
+ /** Company name (optional) */
147
+ name?: string;
148
+ /** Company website URL (optional) */
149
+ website?: string;
150
+ /** Industry category (optional) */
151
+ industry?: string;
152
+ /** Phone number (optional) */
153
+ phone?: string;
154
+ /** Company description (optional) */
155
+ description?: string;
156
+ /** Address information (optional) */
157
+ address?: {
158
+ /** Street address */
159
+ street?: string;
160
+ /** City */
161
+ city?: string;
162
+ /** State or province */
163
+ state?: string;
164
+ /** ZIP or postal code */
165
+ zip?: string;
166
+ /** Country */
167
+ country?: string;
168
+ };
169
+ /** Social media profiles (optional) */
170
+ social_media?: {
171
+ /** LinkedIn profile URL */
172
+ linkedin?: string;
173
+ /** Twitter/X handle or URL */
174
+ twitter?: string;
175
+ /** Facebook page URL */
176
+ facebook?: string;
177
+ };
178
+ /** Tags to assign to the company (optional) */
179
+ tags?: string[];
180
+ /** Owner/user ID to assign the company to (optional) */
181
+ owner_id?: string;
182
+ }
183
+ /**
184
+ * Type inference from schemas for runtime validation
185
+ * These types are derived from the Zod validation schemas
186
+ */
187
+ /** Type for company list parameters (inferred from schema) */
188
+ export type CompanyListParams = z.infer<ReturnType<typeof createCompanyListSchema>>;
189
+ /** Type for company create data (inferred from schema) */
190
+ export type CompanyCreateData = z.infer<ReturnType<typeof createCompanyCreateSchema>>;
191
+ /** Type for company update data (inferred from schema) */
192
+ export type CompanyUpdateData = z.infer<ReturnType<typeof createCompanyUpdateSchema>>;
193
+ /**
194
+ * Standard MCP tool response format for company operations
195
+ * Returns both human-readable text and structured JSON data
196
+ */
197
+ export interface CompanyToolResponse {
198
+ /** Response content array */
199
+ content: [
200
+ /** Human-readable summary text */
201
+ {
202
+ type: 'text';
203
+ text: string;
204
+ },
205
+ /** JSON stringified data */
206
+ {
207
+ type: 'text';
208
+ text: string;
209
+ }
210
+ ];
211
+ }
212
+ /**
213
+ * MCP tool response format for delete operations
214
+ * Returns only a success confirmation (no company data for deleted records)
215
+ */
216
+ export interface CompanyDeleteResponse {
217
+ /** Response content array with single text item */
218
+ content: [{
219
+ type: 'text';
220
+ text: string;
221
+ }];
222
+ }
223
+ //# sourceMappingURL=company.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"company.d.ts","sourceRoot":"","sources":["../../src/types/company.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AA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C,KAAK,CAAC,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC;AAEpF,0DAA0D;AAC1D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC;AAEtF,0DAA0D;AAC1D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC;AAEtF;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,6BAA6B;IAC7B,OAAO,EAAE;QACP,kCAAkC;QAClC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE;QAC9B,4BAA4B;QAC5B;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE;KAC/B,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,mDAAmD;IACnD,OAAO,EAAE,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3C"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Company types for Salesflare MCP Server
3
+ *
4
+ * TypeScript interfaces and type definitions for Company CRUD operations.
5
+ *
6
+ * @module types/company
7
+ */
8
+ export {};
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Contact types for Salesflare MCP Server
3
+ *
4
+ * TypeScript interfaces and type definitions for Contact CRUD operations.
5
+ *
6
+ * @module types/contact
7
+ */
8
+ import { z } from 'zod';
9
+ import { createContactListSchema, createContactCreateSchema, createContactUpdateSchema } from '../utils/validation.js';
10
+ /**
11
+ * Core contact entity interface
12
+ * Represents a contact in Salesflare CRM with essential fields
13
+ */
14
+ export interface Contact {
15
+ /** Unique identifier (UUID) */
16
+ id: string;
17
+ /** Contact's full name */
18
+ name: string;
19
+ /** Contact's email address */
20
+ email: string;
21
+ /** Contact's phone number (optional) */
22
+ phone?: string;
23
+ /** Associated company information (optional) */
24
+ company?: {
25
+ /** Company UUID */
26
+ id: string;
27
+ /** Company name */
28
+ name: string;
29
+ };
30
+ /** Job title at the company (optional) */
31
+ job_title?: string;
32
+ /** Tags associated with the contact (optional) */
33
+ tags?: string[];
34
+ /** Owner/assigned user information (optional) */
35
+ owner?: {
36
+ /** User UUID */
37
+ id: string;
38
+ /** User name */
39
+ name: string;
40
+ };
41
+ /** Creation timestamp (ISO 8601) */
42
+ created_at: string;
43
+ /** Last update timestamp (ISO 8601) */
44
+ updated_at: string;
45
+ }
46
+ /**
47
+ * Paginated contact list response
48
+ * Returned by the list contacts endpoint
49
+ */
50
+ export interface ContactListResponse {
51
+ /** Array of contacts for the current page */
52
+ contacts: Contact[];
53
+ /** Total number of contacts matching the filter */
54
+ total: number;
55
+ /** Current page number (1-indexed) */
56
+ page: number;
57
+ /** Number of items per page */
58
+ limit: number;
59
+ /** Whether there are more pages available */
60
+ has_more: boolean;
61
+ }
62
+ /**
63
+ * Filter parameters for listing contacts
64
+ * All fields are optional - omit to skip filtering
65
+ */
66
+ export interface ContactListFilters {
67
+ /** Filter by exact email match */
68
+ email?: string;
69
+ /** Filter by name (partial match, case-insensitive) */
70
+ name?: string;
71
+ /** Filter by company ID (UUID) */
72
+ company_id?: string;
73
+ /** Filter by tags (contacts must have all specified tags) */
74
+ tags?: string[];
75
+ /** Filter by owner ID or name */
76
+ owner?: string;
77
+ /** Filter by email domain (partial match) */
78
+ domain?: string;
79
+ /** Free-text search across contact fields */
80
+ search?: string;
81
+ /** Page number (default: 1) */
82
+ page?: number;
83
+ /** Items per page (default: 20, max: 100) */
84
+ limit?: number;
85
+ }
86
+ /**
87
+ * Input data for creating a new contact
88
+ * Email is required, all other fields are optional
89
+ */
90
+ export interface ContactCreateInput {
91
+ /** Contact's full name (optional) */
92
+ name?: string;
93
+ /** Contact's email address (required) */
94
+ email: string;
95
+ /** Contact's phone number (optional) */
96
+ phone?: string;
97
+ /** Company ID to associate with the contact (optional) */
98
+ company_id?: string;
99
+ /** Job title at the company (optional) */
100
+ job_title?: string;
101
+ /** Tags to assign to the contact (optional) */
102
+ tags?: string[];
103
+ /** Owner/user ID to assign the contact to (optional) */
104
+ owner_id?: string;
105
+ }
106
+ /**
107
+ * Input data for updating an existing contact
108
+ * All fields are optional - only provided fields will be updated
109
+ */
110
+ export interface ContactUpdateInput {
111
+ /** Contact's full name (optional) */
112
+ name?: string;
113
+ /** Contact's email address (optional) */
114
+ email?: string;
115
+ /** Contact's phone number (optional) */
116
+ phone?: string;
117
+ /** Company ID to associate with the contact (optional) */
118
+ company_id?: string;
119
+ /** Job title at the company (optional) */
120
+ job_title?: string;
121
+ /** Tags to assign to the contact (optional) */
122
+ tags?: string[];
123
+ /** Owner/user ID to assign the contact to (optional) */
124
+ owner_id?: string;
125
+ }
126
+ /**
127
+ * Type inference from schemas for runtime validation
128
+ * These types are derived from the Zod validation schemas
129
+ */
130
+ /** Type for contact list parameters (inferred from schema) */
131
+ export type ContactListParams = z.infer<ReturnType<typeof createContactListSchema>>;
132
+ /** Type for contact create data (inferred from schema) */
133
+ export type ContactCreateData = z.infer<ReturnType<typeof createContactCreateSchema>>;
134
+ /** Type for contact update data (inferred from schema) */
135
+ export type ContactUpdateData = z.infer<ReturnType<typeof createContactUpdateSchema>>;
136
+ /**
137
+ * Standard MCP tool response format for contact operations
138
+ * Returns both human-readable text and structured JSON data
139
+ */
140
+ export interface ContactToolResponse {
141
+ /** Response content array */
142
+ content: [
143
+ /** Human-readable summary text */
144
+ {
145
+ type: 'text';
146
+ text: string;
147
+ },
148
+ /** JSON stringified data */
149
+ {
150
+ type: 'text';
151
+ text: string;
152
+ }
153
+ ];
154
+ }
155
+ /**
156
+ * MCP tool response format for delete operations
157
+ * Returns only a success confirmation (no JSON data for deleted records)
158
+ */
159
+ export interface ContactDeleteResponse {
160
+ /** Response content array with single text item */
161
+ content: [{
162
+ type: 'text';
163
+ text: string;
164
+ }];
165
+ }
166
+ //# sourceMappingURL=contact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contact.d.ts","sourceRoot":"","sources":["../../src/types/contact.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAEhC;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IAEX,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IAEb,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IAEd,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,gDAAgD;IAChD,OAAO,CAAC,EAAE;QACR,mBAAmB;QACnB,EAAE,EAAE,MAAM,CAAC;QACX,mBAAmB;QACnB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAEF,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB,iDAAiD;IACjD,KAAK,CAAC,EAAE;QACN,gBAAgB;QAChB,EAAE,EAAE,MAAM,CAAC;QACX,gBAAgB;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAEF,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IAEnB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,6CAA6C;IAC7C,QAAQ,EAAE,OAAO,EAAE,CAAC;IAEpB,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IAEd,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IAEb,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IAEd,6CAA6C;IAC7C,QA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E,MAAM,CAAC;IAEnB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AAEH,8DAA8D;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC;AAEpF,0DAA0D;AAC1D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC;AAEtF,0DAA0D;AAC1D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC;AAEtF;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,6BAA6B;IAC7B,OAAO,EAAE;QACP,kCAAkC;QAClC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE;QAC9B,4BAA4B;QAC5B;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE;KAC/B,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,mDAAmD;IACnD,OAAO,EAAE,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3C"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Contact types for Salesflare MCP Server
3
+ *
4
+ * TypeScript interfaces and type definitions for Contact CRUD operations.
5
+ *
6
+ * @module types/contact
7
+ */
8
+ export {};