@entergram/mcp 0.1.3 → 0.1.5
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/README.md +15 -24
- package/dist/cli/config.js +9 -2
- package/dist/cli/constants.js +2 -1
- package/dist/cli/remote-client.js +3 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,24 +22,15 @@ npx -y @entergram/mcp serve
|
|
|
22
22
|
|
|
23
23
|
## Quick Start
|
|
24
24
|
|
|
25
|
-
Production:
|
|
26
|
-
|
|
27
25
|
```bash
|
|
28
26
|
entergram-mcp login
|
|
29
27
|
entergram-mcp serve
|
|
30
28
|
```
|
|
31
29
|
|
|
32
|
-
Development:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
entergram-mcp login --env dev
|
|
36
|
-
entergram-mcp serve --env dev
|
|
37
|
-
```
|
|
38
|
-
|
|
39
30
|
If you use a custom OAuth client, pass it explicitly:
|
|
40
31
|
|
|
41
32
|
```bash
|
|
42
|
-
entergram-mcp login --
|
|
33
|
+
entergram-mcp login --client-id entergram-ws-your-client-id
|
|
43
34
|
```
|
|
44
35
|
|
|
45
36
|
## Commands
|
|
@@ -55,7 +46,7 @@ entergram-mcp print-config
|
|
|
55
46
|
|
|
56
47
|
Useful flags:
|
|
57
48
|
|
|
58
|
-
- `--env
|
|
49
|
+
- `--env production`
|
|
59
50
|
- `--client-id ...`
|
|
60
51
|
- `--scope "..."`
|
|
61
52
|
- `--format json|toml`
|
|
@@ -71,34 +62,27 @@ entergram-mcp print-config --name entergram
|
|
|
71
62
|
For TOML-based hosts such as Codex:
|
|
72
63
|
|
|
73
64
|
```bash
|
|
74
|
-
entergram-mcp print-config --format toml --name entergram
|
|
65
|
+
entergram-mcp print-config --format toml --name entergram
|
|
75
66
|
```
|
|
76
67
|
|
|
77
68
|
Example TOML config:
|
|
78
69
|
|
|
79
70
|
```toml
|
|
80
|
-
[mcp_servers.entergram
|
|
71
|
+
[mcp_servers.entergram]
|
|
81
72
|
command = "entergram-mcp"
|
|
82
73
|
args = ["serve"]
|
|
83
74
|
|
|
84
|
-
[mcp_servers.entergram
|
|
85
|
-
ENTERGRAM_MCP_ENV = "
|
|
75
|
+
[mcp_servers.entergram.env]
|
|
76
|
+
ENTERGRAM_MCP_ENV = "production"
|
|
86
77
|
ENTERGRAM_MCP_CLIENT_ID = "entergram-ws-your-client-id"
|
|
87
78
|
ENTERGRAM_MCP_SCOPE = "workspace.read members.read accounts.read contacts.read chats.read messages.read messages.write custom_fields.read custom_fields.write tickets.read offline_access"
|
|
88
79
|
```
|
|
89
80
|
|
|
90
81
|
## Defaults
|
|
91
82
|
|
|
92
|
-
Production:
|
|
93
|
-
|
|
94
83
|
- gateway: `https://mcp.entergram.com/mcp`
|
|
95
84
|
- client id: `entergram-mcp-cli`
|
|
96
85
|
|
|
97
|
-
Development:
|
|
98
|
-
|
|
99
|
-
- gateway: `https://devmcp.entergram.com/mcp`
|
|
100
|
-
- client id: `entergram-dev-mcp-client`
|
|
101
|
-
|
|
102
86
|
Default local OAuth callback:
|
|
103
87
|
|
|
104
88
|
`http://127.0.0.1:8787/oauth/callback`
|
|
@@ -118,6 +102,13 @@ Use a workspace client if you need broader scopes such as:
|
|
|
118
102
|
- `custom_fields.read`
|
|
119
103
|
- `custom_fields.write`
|
|
120
104
|
|
|
105
|
+
When `ENTERGRAM_MCP_CLIENT_ID` starts with `entergram-personal-`, the CLI uses a safer personal default scope that includes:
|
|
106
|
+
|
|
107
|
+
- `chat_custom_fields.read`
|
|
108
|
+
- `chat_custom_fields.write`
|
|
109
|
+
|
|
110
|
+
and excludes workspace-admin scopes such as `members.read` and `custom_fields.write`.
|
|
111
|
+
|
|
121
112
|
If the consent screen does not show the scopes you expect, update that OAuth client's `allowedScopes` in Entergram first, then run login again.
|
|
122
113
|
|
|
123
114
|
## Troubleshooting
|
|
@@ -137,6 +128,6 @@ If the consent screen does not show the scopes you expect, update that OAuth cli
|
|
|
137
128
|
- Clear the local session and log in again:
|
|
138
129
|
|
|
139
130
|
```bash
|
|
140
|
-
entergram-mcp logout --
|
|
141
|
-
entergram-mcp login --
|
|
131
|
+
entergram-mcp logout --client-id entergram-ws-your-client-id
|
|
132
|
+
entergram-mcp login --client-id entergram-ws-your-client-id
|
|
142
133
|
```
|
package/dist/cli/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import os from "node:os";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { DEFAULT_CALLBACK_HOST, DEFAULT_CALLBACK_PATH, DEFAULT_CALLBACK_PORT, DEFAULT_CONFIG_DIRECTORY_NAME,
|
|
3
|
+
import { DEFAULT_CALLBACK_HOST, DEFAULT_CALLBACK_PATH, DEFAULT_CALLBACK_PORT, DEFAULT_CONFIG_DIRECTORY_NAME, DEFAULT_PERSONAL_SCOPE, DEFAULT_WORKSPACE_SCOPE, } from "./constants.js";
|
|
4
4
|
const ENVIRONMENT_PRESETS = {
|
|
5
5
|
dev: {
|
|
6
6
|
clientId: "entergram-dev-mcp-client",
|
|
@@ -40,6 +40,12 @@ function parsePositiveInteger(value, fallback) {
|
|
|
40
40
|
function sanitizeFileSegment(value) {
|
|
41
41
|
return value.replace(/[^a-zA-Z0-9._-]+/g, "-");
|
|
42
42
|
}
|
|
43
|
+
function defaultScopeForClientId(clientId) {
|
|
44
|
+
if (clientId.startsWith("entergram-personal-")) {
|
|
45
|
+
return DEFAULT_PERSONAL_SCOPE;
|
|
46
|
+
}
|
|
47
|
+
return DEFAULT_WORKSPACE_SCOPE;
|
|
48
|
+
}
|
|
43
49
|
export function resolveCliRuntimeConfig(flags) {
|
|
44
50
|
const environment = getEnvironmentName(flags);
|
|
45
51
|
const preset = ENVIRONMENT_PRESETS[environment];
|
|
@@ -52,9 +58,10 @@ export function resolveCliRuntimeConfig(flags) {
|
|
|
52
58
|
const oauthIssuerUrl = getStringFlag(flags, "oauth-issuer-url") ||
|
|
53
59
|
process.env.ENTERGRAM_MCP_OAUTH_ISSUER_URL?.trim() ||
|
|
54
60
|
preset.oauthIssuerUrl;
|
|
61
|
+
const defaultScope = defaultScopeForClientId(clientId);
|
|
55
62
|
const scope = getStringFlag(flags, "scope") ||
|
|
56
63
|
process.env.ENTERGRAM_MCP_SCOPE?.trim() ||
|
|
57
|
-
|
|
64
|
+
defaultScope;
|
|
58
65
|
const callbackPort = parsePositiveInteger(getStringFlag(flags, "callback-port") ||
|
|
59
66
|
process.env.ENTERGRAM_MCP_CALLBACK_PORT?.trim(), DEFAULT_CALLBACK_PORT);
|
|
60
67
|
const configDir = getStringFlag(flags, "config-dir") ||
|
package/dist/cli/constants.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const CLI_VERSION = "0.1.0";
|
|
2
|
-
export const
|
|
2
|
+
export const DEFAULT_WORKSPACE_SCOPE = "workspace.read members.read accounts.read contacts.read chats.read messages.read messages.write custom_fields.read custom_fields.write tickets.read offline_access";
|
|
3
|
+
export const DEFAULT_PERSONAL_SCOPE = "workspace.read accounts.read contacts.read chats.read chat_custom_fields.read chat_custom_fields.write messages.read tickets.read offline_access";
|
|
3
4
|
export const DEFAULT_CALLBACK_HOST = "127.0.0.1";
|
|
4
5
|
export const DEFAULT_CALLBACK_PORT = 8787;
|
|
5
6
|
export const DEFAULT_CALLBACK_PATH = "/oauth/callback";
|
|
@@ -50,19 +50,12 @@ export class EntergramRemoteClient {
|
|
|
50
50
|
if (!(error instanceof UnauthorizedError) || !options.interactive) {
|
|
51
51
|
throw error;
|
|
52
52
|
}
|
|
53
|
-
await client.close().catch(() => undefined);
|
|
54
|
-
({ client, transport } = createPair());
|
|
55
53
|
const callbackPromise = waitForOAuthCallback(this.config.callbackUrl, 5 * 60 * 1000, () => this.authProvider.expectedState());
|
|
56
|
-
try {
|
|
57
|
-
await client.connect(transport);
|
|
58
|
-
}
|
|
59
|
-
catch (interactiveError) {
|
|
60
|
-
if (!(interactiveError instanceof UnauthorizedError)) {
|
|
61
|
-
throw interactiveError;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
54
|
const code = await callbackPromise;
|
|
65
55
|
await transport.finishAuth(code);
|
|
56
|
+
await client.close().catch(() => undefined);
|
|
57
|
+
await transport.close().catch(() => undefined);
|
|
58
|
+
({ client, transport } = createPair());
|
|
66
59
|
await client.connect(transport);
|
|
67
60
|
}
|
|
68
61
|
this.client = client;
|
package/package.json
CHANGED