@verygoodplugins/mcp-freescout 1.4.0 → 2.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.
@@ -0,0 +1,26 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "npm"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ groups:
8
+ production-dependencies:
9
+ patterns:
10
+ - "*"
11
+ exclude-patterns:
12
+ - "@types/*"
13
+ - "typescript"
14
+ - "vitest"
15
+ - "eslint*"
16
+ - "prettier"
17
+ dev-dependencies:
18
+ patterns:
19
+ - "@types/*"
20
+ - "typescript"
21
+ - "vitest"
22
+ - "eslint*"
23
+ - "prettier"
24
+ commit-message:
25
+ prefix: "chore(deps)"
26
+ open-pull-requests-limit: 10
@@ -0,0 +1,34 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+ push:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - uses: actions/setup-node@v4
16
+ with:
17
+ node-version: "20"
18
+ cache: "npm"
19
+
20
+ - name: Install dependencies
21
+ run: npm ci
22
+
23
+ - name: Lint
24
+ run: npm run lint
25
+
26
+ - name: Build
27
+ run: npm run build
28
+
29
+ - name: Test
30
+ run: npm test
31
+
32
+ - name: Test coverage
33
+ run: npm run test:coverage
34
+ continue-on-error: true
@@ -0,0 +1,102 @@
1
+ # Release Please - Automated versioning and npm publishing
2
+ #
3
+ # How it works:
4
+ # 1. Every push to main with conventional commits updates a "Release PR"
5
+ # 2. When you merge the Release PR, it:
6
+ # - Updates version in package.json
7
+ # - Updates CHANGELOG.md
8
+ # - Creates a GitHub Release with tag
9
+ # - Triggers the npm publish job below
10
+ #
11
+ # Commit message format:
12
+ # feat: add new feature → minor version bump
13
+ # fix: fix a bug → patch version bump
14
+ # feat!: breaking change → major version bump
15
+ # chore/docs: no version bump
16
+ #
17
+ # npm Publishing:
18
+ # Uses Trusted Publishing (OIDC) - no secrets needed!
19
+ # Configure at: https://www.npmjs.com/package/@verygoodplugins/mcp-{name}/access
20
+
21
+ name: Release Please
22
+
23
+ on:
24
+ push:
25
+ branches:
26
+ - main
27
+
28
+ permissions:
29
+ contents: write
30
+ pull-requests: write
31
+
32
+ jobs:
33
+ release-please:
34
+ runs-on: ubuntu-latest
35
+ outputs:
36
+ release_created: ${{ steps.release.outputs.release_created }}
37
+ tag_name: ${{ steps.release.outputs.tag_name }}
38
+ steps:
39
+ - uses: googleapis/release-please-action@v4
40
+ id: release
41
+ with:
42
+ release-type: node
43
+
44
+ npm-publish:
45
+ needs: release-please
46
+ if: ${{ needs.release-please.outputs.release_created }}
47
+ runs-on: ubuntu-latest
48
+ permissions:
49
+ contents: read
50
+ id-token: write
51
+ steps:
52
+ - uses: actions/checkout@v4
53
+
54
+ - uses: actions/setup-node@v4
55
+ with:
56
+ node-version: "20"
57
+ registry-url: "https://registry.npmjs.org"
58
+
59
+ - run: npm ci
60
+ - run: npm run build
61
+ - run: npm test
62
+
63
+ # Trusted Publishing: No NPM_TOKEN needed!
64
+ - run: npm publish --access public --provenance
65
+
66
+ mcp-registry-publish:
67
+ needs: [release-please, npm-publish]
68
+ if: ${{ needs.release-please.outputs.release_created }}
69
+ runs-on: ubuntu-latest
70
+ permissions:
71
+ contents: read
72
+ id-token: write
73
+ steps:
74
+ - uses: actions/checkout@v4
75
+
76
+ - name: Install mcp-publisher CLI
77
+ run: |
78
+ curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_linux_amd64.tar.gz" | tar xz mcp-publisher
79
+ sudo mv mcp-publisher /usr/local/bin/
80
+
81
+ - name: Publish to MCP Registry
82
+ run: |
83
+ mcp-publisher login github-oidc
84
+ mcp-publisher publish
85
+ env:
86
+ MCP_REGISTRY_URL: https://registry.modelcontextprotocol.io
87
+
88
+ announce:
89
+ needs: [release-please, npm-publish]
90
+ if: ${{ needs.release-please.outputs.release_created }}
91
+ runs-on: ubuntu-latest
92
+ steps:
93
+ - name: Post to Slack
94
+ if: ${{ vars.SLACK_WEBHOOK_URL }}
95
+ uses: slackapi/slack-github-action@v1
96
+ with:
97
+ webhook-url: ${{ vars.SLACK_WEBHOOK_URL }}
98
+ webhook-type: incoming-webhook
99
+ payload: |
100
+ {
101
+ "text": "🚀 ${{ github.repository }} ${{ needs.release-please.outputs.tag_name }} released!\n\nhttps://github.com/${{ github.repository }}/releases/tag/${{ needs.release-please.outputs.tag_name }}"
102
+ }
@@ -0,0 +1,53 @@
1
+ name: Security
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "0 0 * * 0" # Weekly on Sunday
6
+ push:
7
+ branches: [main]
8
+ pull_request:
9
+ branches: [main]
10
+ workflow_dispatch:
11
+
12
+ permissions:
13
+ contents: read
14
+ security-events: write
15
+
16
+ jobs:
17
+ codeql:
18
+ name: CodeQL Analysis
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+
23
+ - name: Initialize CodeQL
24
+ uses: github/codeql-action/init@v4
25
+ with:
26
+ languages: typescript
27
+
28
+ - name: Autobuild
29
+ uses: github/codeql-action/autobuild@v4
30
+
31
+ - name: Perform CodeQL Analysis
32
+ uses: github/codeql-action/analyze@v4
33
+
34
+ audit:
35
+ name: Dependency Audit
36
+ runs-on: ubuntu-latest
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+
40
+ - uses: actions/setup-node@v4
41
+ with:
42
+ node-version: "20"
43
+ cache: "npm"
44
+
45
+ - run: npm ci
46
+
47
+ - name: Audit dependencies
48
+ run: npm audit --audit-level=high
49
+ continue-on-error: true
50
+
51
+ - name: Check for known vulnerabilities
52
+ run: npx better-npm-audit audit --level high
53
+ continue-on-error: true
@@ -0,0 +1,24 @@
1
+ # Build outputs
2
+ dist/
3
+ build/
4
+ *.js.map
5
+ *.d.ts.map
6
+
7
+ # Dependencies
8
+ node_modules/
9
+
10
+ # Lock files
11
+ package-lock.json
12
+ yarn.lock
13
+
14
+ # Git
15
+ .git/
16
+
17
+ # IDE
18
+ .vscode/
19
+ .idea/
20
+
21
+ # Temporary files
22
+ *.log
23
+ .DS_Store
24
+
package/.prettierrc ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "semi": true,
3
+ "trailingComma": "es5",
4
+ "singleQuote": true,
5
+ "printWidth": 80,
6
+ "tabWidth": 2,
7
+ "useTabs": false,
8
+ "arrowParens": "avoid",
9
+ "proseWrap": "preserve"
10
+ }
package/AGENTS.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # Repository Guidelines
2
2
 
