msgraph-mcp-server 0.3.0__tar.gz → 0.3.2__tar.gz
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.
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/.env.example +0 -1
- msgraph_mcp_server-0.3.2/.github/dependabot.yml +17 -0
- msgraph_mcp_server-0.3.2/.github/workflows/ci.yml +54 -0
- msgraph_mcp_server-0.3.2/.github/workflows/release.yml +112 -0
- msgraph_mcp_server-0.3.2/CONTRIBUTING.md +54 -0
- msgraph_mcp_server-0.3.2/PKG-INFO +164 -0
- msgraph_mcp_server-0.3.2/README.md +137 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/pyproject.toml +8 -1
- msgraph_mcp_server-0.3.2/server.json +42 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/auth/cli.py +1 -2
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/auth/token.py +1 -3
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/config.py +10 -1
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/graph/batch.py +12 -4
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/graph/serialize.py +52 -21
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/graph/trimming.py +20 -6
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/tools/_binary.py +2 -1
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/tools/calendar.py +103 -38
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/tools/mail_actions.py +55 -20
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/tools/mail_batch.py +31 -10
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/tools/mail_folders.py +16 -5
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/tools/mail_read.py +81 -26
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/tools/mail_rules.py +4 -6
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/tools/mail_write.py +106 -35
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/tools/teams_channels.py +116 -27
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/tools/teams_chats.py +45 -14
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/tools/teams_content.py +30 -10
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/integration/test_live_smoke.py +3 -1
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_auth_cli.py +7 -2
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_auth_msal_app.py +6 -2
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_config.py +16 -4
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_graph_auth_provider.py +6 -2
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_graph_batch.py +118 -49
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_graph_errors.py +3 -1
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_graph_pagination.py +3 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_graph_serialize.py +76 -21
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_graph_trimming.py +80 -31
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_tools_calendar.py +18 -6
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_tools_mail_actions.py +5 -1
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_tools_mail_batch.py +9 -3
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_tools_mail_folders.py +44 -13
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_tools_mail_read.py +70 -21
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_tools_mail_rules.py +15 -9
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_tools_mail_write.py +53 -13
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_tools_teams_channels.py +39 -14
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_tools_teams_chats.py +26 -9
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_tools_teams_content.py +25 -5
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/uv.lock +1 -1
- msgraph_mcp_server-0.3.0/.github/workflows/release.yml +0 -46
- msgraph_mcp_server-0.3.0/PKG-INFO +0 -243
- msgraph_mcp_server-0.3.0/README.md +0 -216
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/.gitignore +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/LICENSE +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/__init__.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/auth/__init__.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/auth/msal_app.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/graph/__init__.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/graph/auth_provider.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/graph/client.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/graph/errors.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/graph/pagination.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/server.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/tools/__init__.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/src/msgraph_mcp/tools/util.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/__init__.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/conftest.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/fixtures/__init__.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/fixtures/event_minimal.json +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/fixtures/message_minimal.json +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/integration/__init__.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/integration/test_rules_and_folders_live.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_auth_token.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_graph_client.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_server.py +0 -0
- {msgraph_mcp_server-0.3.0 → msgraph_mcp_server-0.3.2}/tests/test_tools_util.py +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: uv
|
|
4
|
+
directory: /
|
|
5
|
+
schedule:
|
|
6
|
+
interval: weekly
|
|
7
|
+
groups:
|
|
8
|
+
python-dependencies:
|
|
9
|
+
patterns: ["*"]
|
|
10
|
+
|
|
11
|
+
- package-ecosystem: github-actions
|
|
12
|
+
directory: /
|
|
13
|
+
schedule:
|
|
14
|
+
interval: weekly
|
|
15
|
+
groups:
|
|
16
|
+
github-actions:
|
|
17
|
+
patterns: ["*"]
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: ci-${{ github.ref }}
|
|
10
|
+
cancel-in-progress: true
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v7
|
|
21
|
+
|
|
22
|
+
- uses: astral-sh/setup-uv@v10.0.1
|
|
23
|
+
with:
|
|
24
|
+
enable-cache: true
|
|
25
|
+
|
|
26
|
+
- name: Run tests
|
|
27
|
+
run: uv run --python ${{ matrix.python-version }} --group dev pytest -q
|
|
28
|
+
|
|
29
|
+
lint:
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v7
|
|
33
|
+
|
|
34
|
+
- uses: astral-sh/setup-uv@v10.0.1
|
|
35
|
+
with:
|
|
36
|
+
enable-cache: true
|
|
37
|
+
|
|
38
|
+
- name: Lint
|
|
39
|
+
run: uv run ruff check .
|
|
40
|
+
|
|
41
|
+
- name: Check formatting
|
|
42
|
+
run: uv run ruff format --check .
|
|
43
|
+
|
|
44
|
+
types:
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@v7
|
|
48
|
+
|
|
49
|
+
- uses: astral-sh/setup-uv@v10.0.1
|
|
50
|
+
with:
|
|
51
|
+
enable-cache: true
|
|
52
|
+
|
|
53
|
+
- name: Type check
|
|
54
|
+
run: uv run pyright src tests
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
name: Release to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
# Publishing to PyPI is irreversible (a version can be yanked, never reused),
|
|
10
|
+
# so the full check suite gates the release.
|
|
11
|
+
verify:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v7
|
|
19
|
+
|
|
20
|
+
- uses: astral-sh/setup-uv@v10.0.1
|
|
21
|
+
with:
|
|
22
|
+
enable-cache: true
|
|
23
|
+
|
|
24
|
+
- name: Run tests
|
|
25
|
+
run: uv run --python ${{ matrix.python-version }} --group dev pytest -q
|
|
26
|
+
|
|
27
|
+
- name: Lint
|
|
28
|
+
run: uv run ruff check .
|
|
29
|
+
|
|
30
|
+
- name: Check formatting
|
|
31
|
+
run: uv run ruff format --check .
|
|
32
|
+
|
|
33
|
+
- name: Type check
|
|
34
|
+
run: uv run pyright src tests
|
|
35
|
+
|
|
36
|
+
build:
|
|
37
|
+
needs: verify
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v7
|
|
41
|
+
|
|
42
|
+
- name: Install uv
|
|
43
|
+
uses: astral-sh/setup-uv@v10.0.1
|
|
44
|
+
|
|
45
|
+
- name: Build sdist and wheel
|
|
46
|
+
run: uv build
|
|
47
|
+
|
|
48
|
+
- name: Check tag matches package version
|
|
49
|
+
run: |
|
|
50
|
+
version=$(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')
|
|
51
|
+
if [ "v$version" != "$GITHUB_REF_NAME" ]; then
|
|
52
|
+
echo "Tag $GITHUB_REF_NAME does not match pyproject.toml version $version" >&2
|
|
53
|
+
exit 1
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
- uses: actions/upload-artifact@v7
|
|
57
|
+
with:
|
|
58
|
+
name: dist
|
|
59
|
+
path: dist/
|
|
60
|
+
|
|
61
|
+
publish:
|
|
62
|
+
needs: build
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
environment: pypi
|
|
65
|
+
permissions:
|
|
66
|
+
id-token: write # required for PyPI Trusted Publishing (OIDC)
|
|
67
|
+
steps:
|
|
68
|
+
- uses: actions/download-artifact@v8
|
|
69
|
+
with:
|
|
70
|
+
name: dist
|
|
71
|
+
path: dist/
|
|
72
|
+
|
|
73
|
+
- name: Publish to PyPI
|
|
74
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
75
|
+
|
|
76
|
+
mcp-registry:
|
|
77
|
+
needs: publish
|
|
78
|
+
runs-on: ubuntu-latest
|
|
79
|
+
permissions:
|
|
80
|
+
id-token: write # required for MCP registry OIDC login
|
|
81
|
+
contents: read
|
|
82
|
+
steps:
|
|
83
|
+
- uses: actions/checkout@v7
|
|
84
|
+
|
|
85
|
+
- name: Install mcp-publisher
|
|
86
|
+
run: |
|
|
87
|
+
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
|
|
88
|
+
|
|
89
|
+
- name: Set version in server.json from tag
|
|
90
|
+
run: |
|
|
91
|
+
VERSION=${GITHUB_REF_NAME#v}
|
|
92
|
+
jq --arg v "$VERSION" '.version = $v | .packages[0].version = $v' server.json > server.tmp && mv server.tmp server.json
|
|
93
|
+
|
|
94
|
+
- name: Wait for package on PyPI
|
|
95
|
+
run: |
|
|
96
|
+
VERSION=${GITHUB_REF_NAME#v}
|
|
97
|
+
for i in $(seq 1 30); do
|
|
98
|
+
if curl -sf "https://pypi.org/pypi/msgraph-mcp-server/$VERSION/json" > /dev/null; then
|
|
99
|
+
echo "PyPI has $VERSION"
|
|
100
|
+
exit 0
|
|
101
|
+
fi
|
|
102
|
+
echo "waiting for PyPI ($i)..."
|
|
103
|
+
sleep 10
|
|
104
|
+
done
|
|
105
|
+
echo "Timed out waiting for msgraph-mcp-server $VERSION on PyPI" >&2
|
|
106
|
+
exit 1
|
|
107
|
+
|
|
108
|
+
- name: Authenticate to MCP registry
|
|
109
|
+
run: ./mcp-publisher login github-oidc
|
|
110
|
+
|
|
111
|
+
- name: Publish to MCP registry
|
|
112
|
+
run: ./mcp-publisher publish
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
git clone https://github.com/timfurlong/msgraph-mcp
|
|
7
|
+
cd msgraph-mcp
|
|
8
|
+
uv sync
|
|
9
|
+
cp .env.example .env # fill in MSGRAPH_MCP_CLIENT_ID and MSGRAPH_MCP_TENANT_ID
|
|
10
|
+
uv run msgraph-mcp-login
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Point an MCP host at the working tree with:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
claude mcp add msgraph -- uv --directory "$(pwd)" run msgraph-mcp
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Checks
|
|
20
|
+
|
|
21
|
+
CI runs all four on every push and pull request, against Python 3.11, 3.12, and 3.13.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
uv run pytest # unit tests
|
|
25
|
+
uv run ruff check . # lint
|
|
26
|
+
uv run ruff format . # format (CI runs --check)
|
|
27
|
+
uv run pyright src tests # types, must stay at zero errors
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Integration tests make real Graph calls against the signed-in account and are skipped unless you opt in:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
MSGRAPH_MCP_INTEGRATION=1 uv run pytest
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Releasing
|
|
37
|
+
|
|
38
|
+
Releases are tag-driven. Bump `version` in `pyproject.toml`, commit, then:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git tag vX.Y.Z && git push origin vX.Y.Z
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The tag must match the `pyproject.toml` version or the workflow fails. From there
|
|
45
|
+
`.github/workflows/release.yml` runs the checks, publishes to PyPI via Trusted
|
|
46
|
+
Publishing (OIDC, no API tokens), and updates the MCP registry entry from
|
|
47
|
+
`server.json`.
|
|
48
|
+
|
|
49
|
+
Two things to know:
|
|
50
|
+
|
|
51
|
+
- PyPI versions can be yanked but never reused, so a bad release costs a version number.
|
|
52
|
+
- The README is the PyPI long description and the registry's ownership proof. It must
|
|
53
|
+
keep the `mcp-name: io.github.timfurlong/msgraph-mcp` comment, and README changes only
|
|
54
|
+
reach PyPI and the registry when a new version ships.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: msgraph-mcp-server
|
|
3
|
+
Version: 0.3.2
|
|
4
|
+
Summary: MCP server for Microsoft Graph: Outlook mail and calendar, plus read-only Microsoft Teams
|
|
5
|
+
Project-URL: Homepage, https://github.com/timfurlong/msgraph-mcp
|
|
6
|
+
Project-URL: Repository, https://github.com/timfurlong/msgraph-mcp
|
|
7
|
+
Project-URL: Issues, https://github.com/timfurlong/msgraph-mcp/issues
|
|
8
|
+
Author: Tim Furlong
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: calendar,email,mcp,microsoft-graph,model-context-protocol,outlook,teams
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Communications :: Email
|
|
20
|
+
Classifier: Topic :: Office/Business :: Scheduling
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Requires-Dist: mcp>=1.0
|
|
23
|
+
Requires-Dist: msal>=1.31
|
|
24
|
+
Requires-Dist: msgraph-sdk>=1.0
|
|
25
|
+
Requires-Dist: python-dotenv>=1.0
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# MSGraph MCP
|
|
29
|
+
|
|
30
|
+
<!-- mcp-name: io.github.timfurlong/msgraph-mcp -->
|
|
31
|
+
|
|
32
|
+
[](https://pypi.org/project/msgraph-mcp-server/)
|
|
33
|
+
[](https://pypi.org/project/msgraph-mcp-server/)
|
|
34
|
+
[](https://github.com/timfurlong/msgraph-mcp/actions/workflows/ci.yml)
|
|
35
|
+
[](https://github.com/timfurlong/msgraph-mcp/blob/main/LICENSE)
|
|
36
|
+
|
|
37
|
+
A Model Context Protocol (MCP) server for **Microsoft Graph**. It exposes Microsoft Outlook **mail** and **calendar**, plus read-only Microsoft **Teams** message history, to AI agents via the Microsoft Graph SDK. It acts as the signed-in user, using delegated permissions and MSAL device code flow, so it can only reach what that user can reach.
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
You need Python ≥ 3.11 and an Entra (Azure AD) app registration. The app registration takes about ten minutes and may need an administrator, so do that first: see the Entra setup section below.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
uv tool install msgraph-mcp-server # or: pip install msgraph-mcp-server
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The package is `msgraph-mcp-server`. It installs three commands: `msgraph-mcp` and its alias `msgraph-mcp-server`, which both start the stdio server, plus `msgraph-mcp-login` for the one-time sign-in.
|
|
48
|
+
|
|
49
|
+
## Setup
|
|
50
|
+
|
|
51
|
+
**1. Set your Entra app credentials.**
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
export MSGRAPH_MCP_CLIENT_ID=<your app's client ID>
|
|
55
|
+
export MSGRAPH_MCP_TENANT_ID=<your tenant ID> # or: common / organizations / consumers
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**2. Sign in once.** This prints a URL and a code; visit the URL and enter the code. No client secret is involved or stored.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
msgraph-mcp-login
|
|
62
|
+
# running via uvx instead of installing: uvx --from msgraph-mcp-server msgraph-mcp-login
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
A token cache is written to `~/.msgraph-mcp/token_cache.bin`.
|
|
66
|
+
|
|
67
|
+
**3. Wire the server into your MCP host.**
|
|
68
|
+
|
|
69
|
+
Claude Code:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
claude mcp add msgraph \
|
|
73
|
+
--env MSGRAPH_MCP_CLIENT_ID=$MSGRAPH_MCP_CLIENT_ID \
|
|
74
|
+
--env MSGRAPH_MCP_TENANT_ID=$MSGRAPH_MCP_TENANT_ID \
|
|
75
|
+
-- msgraph-mcp
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Any other host, over stdio:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"mcpServers": {
|
|
83
|
+
"msgraph": {
|
|
84
|
+
"command": "msgraph-mcp",
|
|
85
|
+
"args": [],
|
|
86
|
+
"env": {
|
|
87
|
+
"MSGRAPH_MCP_CLIENT_ID": "<your app's client ID>",
|
|
88
|
+
"MSGRAPH_MCP_TENANT_ID": "<your tenant ID>"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
To run without installing, use `"command": "uvx"` with `"args": ["msgraph-mcp-server"]`. Note that `uvx` does not put `msgraph-mcp-login` on your `PATH`, so sign in with the `uvx --from` form shown in step 2.
|
|
96
|
+
|
|
97
|
+
`MSGRAPH_MCP_TOKEN_CACHE_PATH` optionally overrides the cache location. All three variables can also come from a `.env` file in the working directory; the process environment wins over it.
|
|
98
|
+
|
|
99
|
+
## Entra setup
|
|
100
|
+
|
|
101
|
+
The app registration requires:
|
|
102
|
+
|
|
103
|
+
- **Account type:** single tenant (multi-tenant works too; set `MSGRAPH_MCP_TENANT_ID` to `common`, `organizations`, or `consumers`)
|
|
104
|
+
- **Redirect URI (public client):** `https://login.microsoftonline.com/common/oauth2/nativeclient`
|
|
105
|
+
- **Allow public client flows:** Yes, under Authentication → Advanced settings. Device code flow fails without it.
|
|
106
|
+
- **Delegated permissions** (Microsoft Graph):
|
|
107
|
+
- Mail: `Mail.ReadWrite`, `Mail.ReadWrite.Shared`, `Mail.Send`
|
|
108
|
+
- Rules: `MailboxSettings.ReadWrite` (Graph requires this for the `messageRules` endpoints)
|
|
109
|
+
- Calendar: `Calendars.ReadWrite`, `Calendars.ReadWrite.Shared`
|
|
110
|
+
- Identity: `User.Read`
|
|
111
|
+
- Teams: `Chat.Read`, `Team.ReadBasic.All`, `Channel.ReadBasic.All`, `ChannelMessage.Read.All`
|
|
112
|
+
|
|
113
|
+
`ChannelMessage.Read.All` always needs tenant admin consent, and the `*.Shared` permissions may need it depending on your tenant.
|
|
114
|
+
|
|
115
|
+
> **The scope list is all-or-nothing.** Sign-in requests every scope at once, so without admin consent for `ChannelMessage.Read.All` the login fails outright and mail and calendar are unavailable too. For the same reason, adding scopes later means re-running `msgraph-mcp-login`; until you do, *every* tool fails with `NotAuthenticatedError`, not just the ones needing the new scope.
|
|
116
|
+
|
|
117
|
+
## Tools
|
|
118
|
+
|
|
119
|
+
| Group | Tools |
|
|
120
|
+
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
121
|
+
| Util | `whoami` |
|
|
122
|
+
| Mail — read | `list_messages`, `search_messages`, `get_message`, `list_attachments`, `download_attachment` |
|
|
123
|
+
| Mail — write | `send_message`, `create_draft`, `reply_message`, `reply_all_message`, `forward_message`, `update_message`, `delete_message` |
|
|
124
|
+
| Mail — folders | `list_folders`, `create_folder`, `update_folder`, `delete_folder`, `move_message` |
|
|
125
|
+
| Mail — actions | `archive_message`, `mark_read`, `mark_unread`, `flag_message`, `unflag_message` |
|
|
126
|
+
| Mail — batch | `batch_archive_messages`, `batch_move_messages`, `batch_mark_read`, `batch_mark_unread`, `batch_flag_messages`, `batch_unflag_messages` |
|
|
127
|
+
| Mail — rules | `list_rules`, `get_rule`, `create_rule`, `update_rule`, `delete_rule` |
|
|
128
|
+
| Calendar | `list_calendars`, `list_events`, `get_event`, `create_event`, `update_event`, `delete_event`, `cancel_event`, `respond_to_event`, `find_meeting_times` |
|
|
129
|
+
| Teams (read) | `list_chats`, `list_chat_messages`, `list_joined_teams`, `list_channels`, `list_channel_messages`, `list_message_replies`, `download_hosted_content` |
|
|
130
|
+
|
|
131
|
+
Behavior shared across tools:
|
|
132
|
+
|
|
133
|
+
- **Trimmed responses.** Results are reshaped for agents, and message and event bodies are replaced by a short `snippet`. Pass `include_body=true` to `get_message`, `list_chat_messages`, `list_channel_messages`, or `list_message_replies` for the full body, which for Teams is also what surfaces Adaptive Card content. Pass `include_raw=true` to any tool returning a Graph object to get the full payload alongside the trimmed one; the `batch_*` tools return per-message status only and do not accept it.
|
|
134
|
+
- **Other mailboxes.** Every mail and calendar tool takes an optional `mailbox` (email or user ID) to target a shared or delegated mailbox. Omit it for your own. Teams tools are read-only, cover only your own chats, and take no `mailbox`.
|
|
135
|
+
- **Pagination.** List and search tools take `limit` (1-100, default 25) and `page_token`, except `list_channel_messages` and `list_message_replies`, which Graph caps at 50. `list_folders`, `list_rules`, `list_attachments`, and `list_calendars` return the whole collection and take neither. On `list_joined_teams` and `list_channels`, `limit` is applied after fetching because Graph rejects `$top` there, so it saves tokens rather than round-trips.
|
|
136
|
+
- **Batch actions.** The `batch_*` tools apply one action to up to 1000 messages via Graph's `$batch` endpoint, returning a per-message result plus a `{total, succeeded, failed}` summary.
|
|
137
|
+
- **Downloads.** `download_attachment` and `download_hosted_content` return images as native MCP image blocks the agent can view. Pass `save_path` (a file, or an existing directory) to write bytes to disk and get back a path instead.
|
|
138
|
+
- **Finding mail.** `list_messages` defaults to the inbox; pass `folder_id` for another folder, `unread_only=true`, or a raw OData `filter` for predicates KQL cannot express. `search_messages` passes your query to Graph's `$search` as KQL.
|
|
139
|
+
|
|
140
|
+
Outgoing attachments are capped at 3 MB total per message; chunked upload is not supported. SharePoint-backed Teams file attachments cannot be downloaded, only inline hosted content.
|
|
141
|
+
|
|
142
|
+
## Security
|
|
143
|
+
|
|
144
|
+
The token cache holds your **refresh token**, which can mint access tokens for your mail, calendar, and Teams data. Treat the file as a credential. It lives at `~/.msgraph-mcp/token_cache.bin` with mode `0600` inside a `0700` directory.
|
|
145
|
+
|
|
146
|
+
To revoke access, or to switch accounts, delete the cache and sign in again:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
rm -f ~/.msgraph-mcp/token_cache.bin ~/.outlook-mcp/token_cache.bin
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The second path matters if you ever ran this server under its former name `outlook-mcp`: that cache is still used as a fallback when the current one is absent, so deleting only the first file leaves a working refresh token on disk. To revoke fully, also remove the app at https://account.microsoft.com or in your organization's identity portal.
|
|
153
|
+
|
|
154
|
+
## Troubleshooting
|
|
155
|
+
|
|
156
|
+
- **`NotAuthenticatedError: Not authenticated`** — run `msgraph-mcp-login`. If it recurs immediately, a requested scope has not been consented yet; see the note under Entra setup.
|
|
157
|
+
- **`ConfigError: Missing required env var`** — set it in your shell, in a `.env` in the working directory, or in your MCP host's env config.
|
|
158
|
+
- **`Graph API 403: ErrorAccessDenied`** — the Entra app is missing a delegated permission, or it needs admin consent. Check the list above, then re-consent and sign in again.
|
|
159
|
+
- **`Graph API 400: BadRequest — Syntax error`** from `search_messages` — the query goes to Graph's `$search` as KQL. Quote literal phrases (`"weekly report"`) or use fielded forms (`from:alice`). For predicates KQL cannot express, use `list_messages` with `filter=`.
|
|
160
|
+
- **The host starts the server but lists no tools** — confirm it launches `msgraph-mcp` (or `uvx`) over stdio and can find that binary on its `PATH`.
|
|
161
|
+
|
|
162
|
+
## Development
|
|
163
|
+
|
|
164
|
+
See [CONTRIBUTING.md](https://github.com/timfurlong/msgraph-mcp/blob/main/CONTRIBUTING.md).
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# MSGraph MCP
|
|
2
|
+
|
|
3
|
+
<!-- mcp-name: io.github.timfurlong/msgraph-mcp -->
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/msgraph-mcp-server/)
|
|
6
|
+
[](https://pypi.org/project/msgraph-mcp-server/)
|
|
7
|
+
[](https://github.com/timfurlong/msgraph-mcp/actions/workflows/ci.yml)
|
|
8
|
+
[](https://github.com/timfurlong/msgraph-mcp/blob/main/LICENSE)
|
|
9
|
+
|
|
10
|
+
A Model Context Protocol (MCP) server for **Microsoft Graph**. It exposes Microsoft Outlook **mail** and **calendar**, plus read-only Microsoft **Teams** message history, to AI agents via the Microsoft Graph SDK. It acts as the signed-in user, using delegated permissions and MSAL device code flow, so it can only reach what that user can reach.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
You need Python ≥ 3.11 and an Entra (Azure AD) app registration. The app registration takes about ten minutes and may need an administrator, so do that first: see the Entra setup section below.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
uv tool install msgraph-mcp-server # or: pip install msgraph-mcp-server
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The package is `msgraph-mcp-server`. It installs three commands: `msgraph-mcp` and its alias `msgraph-mcp-server`, which both start the stdio server, plus `msgraph-mcp-login` for the one-time sign-in.
|
|
21
|
+
|
|
22
|
+
## Setup
|
|
23
|
+
|
|
24
|
+
**1. Set your Entra app credentials.**
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
export MSGRAPH_MCP_CLIENT_ID=<your app's client ID>
|
|
28
|
+
export MSGRAPH_MCP_TENANT_ID=<your tenant ID> # or: common / organizations / consumers
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**2. Sign in once.** This prints a URL and a code; visit the URL and enter the code. No client secret is involved or stored.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
msgraph-mcp-login
|
|
35
|
+
# running via uvx instead of installing: uvx --from msgraph-mcp-server msgraph-mcp-login
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
A token cache is written to `~/.msgraph-mcp/token_cache.bin`.
|
|
39
|
+
|
|
40
|
+
**3. Wire the server into your MCP host.**
|
|
41
|
+
|
|
42
|
+
Claude Code:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
claude mcp add msgraph \
|
|
46
|
+
--env MSGRAPH_MCP_CLIENT_ID=$MSGRAPH_MCP_CLIENT_ID \
|
|
47
|
+
--env MSGRAPH_MCP_TENANT_ID=$MSGRAPH_MCP_TENANT_ID \
|
|
48
|
+
-- msgraph-mcp
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Any other host, over stdio:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"msgraph": {
|
|
57
|
+
"command": "msgraph-mcp",
|
|
58
|
+
"args": [],
|
|
59
|
+
"env": {
|
|
60
|
+
"MSGRAPH_MCP_CLIENT_ID": "<your app's client ID>",
|
|
61
|
+
"MSGRAPH_MCP_TENANT_ID": "<your tenant ID>"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
To run without installing, use `"command": "uvx"` with `"args": ["msgraph-mcp-server"]`. Note that `uvx` does not put `msgraph-mcp-login` on your `PATH`, so sign in with the `uvx --from` form shown in step 2.
|
|
69
|
+
|
|
70
|
+
`MSGRAPH_MCP_TOKEN_CACHE_PATH` optionally overrides the cache location. All three variables can also come from a `.env` file in the working directory; the process environment wins over it.
|
|
71
|
+
|
|
72
|
+
## Entra setup
|
|
73
|
+
|
|
74
|
+
The app registration requires:
|
|
75
|
+
|
|
76
|
+
- **Account type:** single tenant (multi-tenant works too; set `MSGRAPH_MCP_TENANT_ID` to `common`, `organizations`, or `consumers`)
|
|
77
|
+
- **Redirect URI (public client):** `https://login.microsoftonline.com/common/oauth2/nativeclient`
|
|
78
|
+
- **Allow public client flows:** Yes, under Authentication → Advanced settings. Device code flow fails without it.
|
|
79
|
+
- **Delegated permissions** (Microsoft Graph):
|
|
80
|
+
- Mail: `Mail.ReadWrite`, `Mail.ReadWrite.Shared`, `Mail.Send`
|
|
81
|
+
- Rules: `MailboxSettings.ReadWrite` (Graph requires this for the `messageRules` endpoints)
|
|
82
|
+
- Calendar: `Calendars.ReadWrite`, `Calendars.ReadWrite.Shared`
|
|
83
|
+
- Identity: `User.Read`
|
|
84
|
+
- Teams: `Chat.Read`, `Team.ReadBasic.All`, `Channel.ReadBasic.All`, `ChannelMessage.Read.All`
|
|
85
|
+
|
|
86
|
+
`ChannelMessage.Read.All` always needs tenant admin consent, and the `*.Shared` permissions may need it depending on your tenant.
|
|
87
|
+
|
|
88
|
+
> **The scope list is all-or-nothing.** Sign-in requests every scope at once, so without admin consent for `ChannelMessage.Read.All` the login fails outright and mail and calendar are unavailable too. For the same reason, adding scopes later means re-running `msgraph-mcp-login`; until you do, *every* tool fails with `NotAuthenticatedError`, not just the ones needing the new scope.
|
|
89
|
+
|
|
90
|
+
## Tools
|
|
91
|
+
|
|
92
|
+
| Group | Tools |
|
|
93
|
+
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
94
|
+
| Util | `whoami` |
|
|
95
|
+
| Mail — read | `list_messages`, `search_messages`, `get_message`, `list_attachments`, `download_attachment` |
|
|
96
|
+
| Mail — write | `send_message`, `create_draft`, `reply_message`, `reply_all_message`, `forward_message`, `update_message`, `delete_message` |
|
|
97
|
+
| Mail — folders | `list_folders`, `create_folder`, `update_folder`, `delete_folder`, `move_message` |
|
|
98
|
+
| Mail — actions | `archive_message`, `mark_read`, `mark_unread`, `flag_message`, `unflag_message` |
|
|
99
|
+
| Mail — batch | `batch_archive_messages`, `batch_move_messages`, `batch_mark_read`, `batch_mark_unread`, `batch_flag_messages`, `batch_unflag_messages` |
|
|
100
|
+
| Mail — rules | `list_rules`, `get_rule`, `create_rule`, `update_rule`, `delete_rule` |
|
|
101
|
+
| Calendar | `list_calendars`, `list_events`, `get_event`, `create_event`, `update_event`, `delete_event`, `cancel_event`, `respond_to_event`, `find_meeting_times` |
|
|
102
|
+
| Teams (read) | `list_chats`, `list_chat_messages`, `list_joined_teams`, `list_channels`, `list_channel_messages`, `list_message_replies`, `download_hosted_content` |
|
|
103
|
+
|
|
104
|
+
Behavior shared across tools:
|
|
105
|
+
|
|
106
|
+
- **Trimmed responses.** Results are reshaped for agents, and message and event bodies are replaced by a short `snippet`. Pass `include_body=true` to `get_message`, `list_chat_messages`, `list_channel_messages`, or `list_message_replies` for the full body, which for Teams is also what surfaces Adaptive Card content. Pass `include_raw=true` to any tool returning a Graph object to get the full payload alongside the trimmed one; the `batch_*` tools return per-message status only and do not accept it.
|
|
107
|
+
- **Other mailboxes.** Every mail and calendar tool takes an optional `mailbox` (email or user ID) to target a shared or delegated mailbox. Omit it for your own. Teams tools are read-only, cover only your own chats, and take no `mailbox`.
|
|
108
|
+
- **Pagination.** List and search tools take `limit` (1-100, default 25) and `page_token`, except `list_channel_messages` and `list_message_replies`, which Graph caps at 50. `list_folders`, `list_rules`, `list_attachments`, and `list_calendars` return the whole collection and take neither. On `list_joined_teams` and `list_channels`, `limit` is applied after fetching because Graph rejects `$top` there, so it saves tokens rather than round-trips.
|
|
109
|
+
- **Batch actions.** The `batch_*` tools apply one action to up to 1000 messages via Graph's `$batch` endpoint, returning a per-message result plus a `{total, succeeded, failed}` summary.
|
|
110
|
+
- **Downloads.** `download_attachment` and `download_hosted_content` return images as native MCP image blocks the agent can view. Pass `save_path` (a file, or an existing directory) to write bytes to disk and get back a path instead.
|
|
111
|
+
- **Finding mail.** `list_messages` defaults to the inbox; pass `folder_id` for another folder, `unread_only=true`, or a raw OData `filter` for predicates KQL cannot express. `search_messages` passes your query to Graph's `$search` as KQL.
|
|
112
|
+
|
|
113
|
+
Outgoing attachments are capped at 3 MB total per message; chunked upload is not supported. SharePoint-backed Teams file attachments cannot be downloaded, only inline hosted content.
|
|
114
|
+
|
|
115
|
+
## Security
|
|
116
|
+
|
|
117
|
+
The token cache holds your **refresh token**, which can mint access tokens for your mail, calendar, and Teams data. Treat the file as a credential. It lives at `~/.msgraph-mcp/token_cache.bin` with mode `0600` inside a `0700` directory.
|
|
118
|
+
|
|
119
|
+
To revoke access, or to switch accounts, delete the cache and sign in again:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
rm -f ~/.msgraph-mcp/token_cache.bin ~/.outlook-mcp/token_cache.bin
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The second path matters if you ever ran this server under its former name `outlook-mcp`: that cache is still used as a fallback when the current one is absent, so deleting only the first file leaves a working refresh token on disk. To revoke fully, also remove the app at https://account.microsoft.com or in your organization's identity portal.
|
|
126
|
+
|
|
127
|
+
## Troubleshooting
|
|
128
|
+
|
|
129
|
+
- **`NotAuthenticatedError: Not authenticated`** — run `msgraph-mcp-login`. If it recurs immediately, a requested scope has not been consented yet; see the note under Entra setup.
|
|
130
|
+
- **`ConfigError: Missing required env var`** — set it in your shell, in a `.env` in the working directory, or in your MCP host's env config.
|
|
131
|
+
- **`Graph API 403: ErrorAccessDenied`** — the Entra app is missing a delegated permission, or it needs admin consent. Check the list above, then re-consent and sign in again.
|
|
132
|
+
- **`Graph API 400: BadRequest — Syntax error`** from `search_messages` — the query goes to Graph's `$search` as KQL. Quote literal phrases (`"weekly report"`) or use fielded forms (`from:alice`). For predicates KQL cannot express, use `list_messages` with `filter=`.
|
|
133
|
+
- **The host starts the server but lists no tools** — confirm it launches `msgraph-mcp` (or `uvx`) over stdio and can find that binary on its `PATH`.
|
|
134
|
+
|
|
135
|
+
## Development
|
|
136
|
+
|
|
137
|
+
See [CONTRIBUTING.md](https://github.com/timfurlong/msgraph-mcp/blob/main/CONTRIBUTING.md).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "msgraph-mcp-server"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.2"
|
|
4
4
|
description = "MCP server for Microsoft Graph: Outlook mail and calendar, plus read-only Microsoft Teams"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -33,6 +33,8 @@ Issues = "https://github.com/timfurlong/msgraph-mcp/issues"
|
|
|
33
33
|
|
|
34
34
|
[project.scripts]
|
|
35
35
|
msgraph-mcp = "msgraph_mcp.server:main"
|
|
36
|
+
# Alias matching the PyPI distribution name, so `uvx msgraph-mcp-server` works.
|
|
37
|
+
msgraph-mcp-server = "msgraph_mcp.server:main"
|
|
36
38
|
msgraph-mcp-login = "msgraph_mcp.auth.cli:main"
|
|
37
39
|
|
|
38
40
|
[build-system]
|
|
@@ -50,6 +52,11 @@ dev = [
|
|
|
50
52
|
"ruff>=0.6",
|
|
51
53
|
]
|
|
52
54
|
|
|
55
|
+
[tool.ruff]
|
|
56
|
+
# Pinned rather than left implicit so a ruff release changing the default
|
|
57
|
+
# cannot reformat the tree out from under CI.
|
|
58
|
+
line-length = 88
|
|
59
|
+
|
|
53
60
|
[tool.pytest.ini_options]
|
|
54
61
|
asyncio_mode = "auto"
|
|
55
62
|
testpaths = ["tests"]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.timfurlong/msgraph-mcp",
|
|
4
|
+
"title": "MSGraph MCP",
|
|
5
|
+
"description": "MCP server for Microsoft Graph: Outlook mail and calendar, plus read-only Microsoft Teams",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/timfurlong/msgraph-mcp",
|
|
8
|
+
"source": "github"
|
|
9
|
+
},
|
|
10
|
+
"version": "0.3.2",
|
|
11
|
+
"packages": [
|
|
12
|
+
{
|
|
13
|
+
"registryType": "pypi",
|
|
14
|
+
"identifier": "msgraph-mcp-server",
|
|
15
|
+
"version": "0.3.2",
|
|
16
|
+
"runtimeHint": "uvx",
|
|
17
|
+
"transport": {
|
|
18
|
+
"type": "stdio"
|
|
19
|
+
},
|
|
20
|
+
"environmentVariables": [
|
|
21
|
+
{
|
|
22
|
+
"name": "MSGRAPH_MCP_CLIENT_ID",
|
|
23
|
+
"description": "Client ID of your Entra (Azure AD) app registration",
|
|
24
|
+
"isRequired": true,
|
|
25
|
+
"isSecret": false
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "MSGRAPH_MCP_TENANT_ID",
|
|
29
|
+
"description": "Entra tenant ID (or 'common' / 'organizations' / 'consumers')",
|
|
30
|
+
"isRequired": true,
|
|
31
|
+
"isSecret": false
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "MSGRAPH_MCP_TOKEN_CACHE_PATH",
|
|
35
|
+
"description": "Override the token cache location (default ~/.msgraph-mcp/token_cache.bin)",
|
|
36
|
+
"isRequired": false,
|
|
37
|
+
"isSecret": false
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -33,8 +33,7 @@ def run_login() -> int:
|
|
|
33
33
|
persist_cache(cache)
|
|
34
34
|
|
|
35
35
|
username = (
|
|
36
|
-
result.get("id_token_claims", {}).get("preferred_username")
|
|
37
|
-
or "<unknown>"
|
|
36
|
+
result.get("id_token_claims", {}).get("preferred_username") or "<unknown>"
|
|
38
37
|
)
|
|
39
38
|
print(f"Logged in as {username}", flush=True)
|
|
40
39
|
print(f"Token cache saved to {config.token_cache_path()}", flush=True)
|
|
@@ -14,9 +14,7 @@ class NotAuthenticatedError(RuntimeError):
|
|
|
14
14
|
"""Raised when no valid token is available and silent refresh failed."""
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
_LOGIN_HINT =
|
|
18
|
-
"Not authenticated. Run `msgraph-mcp-login` in a terminal to sign in."
|
|
19
|
-
)
|
|
17
|
+
_LOGIN_HINT = "Not authenticated. Run `msgraph-mcp-login` in a terminal to sign in."
|
|
20
18
|
|
|
21
19
|
|
|
22
20
|
def get_access_token() -> str:
|