node804-freshservice-mcp 1.2.0__tar.gz

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 (36) hide show
  1. node804_freshservice_mcp-1.2.0/.env.example +9 -0
  2. node804_freshservice_mcp-1.2.0/.github/workflows/ci.yml +24 -0
  3. node804_freshservice_mcp-1.2.0/.github/workflows/publish.yml +35 -0
  4. node804_freshservice_mcp-1.2.0/.gitignore +177 -0
  5. node804_freshservice_mcp-1.2.0/.python-version +1 -0
  6. node804_freshservice_mcp-1.2.0/CLAUDE.md +97 -0
  7. node804_freshservice_mcp-1.2.0/Dockerfile +22 -0
  8. node804_freshservice_mcp-1.2.0/LICENSE +22 -0
  9. node804_freshservice_mcp-1.2.0/PKG-INFO +341 -0
  10. node804_freshservice_mcp-1.2.0/README.md +319 -0
  11. node804_freshservice_mcp-1.2.0/pyproject.toml +43 -0
  12. node804_freshservice_mcp-1.2.0/smithery.yaml +40 -0
  13. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/__init__.py +3 -0
  14. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/client.py +303 -0
  15. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/config.py +174 -0
  16. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/models.py +114 -0
  17. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/server.py +121 -0
  18. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/tools/__init__.py +15 -0
  19. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/tools/agents.py +221 -0
  20. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/tools/canned_responses.py +119 -0
  21. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/tools/changes.py +963 -0
  22. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/tools/files.py +181 -0
  23. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/tools/groups.py +255 -0
  24. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/tools/products.py +184 -0
  25. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/tools/requesters.py +221 -0
  26. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/tools/service_catalog.py +129 -0
  27. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/tools/solutions.py +406 -0
  28. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/tools/tickets.py +959 -0
  29. node804_freshservice_mcp-1.2.0/src/node804_freshservice_mcp/tools/workspaces.py +37 -0
  30. node804_freshservice_mcp-1.2.0/tests/conftest.py +12 -0
  31. node804_freshservice_mcp-1.2.0/tests/test_client.py +220 -0
  32. node804_freshservice_mcp-1.2.0/tests/test_config.py +55 -0
  33. node804_freshservice_mcp-1.2.0/tests/test_files.py +166 -0
  34. node804_freshservice_mcp-1.2.0/tests/test_permissions.py +52 -0
  35. node804_freshservice_mcp-1.2.0/tests/test_tickets.py +624 -0
  36. node804_freshservice_mcp-1.2.0/uv.lock +917 -0