3
3
  ## Project Structure & Modules
4
+
4
5
  - **Source**: TypeScript sources live in `src/` (`index.ts`, `freescout-api.ts`, `ticket-analyzer.ts`, `types.ts`).
5
6
  - **Build output**: Compiled JavaScript and type declarations are in `dist/` (do not edit directly).
6
7
  - **Entry point**: The MCP server CLI entry is `src/index.ts`, built to `dist/index.js` and exposed as `mcp-freescout`.
7
8
 
8
9
  ## Build, Test & Development
10
+
9
11
  - **Install**: `npm install` – install dependencies.
10
12
  - **Dev server**: `npm run dev` – run `src/index.ts` with live reload.
11
13
  - **Build**: `npm run build` – compile TypeScript to `dist/`.
@@ -14,23 +16,27 @@
14
16
  - **Format**: `npm run format` – apply Prettier formatting to `src/**/*.ts`.
15
17
 
16
18
  ## Coding Style & Naming
19
+
17
20
  - **Language**: TypeScript with ES modules (`type: module`).
18
21
  - **Formatting**: Use Prettier via `npm run format`; 2‑space indentation and single quotes where possible.
19
22
  - **Linting**: ESLint with `@typescript-eslint` rules; fix warnings before opening a PR.
20
23
  - **Naming**: Use `camelCase` for variables/functions, `PascalCase` for classes/types, and descriptive file names (e.g., `freescout-api.ts`).
