Skip to content

Commit 48ee3de

Browse files
committed
feat: Enhance tool detail loading and execution handling in MCP Tool Inspector
1 parent 438d073 commit 48ee3de

4 files changed

Lines changed: 51 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,40 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.5.0] - 2026-02-24
9+
10+
### Added
11+
12+
- **MCP Tool Inspector (F-026)**: Optional browser-based UI for inspecting and testing MCP tools, mounted at `/inspector` when `explorer=True`. Includes 4 HTTP endpoints (`GET /inspector/`, `GET /inspector/tools`, `GET /inspector/tools/<name>`, `POST /inspector/tools/<name>/call`), a self-contained HTML/CSS/JS page with no external dependencies, configurable `inspector_prefix`, and `allow_execute` guard (default `False`). HTTP transports only; silently ignored for stdio.
13+
- **CLI Inspector flags**: `--explorer`, `--inspector-prefix`, and `--allow-execute` arguments.
14+
- **Inspector UI: proactive execution status detection**: The Inspector probes execution status on page load via a lightweight POST to `/tools/__probe__/call`, so the "Tool execution is disabled" message appears immediately instead of requiring a user click first.
15+
- **Inspector UI: URL-safe tool name encoding**: Tool names in fetch URLs are wrapped with `encodeURIComponent()` to prevent malformed URLs when tool names contain special characters.
16+
- **Inspector UI: error handling on tool detail fetch**: `.catch()` handler on the `loadDetail` fetch chain displays network errors in the detail panel instead of silently swallowing them.
17+
18+
## [0.4.0] - 2026-02-23
19+
20+
### Added
21+
22+
- **Resource handlers**: `MCPServerFactory.register_resource_handlers()` for serving documentation resources via MCP.
23+
- **CI workflow**: GitHub Actions CI pipeline and `CODEOWNERS` file.
24+
- **Missing error codes**: Added `MODULE_EXECUTE_ERROR` and `GENERAL_INVALID_INPUT` to error codes constants.
25+
- **serve() parameter tests**: Comprehensive test suite for `serve()` parameter validation.
26+
- **Metrics endpoint tests**: Dedicated test suite for Prometheus `/metrics` endpoint.
27+
28+
### Changed
29+
30+
- **Version management**: Consolidated version into `__init__.__version__`, removed `_version.py`.
31+
32+
### Fixed
33+
34+
- **Cache configuration**: Removed unnecessary cache configuration from Python setup step.
35+
- **Code formatting**: Improved linting checks in CI workflow, factory, router, and test files.
36+
37+
### Refactored
38+
39+
- **Import cleanup**: Removed unused imports across multiple test files; reordered imports in MCPServer for consistency.
40+
- **Code structure**: General readability and maintainability improvements.
41+
842
## [0.3.0] - 2026-02-22
943

1044
### Added
@@ -66,6 +100,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66100
- **Filtering**: `tags` and `prefix` parameters for selective module exposure.
67101
- **260 tests**: Unit, integration, E2E, performance, and security test suites.
68102

103+
[0.5.0]: https://github.com/aipartnerup/apcore-mcp-python/compare/v0.4.0...v0.5.0
104+
[0.4.0]: https://github.com/aipartnerup/apcore-mcp-python/compare/v0.3.0...v0.4.0
69105
[0.3.0]: https://github.com/aipartnerup/apcore-mcp-python/compare/v0.2.0...v0.3.0
70106
[0.2.0]: https://github.com/aipartnerup/apcore-mcp-python/compare/v0.1.0...v0.2.0
71107
[0.1.0]: https://github.com/aipartnerup/apcore-mcp-python/releases/tag/v0.1.0

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "apcore-mcp"
7-
version = "0.4.0"
7+
version = "0.5.0"
88
description = "Automatic MCP Server & OpenAI Tools Bridge for apcore"
99
readme = "README.md"
1010
license = "Apache-2.0"

src/apcore_mcp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"MCP_ELICIT_KEY",
5050
]
5151

52-
__version__ = "0.4.0"
52+
__version__ = "0.5.0"
5353

5454
logger = logging.getLogger(__name__)
5555

src/apcore_mcp/inspector/html.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,18 @@
117117
li.onclick = function() { loadDetail(t.name); };
118118
toolsEl.appendChild(li);
119119
});
120+
fetch(base + '/tools/__probe__/call', {
121+
method: 'POST',
122+
headers: {'Content-Type': 'application/json'},
123+
body: '{}'
124+
}).then(function(r) {
125+
executeEnabled = r.status !== 403;
126+
}).catch(function() {});
120127
})
121128
.catch(function(e) { loadingEl.textContent = 'Error: ' + e; });
122129
123130
function loadDetail(name) {
124-
fetch(base + '/tools/' + name)
131+
fetch(base + '/tools/' + encodeURIComponent(name))
125132
.then(function(r) { return r.json(); })
126133
.then(function(d) {
127134
detailEl.className = 'detail active';
@@ -158,6 +165,10 @@
158165
'Tool execution is disabled. ' +
159166
'Launch with --allow-execute to enable.</p>';
160167
}
168+
})
169+
.catch(function(e) {
170+
detailEl.className = 'detail active';
171+
detailEl.innerHTML = '<p class="result-error">Failed to load tool details: ' + esc(e.message) + '</p>';
161172
});
162173
}
163174
@@ -179,7 +190,7 @@
179190
btn.textContent = 'Executing...';
180191
resultArea.innerHTML = '';
181192
182-
fetch(base + '/tools/' + name + '/call', {
193+
fetch(base + '/tools/' + encodeURIComponent(name) + '/call', {
183194
method: 'POST',
184195
headers: {'Content-Type': 'application/json'},
185196
body: JSON.stringify(inputs)

0 commit comments

Comments
 (0)