@martin4455/matomo-mcp-ro 0.4.1 → 0.4.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/CONFIGURATION.md +18 -12
- package/README.md +9 -8
- package/cli.mjs +2 -2
- package/lib/config.mjs +10 -1
- package/lib/version.mjs +1 -1
- package/package.json +1 -1
package/CONFIGURATION.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Matomo MCP configuration guide
|
|
2
2
|
|
|
3
|
-
For the quick setup, see the [README](README.md). This guide describes version 0.4.
|
|
3
|
+
For the quick setup, see the [README](README.md). This guide describes version 0.4.2 and newer.
|
|
4
4
|
|
|
5
5
|
## Source setup
|
|
6
6
|
|
|
@@ -34,10 +34,13 @@ read-only site-list request. Old-format records are invalid; enter the complete
|
|
|
34
34
|
connection again with `configure`. Enter retains valid saved credentials;
|
|
35
35
|
changing the URL requires new credentials.
|
|
36
36
|
|
|
37
|
-
The file `.matomo-mcp.json` lives in the exact current directory
|
|
38
|
-
`--config
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
The file `.matomo-mcp.json` lives in the exact current directory by default.
|
|
38
|
+
`--config .` selects that same directory; `--config "/path/to/project"` selects
|
|
39
|
+
another existing project directory. You can also pass the file path directly,
|
|
40
|
+
as in `--config "/path/to/project/.matomo-mcp.json"`.
|
|
41
|
+
Relative paths, including `.`, resolve from the server process's working
|
|
42
|
+
directory at startup. No home/parent/environment fallback is used. The file
|
|
43
|
+
contains only a reference, protected by mode 0600 on Unix or a private Windows ACL:
|
|
41
44
|
|
|
42
45
|
```json
|
|
43
46
|
{
|
|
@@ -180,13 +183,16 @@ The [README](README.md#3-connect-your-client) shows the CLI registration command
|
|
|
180
183
|
For a stable installation, `client-config codex`, `client-config claude-code` and
|
|
181
184
|
`client-config claude-desktop` print settings with absolute paths and no secrets.
|
|
182
185
|
These settings launch the installed Node.js executable and package directly.
|
|
183
|
-
|
|
186
|
+
From the directory you configured, generate the client settings with `--config .`:
|
|
184
187
|
|
|
185
188
|
```sh
|
|
186
|
-
matomo-mcp client-config codex --config
|
|
187
|
-
matomo-mcp client-config claude-code --config
|
|
189
|
+
matomo-mcp client-config codex --config .
|
|
190
|
+
matomo-mcp client-config claude-code --config .
|
|
188
191
|
```
|
|
189
192
|
|
|
193
|
+
The generator expands `.` to an absolute configuration file path, so the printed
|
|
194
|
+
settings work when the client starts from another directory too.
|
|
195
|
+
|
|
190
196
|
Merge the Codex TOML into `~/.codex/config.toml`, or the trusted project's
|
|
191
197
|
`.codex/config.toml` for project scope. Codex CLI and Desktop share these settings.
|
|
192
198
|
The generated server name is `matomo`; README registration examples use
|
|
@@ -196,10 +202,10 @@ and [Claude Code MCP](https://code.claude.com/docs/en/mcp).
|
|
|
196
202
|
|
|
197
203
|
### Claude Desktop setup
|
|
198
204
|
|
|
199
|
-
|
|
205
|
+
From the directory you configured, generate the desktop configuration:
|
|
200
206
|
|
|
201
207
|
```sh
|
|
202
|
-
matomo-mcp client-config claude-desktop --config
|
|
208
|
+
matomo-mcp client-config claude-desktop --config .
|
|
203
209
|
```
|
|
204
210
|
|
|
205
211
|
Open Claude Desktop's **Settings → Developer → Edit Config** and merge the printed
|
|
@@ -222,9 +228,9 @@ utilities. Keyring access uses native APIs inside Node; it does not launch shell
|
|
|
222
228
|
|
|
223
229
|
## Troubleshooting
|
|
224
230
|
|
|
225
|
-
-
|
|
231
|
+
- From the configured project directory, run `matomo-mcp status --config .` to
|
|
226
232
|
check the local file and stored credentials without an HTTP request.
|
|
227
|
-
- Run `matomo-mcp check --config
|
|
233
|
+
- Run `matomo-mcp check --config .` from that directory to
|
|
228
234
|
test access to Matomo. A token needs access to at least one site.
|
|
229
235
|
- If credentials are invalid or missing, run `configure` again with the same
|
|
230
236
|
`--config`. An unavailable credential store must be unlocked or repaired first.
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ node -v
|
|
|
14
14
|
npm install -g @martin4455/matomo-mcp-ro@latest
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
These setup instructions require version **0.4.2+**. For an unreleased
|
|
18
18
|
checkout, use the [source setup](CONFIGURATION.md#source-setup).
|
|
19
19
|
|
|
20
20
|
## 2. Configure
|
|
@@ -44,23 +44,24 @@ Existing entries in the old format are treated as invalid credentials. Run
|
|
|
44
44
|
|
|
45
45
|
## 3. Connect your client
|
|
46
46
|
|
|
47
|
-
From the same project directory, run the command for your client.
|
|
48
|
-
path with the absolute path to the configuration file created above.
|
|
47
|
+
From the same project directory, run the command for your client.
|
|
49
48
|
|
|
50
49
|
**Claude Code:**
|
|
51
50
|
|
|
52
51
|
```sh
|
|
53
|
-
claude mcp add matomo-local -- npx -y
|
|
54
|
-
@martin4455/matomo-mcp-ro@latest \
|
|
55
|
-
--config "/absolute/path/to/project/.matomo-mcp.json"
|
|
52
|
+
claude mcp add matomo-local -- npx -y @martin4455/matomo-mcp-ro@latest --config .
|
|
56
53
|
```
|
|
57
54
|
|
|
55
|
+
Start Claude Code from this directory so `.` selects your local configuration.
|
|
56
|
+
For Windows launch problems, see [launcher troubleshooting](CONFIGURATION.md#troubleshooting).
|
|
57
|
+
|
|
58
58
|
**Codex CLI:**
|
|
59
59
|
|
|
60
|
+
Replace the quoted path with the directory you configured above.
|
|
61
|
+
|
|
60
62
|
```sh
|
|
61
63
|
codex mcp add matomo-local -- npx -y \
|
|
62
|
-
@martin4455/matomo-mcp-ro@latest
|
|
63
|
-
--config "/absolute/path/to/project/.matomo-mcp.json"
|
|
64
|
+
@martin4455/matomo-mcp-ro@latest --config "/absolute/path/to/project"
|
|
64
65
|
```
|
|
65
66
|
|
|
66
67
|
**Claude Desktop:** follow the [Desktop setup](CONFIGURATION.md#claude-desktop-setup).
|
package/cli.mjs
CHANGED
|
@@ -8,14 +8,14 @@ import { clientConfiguration } from './lib/client-config.mjs';
|
|
|
8
8
|
import { VERSION } from './lib/version.mjs';
|
|
9
9
|
|
|
10
10
|
export { VERSION };
|
|
11
|
-
const help = `Matomo MCP - lokalny adapter Reporting API, tylko do odczytu\n\nUżycie: matomo-mcp [polecenie] [--config
|
|
11
|
+
const help = `Matomo MCP - lokalny adapter Reporting API, tylko do odczytu\n\nUżycie: matomo-mcp [polecenie] [--config katalog-lub-plik]\n\n configure Wpisz dane w terminalu, sprawdź i zapisz w keyringu\n check Sprawdź prawa pliku, keyring i połączenie z Matomo\n status Sprawdź konfigurację i keyring bez HTTP\n serve Uruchom MCP przez stdio (polecenie domyślne)\n client-config codex Wypisz wpis TOML z bezpośrednim startem Node.js\n client-config claude-code Wypisz wpis MCP JSON dla Claude Code\n client-config claude-desktop Wypisz wpis MCP JSON dla Claude Desktop\n --help / --version\n\n--config . wybiera plik ${CONFIG_NAME} w bieżącym katalogu.\nMożesz też podać inny katalog projektu lub ścieżkę do pliku konfiguracji.\nBez --config używany jest wyłącznie plik ${CONFIG_NAME} w bieżącym katalogu.\nURL, token i Basic Auth są w systemowym keyringu; plik zawiera tylko odwołanie.\nToken i dane HTTP Auth wpisuj tylko w configure, nigdy w argumentach poleceń.\n`;
|
|
12
12
|
|
|
13
13
|
export function parseArguments(argv) {
|
|
14
14
|
let config;
|
|
15
15
|
const positional = [];
|
|
16
16
|
for (let i = 0; i < argv.length; i++) {
|
|
17
17
|
if (argv[i] === '--config') {
|
|
18
|
-
if (config !== undefined || !argv[i + 1] || argv[i + 1].startsWith('-')) throw new ConfigError('Po --config podaj ścieżkę do pliku konfiguracji.');
|
|
18
|
+
if (config !== undefined || !argv[i + 1] || argv[i + 1].startsWith('-')) throw new ConfigError('Po --config podaj katalog projektu lub ścieżkę do pliku konfiguracji.');
|
|
19
19
|
config = argv[++i];
|
|
20
20
|
} else if (['--help', '-h', '--version'].includes(argv[i])) positional.push(argv[i]);
|
|
21
21
|
else if (argv[i].startsWith('-')) throw new ConfigError('Nieznana opcja. Użyj --help.');
|
package/lib/config.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
|
+
import { statSync } from 'node:fs';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { randomUUID } from 'node:crypto';
|
|
4
5
|
import { z } from 'zod';
|
|
@@ -32,7 +33,15 @@ export function validateConfig(value) {
|
|
|
32
33
|
if (!parsed.success) throw new ConfigError('Nieprawidłowa konfiguracja Matomo. Wymagane są adres HTTPS i token; opcjonalny Basic Auth wymaga loginu i hasła.');
|
|
33
34
|
return { ...parsed.data, baseUrl: normalizeBaseUrl(parsed.data.baseUrl) };
|
|
34
35
|
}
|
|
35
|
-
export function resolveConfigPath(explicit, cwd = process.cwd()) {
|
|
36
|
+
export function resolveConfigPath(explicit, cwd = process.cwd()) {
|
|
37
|
+
const target = path.resolve(cwd, explicit ?? CONFIG_NAME);
|
|
38
|
+
if (explicit === undefined) return target;
|
|
39
|
+
try {
|
|
40
|
+
return statSync(target, { throwIfNoEntry: false })?.isDirectory() ? path.join(target, CONFIG_NAME) : target;
|
|
41
|
+
} catch {
|
|
42
|
+
throw new ConfigError('Nie można sprawdzić ścieżki konfiguracji. Sprawdź prawa do pliku lub katalogu.', 'CONFIG_READ_FAILED');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
36
45
|
|
|
37
46
|
export async function readConfigRecord(target, options) {
|
|
38
47
|
const file = await readConfigFile(target, options);
|
package/lib/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.4.
|
|
1
|
+
export const VERSION = '0.4.2';
|