21
24
 
22
25
  ## Testing Guidelines
26
+
23
27
  - **Framework**: Jest (`npm test`).
24
28
  - **Location**: Place tests alongside code as `*.test.ts` or in a dedicated test folder if introduced consistently.
25
29
  - **Scope**: Cover new behavior, especially FreeScout API calls and ticket analysis logic.
26
30
  - **CI readiness**: Ensure `npm test` and `npm run lint` pass locally before pushing.
27
31
 
28
32
  ## Commit & Pull Requests
33
+
29
34
  - **Commits**: Write clear, imperative messages (e.g., `Add ticket analyzer tests`, `Fix FreeScout auth error`).
30
35
  - **Branches**: Use short, descriptive names (e.g., `feat/ticket-tags`, `fix/rate-limits`).
31
36
  - **PRs**: Include a concise summary, motivation, testing notes (`npm test`, `npm run lint`), and link related issues. Add screenshots or logs when changing error handling or CLI behavior.
32
37
 
33
38
  ## Memory MCP Usage
39
+
34
40
  - **Start of work**: Use the memory MCP to recall project-specific context for the area you are modifying (recent bugs, decisions, or related files).
35
41
  - **During/after work**: When you fix an issue or learn something important (API behavior, edge case, configuration nuance), store or update a memory via the MCP.
36
42
  - **Associations**: When relevant, associate new memories with existing ones (e.g., linking a bugfix to a specific module or decision) to keep context navigable for future tasks.
