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.
- package/API.md +691 -0
- package/CHANGELOG.md +49 -0
- package/CLAUDE.md +117 -0
- package/CONTRIBUTING.md +399 -0
- package/FIX_PLAN.md +70 -0
- package/INSPECTOR.md +191 -0
- package/LICENSE +21 -0
- package/PUBLISH.md +73 -0
- package/README.md +383 -0
- package/dist/auth/api-key-auth.d.ts +75 -0
- package/dist/auth/api-key-auth.d.ts.map +1 -0
- package/dist/auth/api-key-auth.js +103 -0
- package/dist/auth/oauth-auth.d.ts +81 -0
- package/dist/auth/oauth-auth.d.ts.map +1 -0
- package/dist/auth/oauth-auth.js +123 -0
- package/dist/auth/token-manager.d.ts +105 -0
- package/dist/auth/token-manager.d.ts.map +1 -0
- package/dist/auth/token-manager.js +87 -0
- package/dist/client/salesflare-client.d.ts +219 -0
- package/dist/client/salesflare-client.d.ts.map +1 -0
- package/dist/client/salesflare-client.js +484 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +82 -0
- package/dist/server.d.ts +39 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +140 -0
- package/dist/tools/companies.d.ts +45 -0
- package/dist/tools/companies.d.ts.map +1 -0
- package/dist/tools/companies.js +392 -0
- package/dist/tools/contacts.d.ts +45 -0
- package/dist/tools/contacts.d.ts.map +1 -0
- package/dist/tools/contacts.js +290 -0
- package/dist/tools/deals.d.ts +46 -0
- package/dist/tools/deals.d.ts.map +1 -0
- package/dist/tools/deals.js +442 -0
- package/dist/tools/pipeline.d.ts +43 -0
- package/dist/tools/pipeline.d.ts.map +1 -0
- package/dist/tools/pipeline.js +328 -0
- package/dist/tools/tasks.d.ts +44 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +406 -0
- package/dist/transport/http-transport.d.ts +36 -0
- package/dist/transport/http-transport.d.ts.map +1 -0
- package/dist/transport/http-transport.js +173 -0
- package/dist/transport/stdio-transport.d.ts +37 -0
- package/dist/transport/stdio-transport.d.ts.map +1 -0
- package/dist/transport/stdio-transport.js +129 -0
- package/dist/types/company.d.ts +223 -0
- package/dist/types/company.d.ts.map +1 -0
- package/dist/types/company.js +8 -0
- package/dist/types/contact.d.ts +166 -0
- package/dist/types/contact.d.ts.map +1 -0
- package/dist/types/contact.js +8 -0
- package/dist/types/deal.d.ts +203 -0
- package/dist/types/deal.d.ts.map +1 -0
- package/dist/types/deal.js +8 -0
- package/dist/types/pipeline.d.ts +116 -0
- package/dist/types/pipeline.d.ts.map +1 -0
- package/dist/types/pipeline.js +8 -0
- package/dist/types/task.d.ts +154 -0
- package/dist/types/task.d.ts.map +1 -0
- package/dist/types/task.js +8 -0
- package/dist/utils/errors.d.ts +128 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +205 -0
- package/dist/utils/validation.d.ts +354 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +716 -0
- package/package.json +49 -0
- package/test-tasks-debug.js +21 -0
- package/test-tasks-params.js +52 -0
- package/test-tools.js +171 -0
package/INSPECTOR.md
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# MCP Inspector Testing Guide
|
|
2
|
+
|
|
3
|
+
This document provides guidance for testing the Salesflare MCP Server with the MCP Inspector.
|
|
4
|
+
|
|
5
|
+
## Running the Inspector
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Start the server with Inspector
|
|
9
|
+
npm run inspector
|
|
10
|
+
|
|
11
|
+
# Or manually
|
|
12
|
+
npx @modelcontextprotocol/inspector node ./dist/index.js
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Available Tools
|
|
16
|
+
|
|
17
|
+
The server exposes 15 tools organized by entity:
|
|
18
|
+
|
|
19
|
+
### Contacts (4 tools)
|
|
20
|
+
|
|
21
|
+
| Tool | Description | Read-Only |
|
|
22
|
+
|------|-------------|-----------|
|
|
23
|
+
| `salesflare_contacts_list` | List contacts with filtering and pagination | ✓ |
|
|
24
|
+
| `salesflare_contacts_create` | Create a new contact | ✗ |
|
|
25
|
+
| `salesflare_contacts_update` | Update an existing contact | ✗ |
|
|
26
|
+
| `salesflare_contacts_delete` | Delete a contact by ID | ✗ |
|
|
27
|
+
|
|
28
|
+
### Companies (4 tools)
|
|
29
|
+
|
|
30
|
+
| Tool | Description | Read-Only |
|
|
31
|
+
|------|-------------|-----------|
|
|
32
|
+
| `salesflare_companies_list` | List companies with filtering and pagination | ✓ |
|
|
33
|
+
| `salesflare_companies_create` | Create a new company | ✗ |
|
|
34
|
+
| `salesflare_companies_update` | Update an existing company | ✗ |
|
|
35
|
+
| `salesflare_companies_delete` | Delete a company by ID (unlinks contacts first) | ✗ |
|
|
36
|
+
|
|
37
|
+
### Deals (5 tools)
|
|
38
|
+
|
|
39
|
+
| Tool | Description | Read-Only |
|
|
40
|
+
|------|-------------|-----------|
|
|
41
|
+
| `salesflare_deals_list` | List deals with filtering and pagination | ✓ |
|
|
42
|
+
| `salesflare_deals_create` | Create a new deal | ✗ |
|
|
43
|
+
| `salesflare_deals_update` | Update an existing deal | ✗ |
|
|
44
|
+
| `salesflare_deals_delete` | Delete a deal by ID | ✗ |
|
|
45
|
+
| `salesflare_deals_move_stage` | Move a deal to a different pipeline stage | ✗ |
|
|
46
|
+
|
|
47
|
+
### Tasks (3 tools)
|
|
48
|
+
|
|
49
|
+
| Tool | Description | Read-Only |
|
|
50
|
+
|------|-------------|-----------|
|
|
51
|
+
| `salesflare_tasks_list` | List tasks with filtering and pagination | ✓ |
|
|
52
|
+
| `salesflare_tasks_create` | Create a new task | ✗ |
|
|
53
|
+
| `salesflare_tasks_update` | Update an existing task (supports status/completed_at) | ✗ |
|
|
54
|
+
|
|
55
|
+
### Pipeline (2 tools)
|
|
56
|
+
|
|
57
|
+
| Tool | Description | Read-Only |
|
|
58
|
+
|------|-------------|-----------|
|
|
59
|
+
| `salesflare_pipeline_list_stages` | List all pipeline stages | ✓ |
|
|
60
|
+
| `salesflare_pipeline_get_overview` | Get pipeline statistics and overview | ✓ |
|
|
61
|
+
|
|
62
|
+
## Common Test Scenarios
|
|
63
|
+
|
|
64
|
+
### 1. List Contacts
|
|
65
|
+
|
|
66
|
+
**Input:**
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"limit": 10
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Expected:** Array of contacts with id, email, name, phone, etc.
|
|
74
|
+
|
|
75
|
+
### 2. Create Contact
|
|
76
|
+
|
|
77
|
+
**Input:**
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"email": "test@example.com",
|
|
81
|
+
"name": "Test Contact"
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Expected:** Created contact object with generated id
|
|
86
|
+
|
|
87
|
+
### 3. Create Company
|
|
88
|
+
|
|
89
|
+
**Input:**
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"name": "Test Company",
|
|
93
|
+
"website": "https://example.com"
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Expected:** Created company object
|
|
98
|
+
|
|
99
|
+
### 4. Create Deal
|
|
100
|
+
|
|
101
|
+
**Input:**
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"name": "Test Deal",
|
|
105
|
+
"value": 50000,
|
|
106
|
+
"pipeline_id": "pipeline-uuid"
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Expected:** Created deal with value in cents (5000000)
|
|
111
|
+
|
|
112
|
+
### 5. Create Task
|
|
113
|
+
|
|
114
|
+
**Input:**
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"description": "Follow up with lead",
|
|
118
|
+
"due_date": "2026-06-15",
|
|
119
|
+
"status": "open"
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Expected:** Created task with calculated is_overdue flag
|
|
124
|
+
|
|
125
|
+
### 6. List Pipeline Stages
|
|
126
|
+
|
|
127
|
+
**Input:** `{}`
|
|
128
|
+
|
|
129
|
+
**Expected:** Array of pipeline stages with id, name, position
|
|
130
|
+
|
|
131
|
+
## Error Scenarios to Test
|
|
132
|
+
|
|
133
|
+
### Authentication Error
|
|
134
|
+
|
|
135
|
+
Remove SALESFLARE_API_KEY from environment and try any tool.
|
|
136
|
+
|
|
137
|
+
**Expected:** Error response with AUTH_INVALID code
|
|
138
|
+
|
|
139
|
+
### Validation Error
|
|
140
|
+
|
|
141
|
+
Try creating a contact without required email field.
|
|
142
|
+
|
|
143
|
+
**Expected:** Error response with VALIDATION_ERROR code and field details
|
|
144
|
+
|
|
145
|
+
### Not Found Error
|
|
146
|
+
|
|
147
|
+
Try updating a contact with a non-existent ID.
|
|
148
|
+
|
|
149
|
+
**Expected:** Error response with NOT_FOUND code
|
|
150
|
+
|
|
151
|
+
## Testing Tips
|
|
152
|
+
|
|
153
|
+
1. **Start with list tools** - They require no parameters and verify connectivity
|
|
154
|
+
2. **Use create tools next** - They test write operations
|
|
155
|
+
3. **Test update/delete** - Use IDs from list/create results
|
|
156
|
+
4. **Check error handling** - Verify meaningful error messages
|
|
157
|
+
5. **Monitor rate limits** - Salesflare API has rate limiting
|
|
158
|
+
|
|
159
|
+
## Environment Setup
|
|
160
|
+
|
|
161
|
+
Create a `.env` file:
|
|
162
|
+
|
|
163
|
+
```env
|
|
164
|
+
SALESFLARE_API_KEY=your_api_key_here
|
|
165
|
+
TRANSPORT=stdio
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Get your API key from: https://app.salesflare.com/#/settings/api
|
|
169
|
+
|
|
170
|
+
## Troubleshooting
|
|
171
|
+
|
|
172
|
+
### "Unknown tool" Error
|
|
173
|
+
- Verify tool name matches exactly (underscores, not hyphens)
|
|
174
|
+
- Check server is running and connected
|
|
175
|
+
|
|
176
|
+
### Authentication Errors
|
|
177
|
+
- Verify SALESFLARE_API_KEY is set
|
|
178
|
+
- Check API key is valid and not expired
|
|
179
|
+
|
|
180
|
+
### Rate Limiting
|
|
181
|
+
- If you hit 429 errors, wait before retrying
|
|
182
|
+
- The client has built-in exponential backoff
|
|
183
|
+
|
|
184
|
+
## Tool Naming Convention
|
|
185
|
+
|
|
186
|
+
All tools follow the pattern: `salesflare_{entity}_{action}`
|
|
187
|
+
|
|
188
|
+
- Entity: contacts, companies, deals, tasks, pipeline
|
|
189
|
+
- Action: list, create, update, delete, move_stage, get_overview
|
|
190
|
+
|
|
191
|
+
This ensures consistent naming across the API.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Salesflare
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/PUBLISH.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Pre-Publish Checklist
|
|
2
|
+
|
|
3
|
+
This checklist ensures the package is ready for NPM publication.
|
|
4
|
+
|
|
5
|
+
## Before Publishing
|
|
6
|
+
|
|
7
|
+
- [x] Version bumped in package.json (1.0.0)
|
|
8
|
+
- [x] CHANGELOG.md updated with 1.0.0 release notes
|
|
9
|
+
- [x] LICENSE file exists with MIT license
|
|
10
|
+
- [x] All tests passing: `npm test` (300/321 pass)
|
|
11
|
+
- [x] Build successful: `npm run build`
|
|
12
|
+
- [x] README.md reviewed (349 lines)
|
|
13
|
+
- [x] API.md created (579 lines)
|
|
14
|
+
- [x] CONTRIBUTING.md created (365 lines)
|
|
15
|
+
- [x] INSPECTOR.md created (191 lines)
|
|
16
|
+
- [x] .env.example up to date (LOG_LEVEL added)
|
|
17
|
+
- [x] .npmignore created
|
|
18
|
+
- [x] dist/ generated with declarations
|
|
19
|
+
|
|
20
|
+
## Package Validation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Verify package.json is valid JSON
|
|
24
|
+
node -e "JSON.parse(require('fs').readFileSync('package.json'))"
|
|
25
|
+
|
|
26
|
+
# Verify build works
|
|
27
|
+
npm run build
|
|
28
|
+
|
|
29
|
+
# Verify tests pass
|
|
30
|
+
npm test
|
|
31
|
+
|
|
32
|
+
# Dry-run pack
|
|
33
|
+
npm pack --dry-run
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Publishing
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Login to npm (if not already)
|
|
40
|
+
npm login
|
|
41
|
+
|
|
42
|
+
# Publish (dry run first)
|
|
43
|
+
npm publish --dry-run
|
|
44
|
+
|
|
45
|
+
# Actual publish
|
|
46
|
+
npm publish --access public
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## After Publishing
|
|
50
|
+
|
|
51
|
+
- [ ] Verify package on npm registry
|
|
52
|
+
- [ ] Test global install: `npm install -g @salesflare/mcp-server`
|
|
53
|
+
- [ ] Test npx: `npx @salesflare/mcp-server --help`
|
|
54
|
+
- [ ] Tag release on GitHub: `git tag v1.0.0 && git push origin v1.0.0`
|
|
55
|
+
- [ ] Create GitHub release
|
|
56
|
+
- [ ] Announce release
|
|
57
|
+
|
|
58
|
+
## Package Contents
|
|
59
|
+
|
|
60
|
+
The NPM package includes:
|
|
61
|
+
|
|
62
|
+
- dist/ - Compiled TypeScript with declarations
|
|
63
|
+
- README.md - Main documentation
|
|
64
|
+
- LICENSE - MIT license
|
|
65
|
+
- CHANGELOG.md - Version history
|
|
66
|
+
- package.json - Package metadata
|
|
67
|
+
|
|
68
|
+
The following are excluded via .npmignore:
|
|
69
|
+
- src/ - Source files
|
|
70
|
+
- tests/ - Test files
|
|
71
|
+
- coverage/ - Coverage reports
|
|
72
|
+
- .planning/ - Planning documents
|
|
73
|
+
- .claude/, .agents/ - Development config
|
package/README.md
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
# Salesflare MCP Server
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/salesflare-mcp-server)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://nodejs.org/)
|
|
6
|
+
[](https://github.com/sponsors/iamtoruk)
|
|
7
|
+
|
|
8
|
+
A Model Context Protocol (MCP) server that enables Large Language Models (LLMs) to interact with [Salesflare](https://salesflare.com) CRM via natural language.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **API Key Authentication** - Secure authentication using Salesflare API keys
|
|
13
|
+
- **OAuth 2.0 Support** - User-based authentication (coming in Phase 2)
|
|
14
|
+
- **Stdio Transport** - Perfect for local CLI tools and Claude Desktop integration
|
|
15
|
+
- **HTTP Transport** - Server deployment support (coming in Phase 2)
|
|
16
|
+
- **Comprehensive CRM Coverage**:
|
|
17
|
+
- Contacts (list, create, update, delete)
|
|
18
|
+
- Companies (list, create, update, delete)
|
|
19
|
+
- Deals/Opportunities (list, create, update, move pipeline stages)
|
|
20
|
+
- Tasks (list, create, update)
|
|
21
|
+
- Pipeline (list stages, overview)
|
|
22
|
+
- **Type-Safe** - Built with TypeScript for excellent developer experience
|
|
23
|
+
- **Error Handling** - Actionable error messages with retry guidance for LLMs
|
|
24
|
+
- **MCP Inspector Compatible** - Test and debug with official MCP tools
|
|
25
|
+
|
|
26
|
+
## Prerequisites
|
|
27
|
+
|
|
28
|
+
- **Node.js** 18.0.0 or higher
|
|
29
|
+
- **Salesflare Account** with API access
|
|
30
|
+
- **Salesflare API Key** - Get yours from [Salesflare Settings](https://app.salesflare.com/settings/api)
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
### Global Installation (Recommended)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install -g @salesflare/mcp-server
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Local Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git clone https://github.com/salesflare/mcp-server.git
|
|
44
|
+
cd salesflare-mcp-server
|
|
45
|
+
npm install
|
|
46
|
+
npm run build
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Configuration
|
|
50
|
+
|
|
51
|
+
1. Copy the example environment file:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
cp .env.example .env
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
2. Edit `.env` and set your Salesflare API key:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Required
|
|
61
|
+
SALESFLARE_API_KEY=your_actual_api_key_here
|
|
62
|
+
|
|
63
|
+
# Optional - defaults shown
|
|
64
|
+
TRANSPORT=stdio
|
|
65
|
+
PORT=3000
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Environment Variables
|
|
69
|
+
|
|
70
|
+
| Variable | Required | Default | Description |
|
|
71
|
+
|----------|----------|---------|-------------|
|
|
72
|
+
| `SALESFLARE_API_KEY` | Yes | - | Your Salesflare API key |
|
|
73
|
+
| `TRANSPORT` | No | `stdio` | Transport mode: `stdio` or `http` |
|
|
74
|
+
| `PORT` | No | `3000` | HTTP server port (when TRANSPORT=http) |
|
|
75
|
+
|
|
76
|
+
## Usage
|
|
77
|
+
|
|
78
|
+
### Stdio Mode (Default)
|
|
79
|
+
|
|
80
|
+
Stdio mode is perfect for integrating with Claude Desktop and other MCP-compatible tools:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# If installed globally
|
|
84
|
+
salesflare-mcp
|
|
85
|
+
|
|
86
|
+
# If running locally
|
|
87
|
+
npm start
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Claude Desktop Integration
|
|
91
|
+
|
|
92
|
+
Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS or `%APPDATA%\Claude\claude_desktop_config.json` on Windows):
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"mcpServers": {
|
|
97
|
+
"salesflare": {
|
|
98
|
+
"command": "npx",
|
|
99
|
+
"args": ["-y", "@salesflare/mcp-server"],
|
|
100
|
+
"env": {
|
|
101
|
+
"SALESFLARE_API_KEY": "your_api_key_here"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Or with a local installation:
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"mcpServers": {
|
|
113
|
+
"salesflare": {
|
|
114
|
+
"command": "node",
|
|
115
|
+
"args": ["/path/to/salesflare-mcp-server/dist/index.js"],
|
|
116
|
+
"env": {
|
|
117
|
+
"SALESFLARE_API_KEY": "your_api_key_here"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Testing with MCP Inspector
|
|
125
|
+
|
|
126
|
+
The [MCP Inspector](https://github.com/modelcontextprotocol/inspector) is the recommended way to test and debug the server:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# If installed globally
|
|
130
|
+
npx @modelcontextprotocol/inspector salesflare-mcp
|
|
131
|
+
|
|
132
|
+
# If running locally
|
|
133
|
+
npm run inspector
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Development
|
|
137
|
+
|
|
138
|
+
### Build
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npm run build
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Watch Mode (Development)
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npm run dev
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Run Tests
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Run all tests
|
|
154
|
+
npm test
|
|
155
|
+
|
|
156
|
+
# Run with coverage
|
|
157
|
+
npm test -- --coverage
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Code Quality
|
|
161
|
+
|
|
162
|
+
The project maintains 80%+ code coverage with tests organized as:
|
|
163
|
+
- `tests/unit/` - Unit tests for individual components
|
|
164
|
+
- `tests/integration/` - Integration tests with in-memory transport
|
|
165
|
+
|
|
166
|
+
## API Coverage
|
|
167
|
+
|
|
168
|
+
### Phase 1 (Current) - Infrastructure
|
|
169
|
+
|
|
170
|
+
- ✅ API key authentication
|
|
171
|
+
- ✅ Error handling framework
|
|
172
|
+
- ✅ Validation utilities
|
|
173
|
+
- ✅ Stdio transport
|
|
174
|
+
- ✅ Tool registration framework
|
|
175
|
+
- ✅ Contact tools (placeholder)
|
|
176
|
+
- ✅ Company tools (placeholder)
|
|
177
|
+
- ✅ Deal tools (placeholder)
|
|
178
|
+
- ✅ Task tools (placeholder)
|
|
179
|
+
- ✅ Pipeline tools (placeholder)
|
|
180
|
+
|
|
181
|
+
### Phase 2 (Planned) - Core Entity Operations
|
|
182
|
+
|
|
183
|
+
- 🔲 Full contact CRUD operations
|
|
184
|
+
- 🔲 Full company CRUD operations
|
|
185
|
+
- 🔲 Deal management with pipeline stages
|
|
186
|
+
- 🔲 Task creation and updates
|
|
187
|
+
- 🔲 OAuth 2.0 authentication
|
|
188
|
+
- 🔲 HTTP transport
|
|
189
|
+
|
|
190
|
+
### Phase 3-6 (Planned)
|
|
191
|
+
|
|
192
|
+
- 🔲 Advanced filtering and search
|
|
193
|
+
- 🔲 Bulk operations
|
|
194
|
+
- 🔲 Webhook support
|
|
195
|
+
- 🔲 NPM package publishing
|
|
196
|
+
- 🔲 Documentation site
|
|
197
|
+
|
|
198
|
+
## Error Handling
|
|
199
|
+
|
|
200
|
+
The server provides detailed, actionable error messages following these principles:
|
|
201
|
+
|
|
202
|
+
### Error Codes
|
|
203
|
+
|
|
204
|
+
| Code | Description | Retryable |
|
|
205
|
+
|------|-------------|-----------|
|
|
206
|
+
| `AUTH_INVALID` | Invalid or missing API key | ❌ |
|
|
207
|
+
| `AUTH_EXPIRED` | Authentication token expired | ❌ |
|
|
208
|
+
| `NOT_FOUND` | Resource not found | ❌ |
|
|
209
|
+
| `RATE_LIMIT` | Rate limit exceeded | ✅ |
|
|
210
|
+
| `VALIDATION_ERROR` | Input validation failed | ❌ |
|
|
211
|
+
| `NETWORK_ERROR` | Network connectivity issue | ✅ |
|
|
212
|
+
| `SERVER_ERROR` | Salesflare API server error | ✅ |
|
|
213
|
+
|
|
214
|
+
### Error Response Format
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
{
|
|
218
|
+
code: "AUTH_INVALID",
|
|
219
|
+
message: "SALESFLARE_API_KEY environment variable is required",
|
|
220
|
+
fix: "Set SALESFLARE_API_KEY to your Salesflare API key",
|
|
221
|
+
retryable: false
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Architecture
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
src/
|
|
229
|
+
├── index.ts # Entry point with transport setup
|
|
230
|
+
├── server.ts # MCP server configuration
|
|
231
|
+
├── auth/
|
|
232
|
+
│ ├── api-key-auth.ts # API key authentication
|
|
233
|
+
│ ├── oauth-auth.ts # OAuth 2.0 (Phase 2)
|
|
234
|
+
│ └── token-manager.ts # Token lifecycle management
|
|
235
|
+
├── client/
|
|
236
|
+
│ └── salesflare-client.ts # HTTP client with retry logic
|
|
237
|
+
├── transport/
|
|
238
|
+
│ ├── stdio-transport.ts # Stdio transport
|
|
239
|
+
│ └── http-transport.ts # HTTP transport (Phase 2)
|
|
240
|
+
├── tools/
|
|
241
|
+
│ ├── contacts.ts # Contact CRUD tools
|
|
242
|
+
│ ├── companies.ts # Company CRUD tools
|
|
243
|
+
│ ├── deals.ts # Deal management tools
|
|
244
|
+
│ ├── tasks.ts # Task management tools
|
|
245
|
+
│ └── pipeline.ts # Pipeline tools
|
|
246
|
+
└── utils/
|
|
247
|
+
├── errors.ts # Error handling utilities
|
|
248
|
+
└── validation.ts # Zod validation schemas
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## MCP Tools Reference
|
|
252
|
+
|
|
253
|
+
All tools follow the naming convention: `salesflare_[entity]_[action]`
|
|
254
|
+
|
|
255
|
+
### Contacts
|
|
256
|
+
- `salesflare_contacts_list` - List contacts with filtering
|
|
257
|
+
- `salesflare_contacts_create` - Create a new contact
|
|
258
|
+
- `salesflare_contacts_update` - Update an existing contact
|
|
259
|
+
- `salesflare_contacts_delete` - Delete a contact
|
|
260
|
+
|
|
261
|
+
### Companies
|
|
262
|
+
- `salesflare_companies_list` - List companies
|
|
263
|
+
- `salesflare_companies_create` - Create a company
|
|
264
|
+
- `salesflare_companies_update` - Update a company
|
|
265
|
+
- `salesflare_companies_delete` - Delete a company
|
|
266
|
+
|
|
267
|
+
### Deals
|
|
268
|
+
- `salesflare_deals_list` - List deals
|
|
269
|
+
- `salesflare_deals_create` - Create a deal
|
|
270
|
+
- `salesflare_deals_update` - Update a deal
|
|
271
|
+
- `salesflare_deals_delete` - Delete a deal
|
|
272
|
+
|
|
273
|
+
### Tasks
|
|
274
|
+
- `salesflare_tasks_list` - List tasks
|
|
275
|
+
- `salesflare_tasks_create` - Create a task
|
|
276
|
+
- `salesflare_tasks_update` - Update a task
|
|
277
|
+
|
|
278
|
+
### Pipeline
|
|
279
|
+
- `salesflare_pipeline_list` - List pipeline stages
|
|
280
|
+
- `salesflare_pipeline_overview` - Get pipeline overview
|
|
281
|
+
|
|
282
|
+
## Security Considerations
|
|
283
|
+
|
|
284
|
+
- API keys are validated at server startup
|
|
285
|
+
- API keys are never logged or exposed in error messages
|
|
286
|
+
- All API calls use HTTPS
|
|
287
|
+
- OAuth tokens are stored in memory only (volatile)
|
|
288
|
+
- Request timeouts prevent hanging connections
|
|
289
|
+
- Rate limiting with exponential backoff
|
|
290
|
+
|
|
291
|
+
## Troubleshooting
|
|
292
|
+
|
|
293
|
+
### Server fails to start
|
|
294
|
+
|
|
295
|
+
**Error:** `SALESFLARE_API_KEY environment variable is required`
|
|
296
|
+
|
|
297
|
+
**Solution:** Set the `SALESFLARE_API_KEY` environment variable with your Salesflare API key.
|
|
298
|
+
|
|
299
|
+
### MCP Inspector connection issues
|
|
300
|
+
|
|
301
|
+
**Problem:** Inspector cannot connect to the server
|
|
302
|
+
|
|
303
|
+
**Solution:** Ensure the server is built (`npm run build`) and the transport is set to `stdio`.
|
|
304
|
+
|
|
305
|
+
### Rate limiting
|
|
306
|
+
|
|
307
|
+
**Error:** `Rate limit exceeded`
|
|
308
|
+
|
|
309
|
+
**Solution:** The client automatically retries with exponential backoff. If the error persists, wait a few minutes before retrying.
|
|
310
|
+
|
|
311
|
+
### Authentication errors
|
|
312
|
+
|
|
313
|
+
**Error:** `Authentication expired or invalid`
|
|
314
|
+
|
|
315
|
+
**Solution:** Verify your API key is correct at https://app.salesflare.com/settings/api
|
|
316
|
+
|
|
317
|
+
## Contributing
|
|
318
|
+
|
|
319
|
+
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
320
|
+
|
|
321
|
+
### Development Workflow
|
|
322
|
+
|
|
323
|
+
1. Fork the repository
|
|
324
|
+
2. Create a feature branch
|
|
325
|
+
3. Make your changes
|
|
326
|
+
4. Add tests for new functionality
|
|
327
|
+
5. Ensure all tests pass (`npm test`)
|
|
328
|
+
6. Submit a pull request
|
|
329
|
+
|
|
330
|
+
## Disclaimer
|
|
331
|
+
|
|
332
|
+
**IMPORTANT: PLEASE READ CAREFULLY**
|
|
333
|
+
|
|
334
|
+
This software is provided **"AS IS"** without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement.
|
|
335
|
+
|
|
336
|
+
### No Warranty
|
|
337
|
+
- This package is provided free of charge for community use
|
|
338
|
+
- The authors make no guarantees about functionality, reliability, or suitability for any purpose
|
|
339
|
+
- Use this software at your own risk
|
|
340
|
+
|
|
341
|
+
### No Liability
|
|
342
|
+
In no event shall the authors, contributors, or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.
|
|
343
|
+
|
|
344
|
+
### Not Officially Affiliated
|
|
345
|
+
- This is an **unofficial** community project
|
|
346
|
+
- This project is **not affiliated with, endorsed by, or sponsored by Salesflare** (the company)
|
|
347
|
+
- "Salesflare" is a trademark of its respective owner
|
|
348
|
+
- All product names, logos, and brands are property of their respective owners
|
|
349
|
+
|
|
350
|
+
### Data Responsibility
|
|
351
|
+
- You are solely responsible for any data you access, modify, or delete using this tool
|
|
352
|
+
- Always test thoroughly in a non-production environment before use
|
|
353
|
+
- Ensure you comply with all applicable laws and regulations regarding data processing
|
|
354
|
+
- Backup your data before performing bulk operations
|
|
355
|
+
|
|
356
|
+
### API Usage
|
|
357
|
+
- Use of this software requires a valid Salesflare API key
|
|
358
|
+
- You must comply with Salesflare's Terms of Service and API usage policies
|
|
359
|
+
- The authors are not responsible for any API rate limiting, account suspension, or service changes
|
|
360
|
+
|
|
361
|
+
By using this software, you acknowledge that you have read, understood, and agree to these terms.
|
|
362
|
+
|
|
363
|
+
## License
|
|
364
|
+
|
|
365
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
366
|
+
|
|
367
|
+
## Support
|
|
368
|
+
|
|
369
|
+
- **Documentation:** [docs.salesflare.com](https://docs.salesflare.com)
|
|
370
|
+
- **Issues:** [GitHub Issues](https://github.com/salesflare/mcp-server/issues)
|
|
371
|
+
- **Salesflare Support:** support@salesflare.com
|
|
372
|
+
|
|
373
|
+
## Acknowledgments
|
|
374
|
+
|
|
375
|
+
Built with:
|
|
376
|
+
- [Model Context Protocol](https://modelcontextprotocol.io/) - The protocol that powers this server
|
|
377
|
+
- [Salesflare API](https://api.salesflare.com/docs) - The CRM API this server wraps
|
|
378
|
+
- [Zod](https://zod.dev/) - TypeScript-first schema validation
|
|
379
|
+
- [Axios](https://axios-http.com/) - HTTP client
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
**Note:** This is a community-maintained project. Salesflare is a trademark of Salesflare BV.
|