Open a local project to find command-line entry points, or add one to .projectroom/project.yaml.
';
diff --git a/dist/docs/product/architecture.md b/dist/docs/product/architecture.md
index 769f6d5..38c14b7 100644
--- a/dist/docs/product/architecture.md
+++ b/dist/docs/product/architecture.md
@@ -39,8 +39,14 @@ The source audit improves setup completeness but is not a universal protocol imp
## API Explorer
+A project OpenAPI file already named in `workspace.apiSources` appears only as the registered API, including when the relative path uses a `./` prefix.
+
Project-local OpenAPI 3.x files are scanned read-only and listed beside HTTP APIs declared in `workspace.apiSources`. The file remains the source of truth for endpoint paths and summaries; the repository YAML stores only its relative path, clean base URL and public authentication metadata. Alternatively, `specPath` identifies a dynamically served OpenAPI document on the registered API. The user must click **Load OpenAPI**; the main process fetches from that API's origin without redirects or authentication headers, with a timeout and 2 MB limit. An API can be registered without a spec and tested with a manually entered relative path. The main process performs a request only after the user clicks Send, checks that the target stays on the selected origin, blocks redirects, applies a timeout and bounds the response preview. It resolves Bearer and API-key values from the local project `.env`. Public-client OAuth uses PKCE and a loopback callback; access and refresh tokens are encrypted outside the repository with macOS secure storage. Activity records only request metadata, without headers, query values, body or response content. The included Hello Workspace has a matching OpenAPI document for its real health and notes endpoints.
## MCP Explorer
The desktop main process uses the official MCP client SDK to connect to explicitly selected project servers over stdio, Streamable HTTP or legacy SSE. It keeps one client session per connected server, so several can remain connected while the user switches between them. Read-only discovery scans project-local MCP configuration and shared `workspace.mcpServers`; it does not launch anything. Add, link and remove actions update the YAML array atomically after schema validation; linked entries record the discovered source ID. The renderer gets safe server metadata, capabilities, schemas and user-requested results over IPC. Connect, disconnect and invocation metadata goes to `.productview/events.jsonl`; arguments and responses remain in memory. YAML declares only static variable names or public OAuth client metadata. Static values come from the ignored project `.env`; SDK-managed OAuth credentials are encrypted locally and scoped to the workspace and endpoint. The built-in Project Room MCP server serves coding agents and is hidden from the project MCP Explorer.
+
+### Linked MCP entries
+
+The catalog shows a client setting only when it is not already linked to a YAML registration. Matching uses transport plus the complete command or URL; different arguments and endpoints remain separate.
diff --git a/dist/docs/product/command-tools.md b/dist/docs/product/command-tools.md
index aa4c108..9ec5b75 100644
--- a/dist/docs/product/command-tools.md
+++ b/dist/docs/product/command-tools.md
@@ -1,5 +1,7 @@
# CLI Explorer
+An entry point already linked to a registered YAML tool appears only once, under the registered tool. Catalog counts reflect distinct tools rather than both discovery and registration.
+
CLI Explorer follows the same browse and inspect layout as MCP Explorer. The left catalog lists **Discovered locally** entry points found by reading the open repository: `package.json` `bin` entries, Python project scripts, Cargo binaries, Go `cmd/*/main.go` and `examples/*/main.go` programs, and executable CLI files. A package CLI whose declared `dist/` or `build/` target is absent is labeled **Build required**; it cannot be run, linked or queried for help until that target exists. This scan does not run candidates. It is intentionally bounded and may miss custom build systems; ordinary package scripts and tests are not automatically treated as product CLIs. **In .projectroom/project.yaml** lists registered `commandTool` components. Select either type to inspect it on the right.
Select a discovered entry to see its source file and exact command. **Read help** explicitly starts the command with `--help`, `-h`, or `help` and shows the real output, including a parsed synopsis, paired short and long flags, common subcommand lists and positional arguments where recognizable. Parsed commands and options become suggestions in Explore. The full original output stays visible because CLI help has no universal machine-readable format. A program can have side effects even while printing help; Project Room never requests it automatically. Discovery does not prove that the CLI is safe or fully documented.
diff --git a/dist/mcp-explorer.js b/dist/mcp-explorer.js
index 3aa97a3..a8d5186 100644
--- a/dist/mcp-explorer.js
+++ b/dist/mcp-explorer.js
@@ -15,7 +15,7 @@
let message = '';
const safe = value => escapeHtml(value == null ? '' : String(value));
const selected = () => servers.find(item => item.id === selectedId);
- const projectServers = async () => (await pv.listMcpServers()).filter(item => !item.builtIn);
+ const projectServers = async () => (await pv.listMcpServers()).filter(item => !item.builtIn && !item.linkedId);
const editable = item => !!item && item.id.startsWith('yaml:');
const activeItems = () => detail ? ({ tools: detail.tools, resources: detail.resources, templates: detail.resourceTemplates, prompts: detail.prompts })[selectedKind] || [] : [];
const activeItem = () => activeItems().find(item => (item.name || item.uri || item.uriTemplate) === selectedName);
diff --git a/dist/projectroom.json b/dist/projectroom.json
index d195f9d..501826c 100644
--- a/dist/projectroom.json
+++ b/dist/projectroom.json
@@ -61,6 +61,15 @@
"web"
]
},
+ {
+ "id": "explorer-deduplication",
+ "title": "Show each explorer integration once",
+ "summary": "Merge linked CLI and MCP discoveries into their registered entries, and normalize OpenAPI spec paths before showing additional local files.",
+ "status": "done",
+ "relatedComponents": [
+ "web"
+ ]
+ },
{
"id": "evidence-based-onboarding",
"title": "Evidence-based onboarding progress",
diff --git a/dist/v5.js b/dist/v5.js
index 6b53cab..830656c 100644
--- a/dist/v5.js
+++ b/dist/v5.js
@@ -65,7 +65,9 @@ async function commandDiscover(force = false) {
const found = await pv.discoverCliTools();
if (root === projectRoot) {
commandCandidates = found;
- if (commandCandidateId && !found.some(item => item.id === commandCandidateId)) commandCandidateId = null;
+ const selected = found.find(item => item.id === commandCandidateId);
+ if (selected?.linkedId) { commandSelectedId = selected.linkedId; commandCandidateId = null; }
+ else if (commandCandidateId && !selected) commandCandidateId = null;
}
} catch (error) { if (root === projectRoot) commandCandidatesError = error.message; }
finally {
diff --git a/docs/product/architecture.md b/docs/product/architecture.md
index 769f6d5..38c14b7 100644
--- a/docs/product/architecture.md
+++ b/docs/product/architecture.md
@@ -39,8 +39,14 @@ The source audit improves setup completeness but is not a universal protocol imp
## API Explorer
+A project OpenAPI file already named in `workspace.apiSources` appears only as the registered API, including when the relative path uses a `./` prefix.
+
Project-local OpenAPI 3.x files are scanned read-only and listed beside HTTP APIs declared in `workspace.apiSources`. The file remains the source of truth for endpoint paths and summaries; the repository YAML stores only its relative path, clean base URL and public authentication metadata. Alternatively, `specPath` identifies a dynamically served OpenAPI document on the registered API. The user must click **Load OpenAPI**; the main process fetches from that API's origin without redirects or authentication headers, with a timeout and 2 MB limit. An API can be registered without a spec and tested with a manually entered relative path. The main process performs a request only after the user clicks Send, checks that the target stays on the selected origin, blocks redirects, applies a timeout and bounds the response preview. It resolves Bearer and API-key values from the local project `.env`. Public-client OAuth uses PKCE and a loopback callback; access and refresh tokens are encrypted outside the repository with macOS secure storage. Activity records only request metadata, without headers, query values, body or response content. The included Hello Workspace has a matching OpenAPI document for its real health and notes endpoints.
## MCP Explorer
The desktop main process uses the official MCP client SDK to connect to explicitly selected project servers over stdio, Streamable HTTP or legacy SSE. It keeps one client session per connected server, so several can remain connected while the user switches between them. Read-only discovery scans project-local MCP configuration and shared `workspace.mcpServers`; it does not launch anything. Add, link and remove actions update the YAML array atomically after schema validation; linked entries record the discovered source ID. The renderer gets safe server metadata, capabilities, schemas and user-requested results over IPC. Connect, disconnect and invocation metadata goes to `.productview/events.jsonl`; arguments and responses remain in memory. YAML declares only static variable names or public OAuth client metadata. Static values come from the ignored project `.env`; SDK-managed OAuth credentials are encrypted locally and scoped to the workspace and endpoint. The built-in Project Room MCP server serves coding agents and is hidden from the project MCP Explorer.
+
+### Linked MCP entries
+
+The catalog shows a client setting only when it is not already linked to a YAML registration. Matching uses transport plus the complete command or URL; different arguments and endpoints remain separate.
diff --git a/docs/product/command-tools.md b/docs/product/command-tools.md
index aa4c108..9ec5b75 100644
--- a/docs/product/command-tools.md
+++ b/docs/product/command-tools.md
@@ -1,5 +1,7 @@
# CLI Explorer
+An entry point already linked to a registered YAML tool appears only once, under the registered tool. Catalog counts reflect distinct tools rather than both discovery and registration.
+
CLI Explorer follows the same browse and inspect layout as MCP Explorer. The left catalog lists **Discovered locally** entry points found by reading the open repository: `package.json` `bin` entries, Python project scripts, Cargo binaries, Go `cmd/*/main.go` and `examples/*/main.go` programs, and executable CLI files. A package CLI whose declared `dist/` or `build/` target is absent is labeled **Build required**; it cannot be run, linked or queried for help until that target exists. This scan does not run candidates. It is intentionally bounded and may miss custom build systems; ordinary package scripts and tests are not automatically treated as product CLIs. **In .projectroom/project.yaml** lists registered `commandTool` components. Select either type to inspect it on the right.
Select a discovered entry to see its source file and exact command. **Read help** explicitly starts the command with `--help`, `-h`, or `help` and shows the real output, including a parsed synopsis, paired short and long flags, common subcommand lists and positional arguments where recognizable. Parsed commands and options become suggestions in Explore. The full original output stays visible because CLI help has no universal machine-readable format. A program can have side effects even while printing help; Project Room never requests it automatically. Discovery does not prove that the CLI is safe or fully documented.
diff --git a/scripts/api-explorer.test.cjs b/scripts/api-explorer.test.cjs
index 253cf3d..fdb5fed 100644
--- a/scripts/api-explorer.test.cjs
+++ b/scripts/api-explorer.test.cjs
@@ -48,6 +48,12 @@ test('discovers real OpenAPI operations and manages multiple YAML sources', t =>
assert.equal(discoverSpecs(root).length, 1);
});
+test('a configured OpenAPI file is not listed again when its path has a dot prefix', t => {
+ const root = fixture(t);
+ const config = { workspace: { apiSources: [{ id: 'orders', name: 'Orders', baseUrl: 'https://example.com', spec: './specs/001-orders/contracts/openapi.yaml' }] } };
+ assert.deepEqual(listApiSources(root, config).map(item => item.id), ['yaml:orders']);
+});
+
test('loads a live OpenAPI document only on request and only from the configured API origin', async t => {
const root = fixture(t);
const saved = addApiSource(root, { name: 'Live API', baseUrl: 'http://127.0.0.1:43179/rest', specPath: '/open-api/core' });
diff --git a/scripts/cli-explorer.test.cjs b/scripts/cli-explorer.test.cjs
index 1c848e8..dc8e54c 100644
--- a/scripts/cli-explorer.test.cjs
+++ b/scripts/cli-explorer.test.cjs
@@ -3,10 +3,30 @@ const assert = require('node:assert/strict');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
+const vm = require('node:vm');
const { discoverCliTools, inspectCliHelp, linkCliTool } = require('../desktop/cli-explorer.cjs');
const { runCliTrial } = require('../desktop/command-tools.cjs');
const { commandParsedHelp } = require('../dist/cli-help.js');
+test('CLI catalog lists a linked discovery only under its registered tool', () => {
+ const tool = { id: 'blackbox-host', kind: 'commandTool', name: 'Blackbox Host CLI', runtime: { command: ['./blackbox', '--help'] }, cli: { mode: 'task' } };
+ const candidate = { id: 'file:blackbox', name: 'blackbox', path: 'blackbox', source: 'executable', command: ['./blackbox'], linkedId: tool.id };
+ const context = {
+ document: { addEventListener() {} }, escapeHtml: String, icon: () => '', pageHead: () => '',
+ projectRoot: null, pv: null, state: { page: 'commands' }, commandToolsPage: null,
+ commandTools: () => [tool], commandSelected: () => tool, commandStatus: () => 'Stopped', commandLive: () => false,
+ commandCandidates: [candidate], commandCandidateId: candidate.id, commandCandidatesRoot: null,
+ commandCandidatesLoading: false, commandCandidatesError: '', commandSearch: '', commandTab: 'explore',
+ commandBusy: {}, commandHelp: {}, commandOutput: {}, commandCandidateHelp: {}, commandHelpArgs: {}
+ };
+ vm.runInNewContext(fs.readFileSync(path.join(__dirname, '../dist/cli-explorer-ui.js'), 'utf8'), context);
+ const html = context.commandToolsPage();
+ assert.match(html, /Project tools<\/strong>1 found/);
+ assert.match(html, /DISCOVERED LOCALLY · 0/);
+ assert.match(html, /Blackbox Host CLI/);
+ assert.doesNotMatch(html, /data-cli="select"/);
+});
+
test('recognizes paired flags, value options and subcommands in common help output', () => {
const help = commandParsedHelp('Usage: desk [OPTIONS]\n\nCommands:\n serve Start the server\n status Show status\n\nOptions:\n -h, --help Print help\n --format Output format\n -v, --verbose Verbose output');
assert.deepEqual(help.commands.map(item => item.name), ['serve', 'status']);
diff --git a/scripts/mcp-explorer.test.cjs b/scripts/mcp-explorer.test.cjs
index 1062909..2fd8a25 100644
--- a/scripts/mcp-explorer.test.cjs
+++ b/scripts/mcp-explorer.test.cjs
@@ -69,3 +69,19 @@ test('MCP configuration placeholders appear as local Environment variable names'
const names = referencedNames({ args: ['--token', '${MCP_TOKEN}'], headers: { Authorization: 'Bearer ${MCP_TOKEN}' }, env: { API_KEY: '${MCP_TOKEN}' } });
assert.deepEqual(names.sort(), ['API_KEY', 'MCP_TOKEN']);
});
+
+test('MCP client connection already registered in YAML is linked by its target', () => {
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'project-room-mcp-dedup-'));
+ try {
+ fs.writeFileSync(path.join(root, '.mcp.json'), JSON.stringify({ mcpServers: {
+ local: { command: './blackbox', args: ['mcp'] },
+ other: { command: './blackbox', args: ['mcp', '--other'] }
+ } }));
+ const config = { workspace: { mcpServers: [{ id: 'blackbox', name: 'Blackbox MCP', transport: 'stdio', command: './blackbox', args: ['mcp'], cwd: './' }] } };
+ const explorer = new McpExplorer({ getRoot: () => root, getConfig: () => config, getEnvironment: () => null });
+ const listed = explorer.list();
+ assert.equal(listed.find(item => item.id === '.mcp.json:local').linkedId, 'blackbox');
+ assert.equal(listed.find(item => item.id === '.mcp.json:other').linkedId, null);
+ assert.equal(listed.find(item => item.id === 'yaml:blackbox').linkedId, null);
+ } finally { fs.rmSync(root, { recursive: true, force: true }); }
+});