@@ -0,0 +1,9 @@
1
+ FRESHSERVICE_DOMAIN=yourcompany.freshservice.com
2
+ FRESHSERVICE_APIKEY=your_api_key_here
3
+ # Permission mode: read, standard, full, or admin. Defaults to read if unset.
4
+ FRESHSERVICE_MODE=standard
5
+ FRESHSERVICE_CACHE_TTL=3600
6
+ # Semicolon-separated directories the find_file tool may search (off when unset)
7
+ # FRESHSERVICE_FILE_SEARCH_PATHS=C:\Users\me\Docs;C:\Exports
8
+ # JSON-lines audit log of every tool call (off when unset)
9
+ # FRESHSERVICE_AUDIT_LOG=C:\logs\freshservice-audit.jsonl
@@ -0,0 +1,24 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.11", "3.12", "3.13"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - name: Install
20
+ run: |
21
+ python -m pip install --upgrade pip
22
+ pip install -e ".[dev]"
23
+ - name: Test
24
+ run: pytest tests/ -v
@@ -0,0 +1,35 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: actions/setup-python@v5
13
+ with:
14
+ python-version: "3.13"
15
+ - name: Build sdist and wheel
16
+ run: |
17
+ python -m pip install --upgrade pip build
18
+ python -m build
19
+ - uses: actions/upload-artifact@v4
20
+ with:
21
+ name: dist
22
+ path: dist/
23
+
24
+ publish:
25
+ needs: build
26
+ runs-on: ubuntu-latest
27
+ environment: pypi
28
+ permissions:
29
+ id-token: write # required for PyPI Trusted Publishing (OIDC)
30
+ steps:
31
+ - uses: actions/download-artifact@v4
32
+ with:
33
+ name: dist
34
+ path: dist/
35
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,177 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # Ruff stuff:
171
+ .ruff_cache/
172
+
173
+ # PyPI configuration file
174
+ .pypirc
175
+
176
+ #GenAI Settings
177
+ .claude/settings.local.json
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,97 @@
1
+ # CLAUDE.md
2
+
3
+ Project-level instructions for Claude Code when working on this repository.
4
+
5
+ ## Authoritative API Reference
6
+
7
+ The **only** documentation source for Freshservice API endpoints, parameters, response formats, and behavior is:
8
+
9
+ **https://api.freshservice.com/**
10
+
11
+ Do not use third-party blogs, Stack Overflow, or other unofficial sources when adding or modifying tools. Always verify endpoint paths, required fields, query parameters, and response schemas against the official docs before writing code.
12
+
13
+ ## Project Overview
14
+
15
+ This is an MCP (Model Context Protocol) server that wraps the Freshservice REST API v2 with permission-based tool gating. The `FRESHSERVICE_MODE` environment variable controls which tools are exposed to the LLM.
16
+
17
+ ## Key Architecture
18
+
19
+ - **src-layout** Python package using hatchling build backend
20
+ - **`server.py`** — FastMCP instance + `conditional_tool()` decorator. Tool modules are imported at the bottom to avoid circular imports.
21
+ - **`config.py`** — Every tool function name must be listed in `TOOL_PERMISSIONS` with its minimum required mode. New tools that aren't in this map will be blocked by default.
22
+ - **`client.py`** — Shared `httpx.AsyncClient` singleton with `RateLimitTransport` (429 retry + header tracking) and `TTLCache` / `@cached_response` for caching.
23
+ - **`tools/`** — One module per Freshservice domain (tickets, changes, agents, etc). Each tool uses `@conditional_tool()` and calls `get_client()` for HTTP access.
24
+
25
+ ## Adding a New Tool
26
+
27
+ 1. Add the async function in the appropriate `tools/*.py` module with `@conditional_tool()`.
28
+ 2. Add the function name to `TOOL_PERMISSIONS` in `config.py` with the correct minimum mode (`read`, `standard`, `full`, or `admin`).
29
+ 3. If the tool returns rarely-changing data, add `@cached_response()` below `@conditional_tool()`. TTL is controlled by `FRESHSERVICE_CACHE_TTL` env var (default 3600s). Only override with `@cached_response(ttl_seconds=N)` if a tool genuinely needs a different TTL.
30
+ 4. All list endpoints must accept `page` and `per_page` parameters and return pagination metadata.
31
+ 5. Run `pytest tests/` and verify the tool count in the smoke test.
32
+
33
+ ## Tool Selection Guide
34
+
35
+ When the user asks about their tickets, use the convenience tools instead of manually chaining lower-level calls. This saves API calls and avoids wasting tokens on plumbing.
36
+
37
+ ### "My tickets" / "My open tickets"
38
+
39
+ Use `get_my_tickets(status_filter="unresolved")`. Do NOT manually call `get_current_agent` → `get_ticket_fields` → parse statuses → `filter_tickets`. The compound tool does all of that internally and its dependencies are cached.
40
+
41
+ - `status_filter="unresolved"` (default) — everything except Resolved/Closed
42
+ - `status_filter="resolved"` — only Resolved and Closed
43
+ - `status_filter="all"` — every ticket assigned to the agent
44
+
45
+ ### Status lookups
46
+
47
+ Use `get_ticket_statuses` to get categorized status IDs. Do NOT call `get_ticket_fields` and parse the status choices yourself. The tool returns `resolved_ids`, `unresolved_ids`, and a full `statuses` list with categories.
48
+
49
+ ### Agent identity
50
+
51
+ Use `get_current_agent` whenever you need the authenticated user's agent ID, email, or group memberships. It is cached for the session — call it freely without worrying about API cost.
52
+
53
+ ### File discovery
54
+
55
+ Use `find_file` to search for files on the local filesystem before using attachment tools. When the user asks to find, locate, or attach files from their system, always call `find_file` first. Searches are restricted to directories listed in `FRESHSERVICE_FILE_SEARCH_PATHS` (semicolon-separated). The tool supports partial names (`report`), glob patterns (`*.pdf`), and is case-insensitive. Results include absolute paths, sizes, and modified timestamps. Default limit is 25 results.
56
+
57
+ ### Attachments
58
+
59
+ Use `add_ticket_attachment`, `add_note_attachment`, and `add_reply_attachment` to upload files. Each takes an absolute `file_path` on the MCP server's filesystem — the server reads the file, detects MIME type, and uploads it via multipart form-data. The total attachment size per ticket cannot exceed 40 MB (Freshservice limit).
60
+
61
+ When the user provides a partial filename or isn't sure of the exact path, call `find_file` first to resolve the full path, then pass it to the attachment tool.
62
+
63
+ To list or delete attachments, use `list_ticket_attachments`, `delete_ticket_attachment`, or `delete_conversation_attachment`.
64
+
65
+ ### Time entries
66
+
67
+ Use `list_ticket_time_entries` and `view_ticket_time_entry` to read time logged against a ticket. Use `create_ticket_time_entry` to log new work (requires `time_spent` in "hh:mm" format, `note`, and `agent_id`). The optional `billable` flag marks whether the entry is billable. Use `update_ticket_time_entry` to modify an existing entry's time, note, or billable status. `delete_ticket_time_entry` permanently removes an entry (requires `full` mode).
68
+
69
+ Equivalent tools exist for changes (`*_change_time_entry`).
70
+
71
+ ### Filter query syntax
72
+
73
+ The `filter_tickets` and `filter_changes` tools accept a query string with this syntax:
74
+
75
+ - Single condition: `"status:2"`
76
+ - AND: `"status:2 AND priority:1"`
77
+ - OR: `"status:2 OR status:3"`
78
+ - Grouped: `"agent_id:123 AND (status:2 OR status:3)"`
79
+
80
+ Field names match the Freshservice API field names (e.g., `agent_id`, `status`, `priority`, `requester_id`, `group_id`, `type`).
81
+
82
+ ### Pagination
83
+
84
+ All list tools default to `page=1, per_page=30`. Only request additional pages if the user asks for more results or pagination metadata indicates `has_more: true`. Do not auto-paginate through all pages unless explicitly asked.
85
+
86
+ ### Cache behavior
87
+
88
+ Schema and reference data (`get_ticket_fields`, `get_ticket_statuses`, `get_current_agent`, `list_change_fields`, etc.) are cached for the duration of `FRESHSERVICE_CACHE_TTL` (default 1 hour). If the user says data has changed, call `clear_cache` before retrying the lookup.
89
+
90
+ ## Testing
91
+
92
+ ```bash
93
+ pip install -e ".[dev]"
94
+ pytest tests/
95
+ ```
96
+
97
+ Tests use `monkeypatch` to set fake credentials. No real API calls are made in tests.
@@ -0,0 +1,22 @@
1
+ # Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
2
+ # syntax=docker/dockerfile:1
3
+ # Use Python 3.13 slim for compatibility (requires >=3.13)
4
+ FROM python:3.13-slim
5
+
6
+ # Set working directory
7
+ WORKDIR /app
8
+
9
+ # Install system dependencies for building Python packages
10
+ RUN apt-get update && apt-get install -y --no-install-recommends \
11
+ build-essential \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Copy project definition
15
+ COPY pyproject.toml ./
16
+ COPY src ./src
17
+
18
+ # Install project and dependencies
19
+ RUN pip install --no-cache-dir .
20
+
21
+ # Use python module entrypoint to start the MCP server
22
+ ENTRYPOINT ["python", "-m", "node804_freshservice_mcp.server"]
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 effy (original work)
4
+ Copyright (c) 2026 Michael Pope (this fork)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.