package/CHANGELOG.md ADDED
@@ -0,0 +1,147 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project 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
+ ## [2.0.0] - 2026-01-05
9
+
10
+ ### Breaking Changes
11
+
12
+ - **Search API redesign**: Replaced fragile query-string syntax (`assignee:null`) with explicit filter parameters
13
+ - Old: `query: "assignee:null"`
14
+ - New: `assignee: "unassigned"` as a dedicated parameter
15
+ - Migrated from legacy `Server` class to modern `McpServer` with `registerTool()` API
16
+ - All tool responses now include structured output schemas for better type safety
17
+ - **Removed Git/GitHub tools**: The following tools have been removed to focus on core FreeScout functionality:
18
+ - `git_create_worktree`
19
+ - `git_remove_worktree`
20
+ - `github_create_pr`
21
+ - `freescout_implement_ticket`
22
+ - Use dedicated Git/GitHub MCP servers for these workflows
23
+
24
+ ### Added
25
+
26
+ - **Markdown-to-HTML conversion**: Draft replies now automatically convert Markdown formatting (bold, italic, code, lists) to proper HTML for FreeScout display
27
+ - **Zod schema validation** for all FreeScout API types with runtime validation
28
+ - **Explicit search filters**:
29
+ - `assignee`: 'unassigned' | 'any' | number
30
+ - `updatedSince`: ISO date or relative time (e.g., "7d", "24h")
31
+ - `createdSince`: ISO date or relative time
32
+ - `page` and `pageSize`: Proper pagination support
33
+ - `mailboxId`, `status`, `state`: First-class filter parameters
34
+ - **Exponential backoff retry logic** with jitter for transient API failures
35
+ - **Rate limiting awareness**: Automatic detection and backoff for 429 responses
36
+ - **Timeout handling**: Configurable request timeouts (default: 30s)
37
+ - **Structured content responses**: All tools now return typed `structuredContent` alongside text
38
+ - **Relative time parsing**: Support for "7d", "24h", "30m" in date filters
39
+
40
+ ### Changed
41
+
42
+ - Updated to MCP SDK best practices (January 2026)
43
+ - Improved error messages with specific status codes and retry information
44
+ - Enhanced type safety with Zod schemas throughout the codebase
45
+ - Better input normalization and validation
46
+
47
+ ### Fixed
48
+
49
+ - Eliminated client-side filtering workarounds for search state parameter
50
+ - Removed fragile string matching for special query syntax
51
+ - Improved reliability with automatic retries for network errors
52
+ - Windows compatibility: README config examples now use args array format to prevent path separator issues
53
+
54
+ ### Infrastructure
55
+
56
+ - Added GitHub Actions CI/CD with automated testing and npm publishing
57
+ - Added MCP Registry publishing for discoverability
58
+ - ESLint 9 flat config with typescript-eslint 8
59
+ - Security scanning with CodeQL and Dependabot
60
+
61
+ ### Migration Guide
62
+
63
+ If you were using `freescout_search_tickets` with query strings like `"assignee:null"`:
64
+
65
+ **Before (v1.x):**
66
+
67
+ ```json
68
+ {
69
+ "query": "assignee:null",
70
+ "status": "active"
71
+ }
72
+ ```
73
+
74
+ **After (v2.0):**
75
+
76
+ ```json
77
+ {
78
+ "assignee": "unassigned",
79
+ "status": "active"
80
+ }
81
+ ```
82
+
83
+ For text search, use the `textSearch` parameter:
84
+
85
+ ```json
86
+ {
87
+ "textSearch": "authentication error",
88
+ "assignee": "unassigned",
89
+ "updatedSince": "7d"
90
+ }
91
+ ```
92
+
93
+ ## [1.4.2] - 2025-11-20
94
+
95
+ ### Added
96
+
97
+ - MCP Registry support with `mcpName` configuration
98
+ - GitHub Actions CI/CD workflows
99
+ - Dependabot configuration for dependency updates
100
+ - Security scanning with CodeQL
101
+
102
+ ### Changed
103
+
104
+ - Updated package.json with `engines` and `publishConfig`
105
+
106
+ ## [1.4.1] - 2025-11-15
107
+
108
+ ### Fixed
109
+
110
+ - Improved error handling in ticket operations
111
+
112
+ ## [1.4.0] - 2025-11-10
113
+
114
+ ### Added
115
+
116
+ - Git worktree integration for ticket-based development
117
+ - GitHub PR creation support
118
+
119
+ ## [1.3.0] - 2025-10-15
120
+
121
+ ### Added
122
+
123
+ - Ticket context retrieval for personalized replies
124
+ - Draft reply creation functionality
125
+
126
+ ## [1.2.0] - 2025-09-20
127
+
128
+ ### Added
129
+
130
+ - Ticket search functionality
131
+ - Note addition to tickets
132
+
133
+ ## [1.1.0] - 2025-08-15
134
+
135
+ ### Added
136
+
137
+ - Ticket status updates
138
+ - Ticket assignment
139
+
140
+ ## [1.0.0] - 2025-07-01
141
+
142
+ ### Added
143
+
144
+ - Initial release
145
+ - FreeScout ticket fetching
146
+ - Ticket analysis with AI
147
+ - Basic ticket operations
package/CLAUDE.md ADDED
@@ -0,0 +1,111 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code when working with this repository.
4
+
5
+ ## Project Overview
6
+
7
+ **MCP FreeScout** is an MCP server for FreeScout helpdesk integration. It enables AI assistants to manage support tickets, analyze issues, create responses, and integrate with Git workflows.
8
+
9
+ ## Build & Development
10
+
11
+ ```bash
12
+ # Build TypeScript to dist/
13
+ npm run build
14
+
15
+ # Development with hot-reload
16
+ npm run dev
17
+
18
+ # Run tests
19
+ npm test
20
+
21
+ # Lint code
22
+ npm run lint
23
+
24
+ # Format code
25
+ npm run format
26
+ ```
27
+
28
+ ## Architecture
29
+
30
+ ```
31
+ src/
32
+ ├── index.ts # MCP server entry point, tool registration
33
+ ├── freescout-api.ts # FreeScout API client
34
+ ├── ticket-analyzer.ts # AI-powered ticket analysis
35
+ ├── git-integration.ts # Git worktree and GitHub PR support
36
+ └── types.ts # TypeScript interfaces
37
+ ```
38
+
39
+ ## MCP Tools
40
+
41
+ The server exposes these tools:
42
+
43
+ ### Ticket Management
44
+
45
+ - **freescout_get_ticket** - Fetch ticket by ID or URL with threads
46
+ - **freescout_analyze_ticket** - Analyze ticket to determine issue type and solution
47
+ - **freescout_add_note** - Add internal note to ticket
48
+ - **freescout_update_ticket** - Update ticket status and assignment
49
+ - **freescout_create_draft_reply** - Create draft reply for review
50
+ - **freescout_get_ticket_context** - Get ticket context for personalized replies
51
+ - **freescout_search_tickets** - Search tickets by query and filters
52
+
53
+ ### Git Integration
54
+
55
+ - **git_create_worktree** - Create Git worktree for ticket work
56
+ - **git_remove_worktree** - Remove worktree after completion
57
+ - **github_create_pr** - Create GitHub PR for ticket branch
58
+
59
+ ### Workflow
60
+
61
+ - **freescout_implement_ticket** - Full workflow: analyze, worktree, plan
62
+
63
+ ## Environment Variables
64
+
65
+ ```env
66
+ # Required: FreeScout instance URL
67
+ FREESCOUT_URL=https://your-freescout.example.com
68
+
69
+ # Required: FreeScout API key
70
+ FREESCOUT_API_KEY=your_api_key
71
+
72
+ # Optional: Default user ID for notes/drafts
73
+ FREESCOUT_USER_ID=1
74
+
75
+ # Optional: Git worktree base path
76
+ WORKTREE_BASE_PATH=/path/to/worktrees
77
+
78
+ # Optional: GitHub token for PR creation
79
+ GITHUB_TOKEN=ghp_xxxx
80
+ ```
81
+
82
+ ## Common Tasks
83
+
84
+ **Add a new tool:**
85
+
86
+ 1. Define tool schema in `src/index.ts` tools array
87
+ 2. Add handler in `CallToolRequestSchema` switch
88
+ 3. Implement API method in `freescout-api.ts`
89
+ 4. Add types in `types.ts`
90
+
91
+ **Test a specific tool:**
92
+
93
+ ```bash
94
+ echo '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"freescout_get_ticket","arguments":{"ticket":"12345"}},"id":1}' | npm start
95
+ ```
96
+
97
+ ## API Patterns
98
+
99
+ The FreeScout API client uses:
100
+
101
+ - Basic authentication with API key
102
+ - JSON request/response format
103
+ - Pagination for list endpoints
104
+ - Status codes: active, pending, closed, spam
105
+
106
+ ## Important Notes
107
+
108
+ - Ticket IDs can be provided as number, string, or full URL
109
+ - Thread content is HTML, cleaned with DOMPurify before display
110
+ - Draft replies require user review before sending
111
+ - Worktrees are created in `./worktrees/` by default