@customer-support-success/pylon-mcp-server 1.5.2

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/.env.example ADDED
@@ -0,0 +1,5 @@
1
+ # Pylon MCP Server Environment Variables
2
+
3
+ # Pylon API Token (required)
4
+ # Generate this token in your Pylon dashboard
5
+ PYLON_API_TOKEN=your_pylon_api_token_here
package/.eslintrc.cjs ADDED
@@ -0,0 +1,29 @@
1
+ module.exports = {
2
+ root: true,
3
+ env: {
4
+ es2022: true,
5
+ node: true,
6
+ },
7
+ parser: '@typescript-eslint/parser',
8
+ plugins: ['@typescript-eslint', 'vitest'],
9
+ extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
10
+ rules: {
11
+ 'no-console': 'off',
12
+ '@typescript-eslint/no-explicit-any': 'off',
13
+ '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
14
+ 'vitest/no-focused-tests': 'error',
15
+ 'vitest/no-identical-title': 'error',
16
+ 'vitest/expect-expect': 'warn',
17
+ },
18
+ ignorePatterns: ['dist', '**/*.d.ts'],
19
+ overrides: [
20
+ {
21
+ files: ['tests/**/*.{ts,tsx}'],
22
+ env: { node: true },
23
+ rules: {
24
+ 'no-console': 'off',
25
+ '@typescript-eslint/no-unused-vars': 'off',
26
+ },
27
+ },
28
+ ],
29
+ };
@@ -0,0 +1,6 @@
1
+ {
2
+ "singleQuote": true,
3
+ "semi": true,
4
+ "trailingComma": "es5",
5
+ "printWidth": 100
6
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,137 @@
1
+ # Changelog
2
+
3
+ All notable changes to the Pylon MCP Server will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.4.0] - 2025-12-24
9
+
10
+ ### Changed
11
+
12
+ - Clarified tool guidance for issue lookups: when given a ticket/issue number, use `pylon_get_issue` first; reserve message-history tools for when conversation bodies are needed.
13
+ - Improved tool input schema descriptions to accept user-provided ticket numbers directly without extra lookup steps.
14
+
15
+ ### Added
16
+
17
+ - Tests asserting the updated tool descriptions and guidance.
18
+
19
+ ## [1.2.0] - 2024-12-05
20
+
21
+ ### Added
22
+
23
+ - **Attachment Support** - Full support for file attachments in Pylon
24
+ - New `PylonAttachment` interface with id, name, url, and description fields
25
+ - Updated `PylonMessage` interface to include optional `attachments` array
26
+ - New tool: `pylon_get_attachment` - Get details of a specific attachment by ID
27
+ - New tool: `pylon_create_attachment_from_url` - Create attachment from a URL
28
+ - New method: `PylonClient.getAttachment(attachmentId)` - Fetch attachment metadata
29
+ - New method: `PylonClient.createAttachment(file, description?)` - Upload file as attachment
30
+ - New method: `PylonClient.createAttachmentFromUrl(fileUrl, description?)` - Create from URL
31
+ - Messages now properly include attachment information when present
32
+
33
+ - **Comprehensive Test Coverage** - Professional testing infrastructure
34
+ - Added Vitest testing framework with 17 passing unit tests
35
+ - Test coverage for all attachment methods (6 tests)
36
+ - Test coverage for core functionality: users, issues, contacts, messages (11 tests)
37
+ - Test scripts: `npm test`, `npm run test:watch`, `npm run test:ui`, `npm run test:coverage`
38
+ - Automated testing for error handling (404, network errors)
39
+ - Mock-based testing for fast, reliable test execution
40
+ - Full TypeScript support in tests
41
+
42
+ ### Changed
43
+
44
+ - Tool count increased from 24+ to **26+ tools**
45
+ - Enhanced message handling to support attachments
46
+ - Improved documentation with testing section in README and CLAUDE.md
47
+
48
+ ### Improved
49
+
50
+ - Better code quality with automated test validation
51
+ - Regression prevention through comprehensive test suite
52
+ - Developer experience with watch mode and interactive test UI
53
+ - Documentation now includes testing instructions and coverage details
54
+
55
+ ## [1.1.0] - 2024-12-04
56
+
57
+ ### Added
58
+
59
+ - **New Tool: `pylon_get_issue_with_messages`** - Get a complete issue with all messages in a single efficient call
60
+ - Combines issue details and message history into one API call
61
+ - Uses `Promise.all()` for parallel fetching to improve performance
62
+ - Returns structured JSON with both `issue` and `messages` properties
63
+ - More efficient than calling `pylon_get_issue` and `pylon_get_issue_messages` separately
64
+
65
+ ### Changed
66
+
67
+ - **All MCP responses now return valid JSON** - Improved consistency across all tools
68
+ - `pylon_snooze_issue` now returns JSON object with `success`, `message`, `issue_id`, and `snoozed_until`
69
+ - `pylon_delete_webhook` now returns JSON object with `success`, `message`, and `webhook_id`
70
+ - Previously these returned plain text strings
71
+ - All 30 tool handlers now guarantee JSON output for better parseability
72
+
73
+ ### Improved
74
+
75
+ - Enhanced documentation with new tool examples
76
+ - Updated tool count from 23+ to 24+ tools
77
+ - Better response structure for operation confirmations
78
+
79
+ ## [1.0.0] - 2024-12-03
80
+
81
+ ### Added
82
+
83
+ - Initial release of Pylon MCP Server
84
+ - 23 comprehensive tools covering Pylon API functionality:
85
+ - User Management (`pylon_get_me`, `pylon_get_users`, `pylon_search_users`)
86
+ - Contact Management (`pylon_get_contacts`, `pylon_create_contact`, `pylon_search_contacts`)
87
+ - Issue Management (`pylon_get_issues`, `pylon_create_issue`, `pylon_get_issue`, `pylon_update_issue`, `pylon_snooze_issue`, `pylon_search_issues`)
88
+ - Message Management (`pylon_get_issue_messages`, `pylon_create_issue_message`)
89
+ - Knowledge Base (`pylon_get_knowledge_bases`, `pylon_get_knowledge_base_articles`, `pylon_create_knowledge_base_article`)
90
+ - Team Management (`pylon_get_teams`, `pylon_get_team`, `pylon_create_team`)
91
+ - Account Management (`pylon_get_accounts`, `pylon_get_account`)
92
+ - Tag Management (`pylon_get_tags`, `pylon_create_tag`)
93
+ - Ticket Forms (`pylon_get_ticket_forms`, `pylon_create_ticket_form`)
94
+ - Webhook Management (`pylon_get_webhooks`, `pylon_create_webhook`, `pylon_delete_webhook`)
95
+ - TypeScript implementation with full type safety
96
+ - Axios-based HTTP client for Pylon API
97
+ - MCP SDK integration for Augment Code and Claude Desktop
98
+ - Smithery deployment configuration
99
+ - Comprehensive documentation and examples
100
+ - GCP Artifact Registry publishing support
101
+ - Security audit and compliance documentation
102
+
103
+ ### Security
104
+
105
+ - No hardcoded secrets or API tokens
106
+ - Environment variable-based authentication
107
+ - HTTPS-only API communication
108
+ - Zero dependency vulnerabilities
109
+ - SOC-2 and GDPR compliance considerations
110
+
111
+ ---
112
+
113
+ ## Release Notes Format
114
+
115
+ ### Added
116
+
117
+ New features and capabilities
118
+
119
+ ### Changed
120
+
121
+ Changes to existing functionality
122
+
123
+ ### Deprecated
124
+
125
+ Features that will be removed in future versions
126
+
127
+ ### Removed
128
+
129
+ Features that have been removed
130
+
131
+ ### Fixed
132
+
133
+ Bug fixes
134
+
135
+ ### Security
136
+
137
+ Security improvements and vulnerability fixes
package/CLAUDE.md ADDED
@@ -0,0 +1,187 @@
1
+ # Claude Development Guide
2
+
3
+ This document provides context for Claude when working on the Pylon MCP Server project.
4
+
5
+ ## Project Overview
6
+
7
+ This is an MCP (Model Context Protocol) server that provides comprehensive integration with the Pylon API. Pylon is a customer support and helpdesk platform, and this server exposes 26+ tools covering all major API functionality.
8
+
9
+ ## Architecture
10
+
11
+ - **Language**: TypeScript with Node.js runtime
12
+ - **MCP Framework**: `@modelcontextprotocol/sdk`
13
+ - **HTTP Client**: Axios for API communication
14
+ - **Build System**: TypeScript compiler
15
+ - **Deployment**: Smithery platform
16
+
17
+ ## Key Files
18
+
19
+ - `src/pylon-client.ts` - Pylon API client with authentication and all endpoint methods
20
+ - `src/index.ts` - MCP server implementation with tool definitions and handlers
21
+ - `smithery.yaml` - Smithery deployment configuration
22
+ - `package.json` - Dependencies and build scripts
23
+
24
+ ## API Coverage
25
+
26
+ The server implements comprehensive Pylon API coverage:
27
+
28
+ ### Authentication
29
+
30
+ - Base URL: `https://api.usepylon.com`
31
+ - Authentication: Bearer JWT tokens
32
+ - Environment variable: `PYLON_API_TOKEN`
33
+
34
+ ### Implemented Endpoints
35
+
36
+ **User Management** (`/me`, `/users`, `/users/search`)
37
+ **Contact Management** (`/contacts`, `/contacts/search`)
38
+ **Issue Management** (`/issues`, `/issues/search`, `/issues/{id}`, `/issues/{id}/snooze`, `/issues/{id}/messages`)
39
+ **Knowledge Base** (`/knowledge-bases`, `/knowledge-bases/{id}/articles`)
40
+ **Team Management** (`/teams`, `/teams/{id}`)
41
+ **Account Management** (`/accounts`, `/accounts/{id}`)
42
+ **Tag Management** (`/tags`)
43
+ **Ticket Forms** (`/ticket-forms`)
44
+ **Webhook Management** (`/webhooks`)
45
+ **Attachment Management** (`/attachments`, `/attachments/{id}`)
46
+
47
+ ## Development Commands
48
+
49
+ ```bash
50
+ npm install # Install dependencies
51
+ npm run build # Build TypeScript
52
+ npm run dev # Run in development mode
53
+ npm start # Run built version
54
+ ```
55
+
56
+ ## Testing
57
+
58
+ ### Unit Tests
59
+
60
+ The project includes comprehensive unit test coverage using Vitest:
61
+
62
+ ```bash
63
+ npm test # Run all tests
64
+ npm run test:watch # Watch mode
65
+ npm run test:ui # Interactive UI
66
+ npm run test:coverage # Coverage report
67
+ ```
68
+
69
+ **Test Files:**
70
+
71
+ - `tests/pylon-client.attachments.test.ts` - Attachment API tests (6 tests)
72
+ - `tests/pylon-client.core.test.ts` - Core functionality tests (11 tests)
73
+
74
+ **Coverage:**
75
+
76
+ - ✅ All attachment methods (get, create from URL, file upload)
77
+ - ✅ User management (get, search)
78
+ - ✅ Issue management (CRUD operations, filtering)
79
+ - ✅ Contact management (get, search, create)
80
+ - ✅ Message management (with attachments)
81
+ - ✅ Error handling (404, network errors)
82
+
83
+ ### Integration Testing
84
+
85
+ To test the MCP server with a real client:
86
+
87
+ 1. Build the project: `npm run build`
88
+ 2. Configure in your preferred client:
89
+ - **Augment Code**: Use Easy MCP feature in VS Code or JetBrains
90
+ - **Claude Desktop**: Add to MCP settings configuration
91
+ 3. Use natural language to test tools:
92
+ - "Get my Pylon user info" → `pylon_get_me`
93
+ - "Show recent issues" → `pylon_get_issues`
94
+ - "Search for contacts" → `pylon_search_contacts`
95
+
96
+ ## Deployment
97
+
98
+ ### Local Development
99
+
100
+ - Requires `PYLON_API_TOKEN` environment variable
101
+ - Can be configured in:
102
+ - **Augment Code**: Easy MCP feature (VS Code/JetBrains)
103
+ - **Claude Desktop**: MCP settings configuration
104
+ - Use built `dist/index.js` as entrypoint
105
+ - Can run with `npx pylon-mcp-server` after publishing to npm
106
+
107
+ ### Smithery Production
108
+
109
+ - Uses `smithery.yaml` configuration
110
+ - Automatic dependency installation and build
111
+ - Environment variable configuration through Smithery UI
112
+
113
+ ## Code Patterns
114
+
115
+ ### Adding New API Endpoints
116
+
117
+ 1. **Add interface** in `pylon-client.ts`:
118
+
119
+ ```typescript
120
+ export interface PylonNewResource {
121
+ id: string;
122
+ name: string;
123
+ }
124
+ ```
125
+
126
+ 2. **Add client method** in `PylonClient` class:
127
+
128
+ ```typescript
129
+ async getNewResources(): Promise<PylonNewResource[]> {
130
+ const response = await this.client.get('/new-resources');
131
+ return response.data;
132
+ }
133
+ ```
134
+
135
+ 3. **Add MCP tool** in `tools` array:
136
+
137
+ ```typescript
138
+ {
139
+ name: 'pylon_get_new_resources',
140
+ description: 'Get new resources from Pylon',
141
+ inputSchema: {
142
+ type: 'object',
143
+ properties: {},
144
+ },
145
+ }
146
+ ```
147
+
148
+ 4. **Add handler** in switch statement:
149
+
150
+ ```typescript
151
+ case 'pylon_get_new_resources': {
152
+ const resources = await pylonClient.getNewResources();
153
+ return {
154
+ content: [{ type: 'text', text: JSON.stringify(resources, null, 2) }],
155
+ };
156
+ }
157
+ ```
158
+
159
+ 5. **Update smithery.yaml** tools list
160
+
161
+ ## Error Handling
162
+
163
+ - All API calls are wrapped in try/catch
164
+ - Axios errors are converted to MCP error responses
165
+ - Required parameters are validated before API calls
166
+ - Type assertions used for request arguments (`args as any`)
167
+
168
+ ## Security
169
+
170
+ - API tokens stored in environment variables
171
+ - Sensitive files excluded in `.gitignore`
172
+ - No secrets committed to repository
173
+
174
+ ## Common Issues
175
+
176
+ 1. **TypeScript errors**: Use type assertions (`as any`) for MCP arguments
177
+ 2. **Missing parameters**: Validate required fields before API calls
178
+ 3. **Authentication**: Ensure `PYLON_API_TOKEN` is properly set
179
+ 4. **Build failures**: Check TypeScript configuration and imports
180
+
181
+ ## Future Enhancements
182
+
183
+ - Add response type validation
184
+ - Implement proper TypeScript types for all API responses
185
+ - Add retry logic for failed API calls
186
+ - Implement rate limiting
187
+ - Add comprehensive error codes mapping
package/GCP_SETUP.md ADDED
@@ -0,0 +1,174 @@
1
+ # GCP Artifact Registry Setup Guide
2
+
3
+ This document explains how the Pylon MCP Server is published to and used from Google Cloud Platform's Artifact Registry.
4
+
5
+ ## What Was Set Up
6
+
7
+ 1. **GCP Artifact Registry Repository**
8
+ - Repository name: `npm-packages`
9
+ - Location: `us-central1`
10
+ - Format: npm
11
+ - Project: `customer-support-success`
12
+
13
+ 2. **Package Configuration**
14
+ - Package name: `@customer-support-success/pylon-mcp-server`
15
+ - Published to: `https://us-central1-npm.pkg.dev/customer-support-success/npm-packages/`
16
+ - Version: 1.0.0
17
+
18
+ ## For Users: Installing and Using the Package
19
+
20
+ ### Prerequisites
21
+
22
+ You need to have `gcloud` CLI installed and authenticated:
23
+
24
+ ```bash
25
+ # Install gcloud CLI (if not already installed)
26
+ # Visit: https://cloud.google.com/sdk/docs/install
27
+
28
+ # Authenticate
29
+ gcloud auth application-default login
30
+ ```
31
+
32
+ ### Using with npx (Recommended)
33
+
34
+ ```bash
35
+ # Run directly with npx
36
+ npx --registry=https://us-central1-npm.pkg.dev/customer-support-success/npm-packages/ @customer-support-success/pylon-mcp-server
37
+ ```
38
+
39
+ ### Installing Globally
40
+
41
+ ```bash
42
+ npm install -g --registry=https://us-central1-npm.pkg.dev/customer-support-success/npm-packages/ @customer-support-success/pylon-mcp-server
43
+ ```
44
+
45
+ ### Using with Augment Code
46
+
47
+ Add this to your Augment Code MCP configuration:
48
+
49
+ ```json
50
+ {
51
+ "pylon": {
52
+ "command": "npx",
53
+ "args": [
54
+ "--registry=https://us-central1-npm.pkg.dev/customer-support-success/npm-packages/",
55
+ "@customer-support-success/pylon-mcp-server"
56
+ ],
57
+ "env": {
58
+ "PYLON_API_TOKEN": "your_pylon_api_token_here"
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+ ### Using with Claude Desktop
65
+
66
+ Add this to `~/Library/Application Support/Claude/claude_desktop_config.json`:
67
+
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "pylon": {
72
+ "command": "npx",
73
+ "args": [
74
+ "--registry=https://us-central1-npm.pkg.dev/customer-support-success/npm-packages/",
75
+ "@customer-support-success/pylon-mcp-server"
76
+ ],
77
+ "env": {
78
+ "PYLON_API_TOKEN": "your_pylon_api_token_here"
79
+ }
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ ## For Maintainers: Publishing Updates
86
+
87
+ ### Prerequisites
88
+
89
+ 1. GCP authentication with publish permissions
90
+ 2. Local repository cloned and up to date
91
+
92
+ ### Publishing a New Version
93
+
94
+ 1. **Update the version** in `package.json`:
95
+
96
+ ```bash
97
+ npm version patch # or minor, or major
98
+ ```
99
+
100
+ 2. **Publish (CI is preferred)**:
101
+ - CI/CD: push a tag `vX.Y.Z` and let `release.yml` build/test/publish using `GCP_CREDENTIALS` (service account key) and a short-lived access token via `gcloud auth print-access-token`.
102
+ - Local/manual (maintainers only):
103
+
104
+ ```bash
105
+ npm run build
106
+ export ARTIFACT_REGISTRY_TOKEN=$(gcloud auth application-default print-access-token)
107
+ npm publish --registry=https://us-central1-npm.pkg.dev/customer-support-success/npm-packages/
108
+ ```
109
+
110
+ ### Verifying the Publication
111
+
112
+ ```bash
113
+ # List packages in the registry
114
+ gcloud artifacts packages list \
115
+ --repository=npm-packages \
116
+ --location=us-central1 \
117
+ --project=customer-support-success
118
+
119
+ # View package details
120
+ gcloud artifacts versions list \
121
+ --package=@customer-support-success/pylon-mcp-server \
122
+ --repository=npm-packages \
123
+ --location=us-central1 \
124
+ --project=customer-support-success
125
+ ```
126
+
127
+ ## Troubleshooting
128
+
129
+ ### Authentication Issues
130
+
131
+ If you get authentication errors:
132
+
133
+ ```bash
134
+ # Re-authenticate
135
+ gcloud auth application-default login
136
+
137
+ # Verify authentication
138
+ gcloud auth application-default print-access-token
139
+ ```
140
+
141
+ ### Registry Not Found
142
+
143
+ Make sure you're using the correct registry URL:
144
+
145
+ ```
146
+ https://us-central1-npm.pkg.dev/customer-support-success/npm-packages/
147
+ ```
148
+
149
+ ### Permission Denied
150
+
151
+ Ensure your GCP account has the `Artifact Registry Writer` role:
152
+
153
+ ```bash
154
+ gcloud artifacts repositories add-iam-policy-binding npm-packages \
155
+ --location=us-central1 \
156
+ --member=user:your-email@example.com \
157
+ --role=roles/artifactregistry.writer
158
+ ```
159
+
160
+ ## Files Created/Modified
161
+
162
+ - `.npmrc` - npm configuration for GCP Artifact Registry
163
+ - `package.json` - Updated with scoped name and publishConfig
164
+ - `.npmignore` - Controls which files are published
165
+ - `publish.sh` - Helper script for publishing
166
+ - `GCP_SETUP.md` - This documentation file
167
+
168
+ ## Benefits of Using GCP Artifact Registry
169
+
170
+ 1. **Private Package Hosting** - Keep your package private within your organization
171
+ 2. **Access Control** - Use GCP IAM for fine-grained permissions
172
+ 3. **Integration** - Works seamlessly with other GCP services
173
+ 4. **Reliability** - Enterprise-grade infrastructure
174
+ 5. **Cost-Effective** - Free tier available, pay only for storage and egress
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Pylon MCP Server
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.