teams-api 0.2.7 → 0.3.0
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 -19
- package/dist/mcp-server.d.ts +2 -3
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +50 -23
- package/dist/mcp-server.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,8 +53,7 @@ Add to your VS Code MCP config (`.vscode/mcp.json` or User Settings):
|
|
|
53
53
|
"command": "npx",
|
|
54
54
|
"args": ["-y", "teams-api@latest"],
|
|
55
55
|
"env": {
|
|
56
|
-
"TEAMS_LOGIN": "true"
|
|
57
|
-
"TEAMS_EMAIL": "you@example.com"
|
|
56
|
+
"TEAMS_LOGIN": "true"
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
}
|
|
@@ -75,8 +74,7 @@ Click the **Install in Cursor** badge at the top, or add to `~/.cursor/mcp.json`
|
|
|
75
74
|
"command": "npx",
|
|
76
75
|
"args": ["-y", "teams-api@latest"],
|
|
77
76
|
"env": {
|
|
78
|
-
"TEAMS_LOGIN": "true"
|
|
79
|
-
"TEAMS_EMAIL": "you@example.com"
|
|
77
|
+
"TEAMS_LOGIN": "true"
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
80
|
}
|
|
@@ -97,8 +95,7 @@ Add to `claude_desktop_config.json` ([how to find it](https://modelcontextprotoc
|
|
|
97
95
|
"command": "npx",
|
|
98
96
|
"args": ["-y", "teams-api@latest"],
|
|
99
97
|
"env": {
|
|
100
|
-
"TEAMS_LOGIN": "true"
|
|
101
|
-
"TEAMS_EMAIL": "you@example.com"
|
|
98
|
+
"TEAMS_LOGIN": "true"
|
|
102
99
|
}
|
|
103
100
|
}
|
|
104
101
|
}
|
|
@@ -114,7 +111,7 @@ Add to `claude_desktop_config.json` ([how to find it](https://modelcontextprotoc
|
|
|
114
111
|
claude mcp add teams -- npx -y teams-api@latest
|
|
115
112
|
```
|
|
116
113
|
|
|
117
|
-
Then set the environment
|
|
114
|
+
Then set the environment variable `TEAMS_LOGIN=true` in your shell before starting Claude Code. The server will ask for your email interactively on first use.
|
|
118
115
|
|
|
119
116
|
</details>
|
|
120
117
|
|
|
@@ -130,8 +127,7 @@ Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
|
130
127
|
"command": "npx",
|
|
131
128
|
"args": ["-y", "teams-api@latest"],
|
|
132
129
|
"env": {
|
|
133
|
-
"TEAMS_LOGIN": "true"
|
|
134
|
-
"TEAMS_EMAIL": "you@example.com"
|
|
130
|
+
"TEAMS_LOGIN": "true"
|
|
135
131
|
}
|
|
136
132
|
}
|
|
137
133
|
}
|
|
@@ -354,16 +350,16 @@ Use this only if you already have tokens from another flow or need to avoid brow
|
|
|
354
350
|
|
|
355
351
|
### Environment variables
|
|
356
352
|
|
|
357
|
-
| Variable | Description
|
|
358
|
-
| ----------------------- |
|
|
359
|
-
| `TEAMS_TOKEN` | Pre-existing skype token
|
|
360
|
-
| `TEAMS_BEARER_TOKEN` | Optional middle-tier bearer token
|
|
361
|
-
| `TEAMS_SUBSTRATE_TOKEN` | Optional Substrate bearer token
|
|
362
|
-
| `TEAMS_REGION` | API region override. Required with `TEAMS_TOKEN`; optional otherwise
|
|
363
|
-
| `TEAMS_EMAIL` | Corporate email
|
|
364
|
-
| `TEAMS_AUTO` | Set to `true` to enable auto-login (macOS + FIDO2)
|
|
365
|
-
| `TEAMS_LOGIN` | Set to `true` to enable interactive browser login
|
|
366
|
-
| `TEAMS_DEBUG_PORT` | Chrome debug port (default: 9222)
|
|
353
|
+
| Variable | Description |
|
|
354
|
+
| ----------------------- | --------------------------------------------------------------------- |
|
|
355
|
+
| `TEAMS_TOKEN` | Pre-existing skype token |
|
|
356
|
+
| `TEAMS_BEARER_TOKEN` | Optional middle-tier bearer token |
|
|
357
|
+
| `TEAMS_SUBSTRATE_TOKEN` | Optional Substrate bearer token |
|
|
358
|
+
| `TEAMS_REGION` | API region override. Required with `TEAMS_TOKEN`; optional otherwise |
|
|
359
|
+
| `TEAMS_EMAIL` | Corporate email. Optional — the server prompts the AI agent if needed |
|
|
360
|
+
| `TEAMS_AUTO` | Set to `true` to enable auto-login (macOS + FIDO2) |
|
|
361
|
+
| `TEAMS_LOGIN` | Set to `true` to enable interactive browser login |
|
|
362
|
+
| `TEAMS_DEBUG_PORT` | Chrome debug port (default: 9222) |
|
|
367
363
|
|
|
368
364
|
### Available tools
|
|
369
365
|
|
package/dist/mcp-server.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* TEAMS_BEARER_TOKEN — Optional middle-tier bearer token for profile resolution
|
|
13
13
|
* TEAMS_SUBSTRATE_TOKEN — Optional Substrate bearer token for people/chat search
|
|
14
14
|
* TEAMS_REGION — API region (required with TEAMS_TOKEN, optional otherwise)
|
|
15
|
-
* TEAMS_EMAIL — Corporate email (
|
|
15
|
+
* TEAMS_EMAIL — Corporate email (optional; the server prompts the AI agent if needed)
|
|
16
16
|
* TEAMS_AUTO — Set to "true" to use auto-login (macOS + FIDO2)
|
|
17
17
|
* TEAMS_LOGIN — Set to "true" to use interactive browser login (all platforms)
|
|
18
18
|
* TEAMS_DEBUG_PORT — Chrome debug port (default: 9222)
|
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
* "command": "npx",
|
|
25
25
|
* "args": ["-y", "teams-api"],
|
|
26
26
|
* "env": {
|
|
27
|
-
* "
|
|
28
|
-
* "TEAMS_EMAIL": "user@company.com"
|
|
27
|
+
* "TEAMS_LOGIN": "true"
|
|
29
28
|
* }
|
|
30
29
|
* }
|
|
31
30
|
* }
|
package/dist/mcp-server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG"}
|
package/dist/mcp-server.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* TEAMS_BEARER_TOKEN — Optional middle-tier bearer token for profile resolution
|
|
14
14
|
* TEAMS_SUBSTRATE_TOKEN — Optional Substrate bearer token for people/chat search
|
|
15
15
|
* TEAMS_REGION — API region (required with TEAMS_TOKEN, optional otherwise)
|
|
16
|
-
* TEAMS_EMAIL — Corporate email (
|
|
16
|
+
* TEAMS_EMAIL — Corporate email (optional; the server prompts the AI agent if needed)
|
|
17
17
|
* TEAMS_AUTO — Set to "true" to use auto-login (macOS + FIDO2)
|
|
18
18
|
* TEAMS_LOGIN — Set to "true" to use interactive browser login (all platforms)
|
|
19
19
|
* TEAMS_DEBUG_PORT — Chrome debug port (default: 9222)
|
|
@@ -25,8 +25,7 @@
|
|
|
25
25
|
* "command": "npx",
|
|
26
26
|
* "args": ["-y", "teams-api"],
|
|
27
27
|
* "env": {
|
|
28
|
-
* "
|
|
29
|
-
* "TEAMS_EMAIL": "user@company.com"
|
|
28
|
+
* "TEAMS_LOGIN": "true"
|
|
30
29
|
* }
|
|
31
30
|
* }
|
|
32
31
|
* }
|
|
@@ -39,7 +38,14 @@ const zod_1 = require("zod");
|
|
|
39
38
|
const teams_client_js_1 = require("./teams-client.js");
|
|
40
39
|
const actions_js_1 = require("./actions.js");
|
|
41
40
|
let clientInstance = null;
|
|
42
|
-
|
|
41
|
+
class NeedsEmailError extends Error {
|
|
42
|
+
constructor() {
|
|
43
|
+
super("I need your corporate email address to log into Teams. " +
|
|
44
|
+
"Please provide your email and call this tool again.");
|
|
45
|
+
this.name = "NeedsEmailError";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function getClient(toolEmail) {
|
|
43
49
|
if (clientInstance) {
|
|
44
50
|
return clientInstance;
|
|
45
51
|
}
|
|
@@ -47,7 +53,7 @@ async function getClient() {
|
|
|
47
53
|
const envBearerToken = process.env.TEAMS_BEARER_TOKEN;
|
|
48
54
|
const envSubstrateToken = process.env.TEAMS_SUBSTRATE_TOKEN;
|
|
49
55
|
const envRegion = process.env.TEAMS_REGION;
|
|
50
|
-
const
|
|
56
|
+
const email = process.env.TEAMS_EMAIL || toolEmail;
|
|
51
57
|
const envAuto = process.env.TEAMS_AUTO === "true";
|
|
52
58
|
const envLogin = process.env.TEAMS_LOGIN === "true";
|
|
53
59
|
const envDebugPort = process.env.TEAMS_DEBUG_PORT
|
|
@@ -59,9 +65,12 @@ async function getClient() {
|
|
|
59
65
|
}
|
|
60
66
|
clientInstance = teams_client_js_1.TeamsClient.fromToken(envToken, envRegion, envBearerToken, envSubstrateToken);
|
|
61
67
|
}
|
|
62
|
-
else if (envAuto
|
|
68
|
+
else if (envAuto) {
|
|
69
|
+
if (!email) {
|
|
70
|
+
throw new NeedsEmailError();
|
|
71
|
+
}
|
|
63
72
|
clientInstance = await teams_client_js_1.TeamsClient.create({
|
|
64
|
-
email
|
|
73
|
+
email,
|
|
65
74
|
region: envRegion,
|
|
66
75
|
headless: true,
|
|
67
76
|
verbose: false,
|
|
@@ -70,7 +79,7 @@ async function getClient() {
|
|
|
70
79
|
else if (envLogin) {
|
|
71
80
|
clientInstance = await teams_client_js_1.TeamsClient.fromInteractiveLogin({
|
|
72
81
|
region: envRegion,
|
|
73
|
-
email
|
|
82
|
+
email,
|
|
74
83
|
verbose: false,
|
|
75
84
|
});
|
|
76
85
|
}
|
|
@@ -116,26 +125,44 @@ for (const action of actions_js_1.actions) {
|
|
|
116
125
|
.enum(["json", "text", "md", "toon"])
|
|
117
126
|
.describe("Output format (default: toon)")
|
|
118
127
|
.optional();
|
|
128
|
+
inputSchema["email"] = zod_1.z
|
|
129
|
+
.string()
|
|
130
|
+
.describe("Corporate email address for Teams login. " +
|
|
131
|
+
"Only needed if the server asks for it.")
|
|
132
|
+
.optional();
|
|
119
133
|
server.registerTool(toolName, {
|
|
120
134
|
title: action.title,
|
|
121
135
|
description: action.description,
|
|
122
136
|
inputSchema,
|
|
123
137
|
}, async (parameters) => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
try {
|
|
139
|
+
const client = await getClient(parameters.email);
|
|
140
|
+
const outputFormat = parameters.format ?? "toon";
|
|
141
|
+
const result = await action.execute(client, parameters);
|
|
142
|
+
const structuredContent = result !== null &&
|
|
143
|
+
typeof result === "object" &&
|
|
144
|
+
!Array.isArray(result)
|
|
145
|
+
? result
|
|
146
|
+
: { data: result };
|
|
147
|
+
return {
|
|
148
|
+
content: [
|
|
149
|
+
{
|
|
150
|
+
type: "text",
|
|
151
|
+
text: (0, actions_js_1.formatOutput)(action, result, outputFormat),
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
structuredContent,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
if (error instanceof NeedsEmailError) {
|
|
159
|
+
return {
|
|
160
|
+
content: [{ type: "text", text: error.message }],
|
|
161
|
+
isError: true,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
139
166
|
});
|
|
140
167
|
}
|
|
141
168
|
async function main() {
|
package/dist/mcp-server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";;AACA
|
|
1
|
+
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;;AAEH,oEAAoE;AACpE,wEAAiF;AACjF,6BAAwB;AACxB,uDAAgD;AAChD,6CAAqD;AAGrD,IAAI,cAAc,G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