purview-mcp-server 1.13.1__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.
@@ -0,0 +1,159 @@
1
+ Metadata-Version: 2.4
2
+ Name: purview-mcp-server
3
+ Version: 1.13.1
4
+ Summary: Model Context Protocol server for Microsoft Purview
5
+ License-Expression: Apache-2.0
6
+ Classifier: Development Status :: 4 - Beta
7
+ Classifier: Environment :: Console
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Intended Audience :: System Administrators
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Topic :: System :: Systems Administration
21
+ Classifier: Topic :: Internet :: WWW/HTTP
22
+ Classifier: Topic :: Database
23
+ Classifier: Topic :: Utilities
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+ Requires-Dist: pvw-cli>=1.13.1
27
+ Requires-Dist: fastmcp>=2.0.0
28
+ Requires-Dist: pydantic<3.0.0,>=2.5.0
29
+ Requires-Dist: aiohttp>=3.8.0
30
+ Requires-Dist: azure-identity>=1.12.0
31
+ Requires-Dist: pandas>=1.5.0
32
+
33
+ # Purview MCP Server
34
+
35
+ FastMCP-based server that exposes Microsoft Purview data governance operations through the [Model Context Protocol](https://modelcontextprotocol.io/).
36
+
37
+ > **Full documentation:** [`docs/purview-mcp-server.md`](../../docs/purview-mcp-server.md)
38
+
39
+ ---
40
+
41
+ ## Quick Start
42
+
43
+ ```powershell
44
+ # stdio (default) — from repo root, venv active
45
+ $env:PURVIEW_ACCOUNT_NAME = "your-account"
46
+ python tools/PurviewMCPServer/server.py
47
+ ```
48
+
49
+ ```powershell
50
+ # Streamable-HTTP
51
+ $env:PURVIEW_MCP_TRANSPORT = "streamable-http"
52
+ $env:PURVIEW_MCP_PORT = "8000"
53
+ python tools/PurviewMCPServer/server.py
54
+ # endpoint: http://127.0.0.1:8000/mcp
55
+ ```
56
+
57
+ ```powershell
58
+ # Azure Functions (func host)
59
+ cd tools/hosting/app && func start --port 7073
60
+ # endpoint: http://localhost:7073/api/mcp
61
+ ```
62
+
63
+ ---
64
+
65
+ ## Transport Protocols
66
+
67
+ | Transport | Env value | VS Code mcp.json type | Endpoint |
68
+ |---|---|---|---|
69
+ | stdio (default) | `stdio` | `"command"` | process stdin/stdout |
70
+ | Streamable-HTTP | `streamable-http` or `http` | `"http"` | `/mcp` (standalone) or `/api/mcp` (Azure Functions) |
71
+ | SSE (legacy) | `sse` | `"sse"` | `/sse` (standalone only — not compatible with Azure Functions) |
72
+
73
+ ---
74
+
75
+ ## VS Code mcp.json
76
+
77
+ ```json
78
+ {
79
+ "servers": {
80
+ "purview-mcp-server-stdio": {
81
+ "command": "./.venv/Scripts/python",
82
+ "args": ["tools/PurviewMCPServer/server.py"],
83
+ "env": { "PURVIEW_ACCOUNT_NAME": "your-account" }
84
+ },
85
+ "purview-mcp-server-http": {
86
+ "type": "http",
87
+ "url": "http://localhost:7073/api/mcp"
88
+ }
89
+ }
90
+ }
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Environment Variables
96
+
97
+ | Variable | Required | Default | Description |
98
+ |---|---|---|---|
99
+ | `PURVIEW_ACCOUNT_NAME` | Yes | — | Purview account name (no suffix) |
100
+ | `AZURE_TENANT_ID` | No | — | Azure tenant GUID |
101
+ | `AZURE_CLIENT_ID` | No | — | Service principal client ID |
102
+ | `AZURE_CLIENT_SECRET` | No | — | Service principal secret |
103
+ | `AZURE_REGION` | No | public | Sovereign cloud: `usgov`, `china` |
104
+ | `PURVIEW_MAX_RETRIES` | No | `3` | API retry count |
105
+ | `PURVIEW_TIMEOUT` | No | `30` | Request timeout (seconds) |
106
+ | `PURVIEW_BATCH_SIZE` | No | `100` | Bulk operation batch size |
107
+ | `PURVIEW_MCP_TRANSPORT` | No | `stdio` | Transport protocol |
108
+ | `PURVIEW_MCP_HOST` | No | `127.0.0.1` | Bind host (HTTP/SSE modes) |
109
+ | `PURVIEW_MCP_PORT` | No | `8000` | Bind port (HTTP/SSE modes) |
110
+
111
+ Copy `.env.example` to `.env` and fill in your values. Never commit `.env`.
112
+
113
+ ---
114
+
115
+ ## Available Tools (37 + registry)
116
+
117
+ | Category | Tools |
118
+ |---|---|
119
+ | Entity (8) | `get_entity`, `create_entity`, `update_entity`, `delete_entity`, `search_entities`, `batch_create_entities`, `batch_update_entities`, `import_entities_from_csv` |
120
+ | Glossary (3) | `get_glossary_terms`, `create_glossary_term`, `assign_term_to_entities` |
121
+ | Unified Catalog (11) | `uc_list_domains`, `uc_get_domain`, `uc_create_domain`, `uc_list_terms`, `uc_get_term`, `uc_create_term`, `uc_search_terms`, `uc_list_custom_metadata_defs`, `uc_cleanup_metadata_definition`, `uc_delete_metadata_definition`, `uc_delete_metadata_from_asset` |
122
+ | Collections (5) | `list_collections`, `get_collection`, `create_collection`, `delete_collection`, `get_collection_path` |
123
+ | Lineage (2) | `get_lineage`, `create_lineage` |
124
+ | Search (2) | `search_suggest`, `search_browse` |
125
+ | Type Defs (2) | `get_typedef`, `list_typedefs` |
126
+ | Relationships (3) | `create_relationship`, `get_relationship`, `delete_relationship` |
127
+ | Account + Registry (3) | `get_account_properties`, `list_available_operations`, `invoke_operation` |
128
+
129
+ ---
130
+
131
+ ## Recommended First Commands
132
+
133
+ ```
134
+ 1) list_available_operations()
135
+ 2) get_account_properties()
136
+ 3) search_entities(query="customer", limit=5)
137
+ 4) uc_list_domains()
138
+ ```
139
+
140
+ ---
141
+
142
+ ## Files
143
+
144
+ | File | Purpose |
145
+ |---|---|
146
+ | `server.py` | FastMCP server — all 37 tool definitions |
147
+ | `config.py` | `PurviewMCPConfig` frozen dataclass — env var parsing and validation |
148
+ | `__version__.py` | Package version |
149
+ | `.env.example` | Environment variable template |
150
+ | `PROMPT_INSTRUCTIONS.md` | Detailed prompt guidance for AI assistants |
151
+ | `pyproject.toml` | Package metadata (`purview-mcp-server`) |
152
+ | `Dockerfile` | Container image for standalone deployment |
153
+ | `docker-compose.yml` | Local container stack |
154
+
155
+ For Azure Functions hosting files, see `tools/hosting/`.
156
+
157
+ ---
158
+
159
+ See [`docs/purview-mcp-server.md`](../../docs/purview-mcp-server.md) for the full reference including client setup for Claude Code and Cursor, Azure Functions deployment, all prompt examples, workflows, and troubleshooting.
@@ -0,0 +1,127 @@
1
+ # Purview MCP Server
2
+
3
+ FastMCP-based server that exposes Microsoft Purview data governance operations through the [Model Context Protocol](https://modelcontextprotocol.io/).
4
+
5
+ > **Full documentation:** [`docs/purview-mcp-server.md`](../../docs/purview-mcp-server.md)
6
+
7
+ ---
8
+
9
+ ## Quick Start
10
+
11
+ ```powershell
12
+ # stdio (default) — from repo root, venv active
13
+ $env:PURVIEW_ACCOUNT_NAME = "your-account"
14
+ python tools/PurviewMCPServer/server.py
15
+ ```
16
+
17
+ ```powershell
18
+ # Streamable-HTTP
19
+ $env:PURVIEW_MCP_TRANSPORT = "streamable-http"
20
+ $env:PURVIEW_MCP_PORT = "8000"
21
+ python tools/PurviewMCPServer/server.py
22
+ # endpoint: http://127.0.0.1:8000/mcp
23
+ ```
24
+
25
+ ```powershell
26
+ # Azure Functions (func host)
27
+ cd tools/hosting/app && func start --port 7073
28
+ # endpoint: http://localhost:7073/api/mcp
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Transport Protocols
34
+
35
+ | Transport | Env value | VS Code mcp.json type | Endpoint |
36
+ |---|---|---|---|
37
+ | stdio (default) | `stdio` | `"command"` | process stdin/stdout |
38
+ | Streamable-HTTP | `streamable-http` or `http` | `"http"` | `/mcp` (standalone) or `/api/mcp` (Azure Functions) |
39
+ | SSE (legacy) | `sse` | `"sse"` | `/sse` (standalone only — not compatible with Azure Functions) |
40
+
41
+ ---
42
+
43
+ ## VS Code mcp.json
44
+
45
+ ```json
46
+ {
47
+ "servers": {
48
+ "purview-mcp-server-stdio": {
49
+ "command": "./.venv/Scripts/python",
50
+ "args": ["tools/PurviewMCPServer/server.py"],
51
+ "env": { "PURVIEW_ACCOUNT_NAME": "your-account" }
52
+ },
53
+ "purview-mcp-server-http": {
54
+ "type": "http",
55
+ "url": "http://localhost:7073/api/mcp"
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Environment Variables
64
+
65
+ | Variable | Required | Default | Description |
66
+ |---|---|---|---|
67
+ | `PURVIEW_ACCOUNT_NAME` | Yes | — | Purview account name (no suffix) |
68
+ | `AZURE_TENANT_ID` | No | — | Azure tenant GUID |
69
+ | `AZURE_CLIENT_ID` | No | — | Service principal client ID |
70
+ | `AZURE_CLIENT_SECRET` | No | — | Service principal secret |
71
+ | `AZURE_REGION` | No | public | Sovereign cloud: `usgov`, `china` |
72
+ | `PURVIEW_MAX_RETRIES` | No | `3` | API retry count |
73
+ | `PURVIEW_TIMEOUT` | No | `30` | Request timeout (seconds) |
74
+ | `PURVIEW_BATCH_SIZE` | No | `100` | Bulk operation batch size |
75
+ | `PURVIEW_MCP_TRANSPORT` | No | `stdio` | Transport protocol |
76
+ | `PURVIEW_MCP_HOST` | No | `127.0.0.1` | Bind host (HTTP/SSE modes) |
77
+ | `PURVIEW_MCP_PORT` | No | `8000` | Bind port (HTTP/SSE modes) |
78
+
79
+ Copy `.env.example` to `.env` and fill in your values. Never commit `.env`.
80
+
81
+ ---
82
+
83
+ ## Available Tools (37 + registry)
84
+
85
+ | Category | Tools |
86
+ |---|---|
87
+ | Entity (8) | `get_entity`, `create_entity`, `update_entity`, `delete_entity`, `search_entities`, `batch_create_entities`, `batch_update_entities`, `import_entities_from_csv` |
88
+ | Glossary (3) | `get_glossary_terms`, `create_glossary_term`, `assign_term_to_entities` |
89
+ | Unified Catalog (11) | `uc_list_domains`, `uc_get_domain`, `uc_create_domain`, `uc_list_terms`, `uc_get_term`, `uc_create_term`, `uc_search_terms`, `uc_list_custom_metadata_defs`, `uc_cleanup_metadata_definition`, `uc_delete_metadata_definition`, `uc_delete_metadata_from_asset` |
90
+ | Collections (5) | `list_collections`, `get_collection`, `create_collection`, `delete_collection`, `get_collection_path` |
91
+ | Lineage (2) | `get_lineage`, `create_lineage` |
92
+ | Search (2) | `search_suggest`, `search_browse` |
93
+ | Type Defs (2) | `get_typedef`, `list_typedefs` |
94
+ | Relationships (3) | `create_relationship`, `get_relationship`, `delete_relationship` |
95
+ | Account + Registry (3) | `get_account_properties`, `list_available_operations`, `invoke_operation` |
96
+
97
+ ---
98
+
99
+ ## Recommended First Commands
100
+
101
+ ```
102
+ 1) list_available_operations()
103
+ 2) get_account_properties()
104
+ 3) search_entities(query="customer", limit=5)
105
+ 4) uc_list_domains()
106
+ ```
107
+
108
+ ---
109
+
110
+ ## Files
111
+
112
+ | File | Purpose |
113
+ |---|---|
114
+ | `server.py` | FastMCP server — all 37 tool definitions |
115
+ | `config.py` | `PurviewMCPConfig` frozen dataclass — env var parsing and validation |
116
+ | `__version__.py` | Package version |
117
+ | `.env.example` | Environment variable template |
118
+ | `PROMPT_INSTRUCTIONS.md` | Detailed prompt guidance for AI assistants |
119
+ | `pyproject.toml` | Package metadata (`purview-mcp-server`) |
120
+ | `Dockerfile` | Container image for standalone deployment |
121
+ | `docker-compose.yml` | Local container stack |
122
+
123
+ For Azure Functions hosting files, see `tools/hosting/`.
124
+
125
+ ---
126
+
127
+ See [`docs/purview-mcp-server.md`](../../docs/purview-mcp-server.md) for the full reference including client setup for Claude Code and Cursor, Azure Functions deployment, all prompt examples, workflows, and troubleshooting.
@@ -0,0 +1,11 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+
3
+ """
4
+ Microsoft Purview MCP Server
5
+
6
+ Enables LLM-powered data governance workflows
7
+ """
8
+
9
+ from .__version__ import __version__, __author__, __description__
10
+
11
+ __all__ = ["__version__", "__author__", "__description__"]
@@ -0,0 +1,9 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+
3
+ """Version information for Purview MCP Server."""
4
+
5
+ __version__ = "1.13.1"
6
+ __author__ = "Ayoub KEBAILI"
7
+ __description__ = (
8
+ "A Model Context Protocol server for Microsoft Purview enabling LLM-powered data governance workflows."
9
+ )
@@ -0,0 +1,61 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ from __future__ import annotations
3
+
4
+ import os
5
+ from dataclasses import dataclass
6
+ from typing import Literal
7
+
8
+ Transport = Literal["stdio", "sse", "streamable-http"]
9
+
10
+
11
+ def _as_int(value: str | None, default: int, name: str) -> int:
12
+ if value is None:
13
+ return default
14
+ try:
15
+ return int(value.strip())
16
+ except ValueError as exc:
17
+ raise ValueError(f"{name} must be an integer, got: {value!r}") from exc
18
+
19
+
20
+ @dataclass(frozen=True)
21
+ class PurviewMCPConfig:
22
+ # --- Purview client settings ---
23
+ account_name: str
24
+ tenant_id: str | None
25
+ azure_region: str | None
26
+ max_retries: int
27
+ timeout: int
28
+ batch_size: int
29
+
30
+ # --- MCP server / transport settings ---
31
+ transport: Transport
32
+ host: str
33
+ port: int
34
+
35
+ @classmethod
36
+ def from_env(cls) -> "PurviewMCPConfig":
37
+ account_name = os.getenv("PURVIEW_ACCOUNT_NAME", "").strip()
38
+ if not account_name:
39
+ raise ValueError("PURVIEW_ACCOUNT_NAME is required.")
40
+
41
+ transport_raw = os.getenv("PURVIEW_MCP_TRANSPORT", "stdio").strip().lower()
42
+ # Accept "http" as an alias for "streamable-http"
43
+ if transport_raw == "http":
44
+ transport_raw = "streamable-http"
45
+ if transport_raw not in {"stdio", "sse", "streamable-http"}:
46
+ raise ValueError(
47
+ "PURVIEW_MCP_TRANSPORT must be one of: stdio, sse, streamable-http, http"
48
+ )
49
+ typed_transport: Transport = transport_raw # type: ignore[assignment]
50
+
51
+ return cls(
52
+ account_name=account_name,
53
+ tenant_id=os.getenv("AZURE_TENANT_ID") or None,
54
+ azure_region=os.getenv("AZURE_REGION") or None,
55
+ max_retries=_as_int(os.getenv("PURVIEW_MAX_RETRIES"), 3, "PURVIEW_MAX_RETRIES"),
56
+ timeout=_as_int(os.getenv("PURVIEW_TIMEOUT"), 30, "PURVIEW_TIMEOUT"),
57
+ batch_size=_as_int(os.getenv("PURVIEW_BATCH_SIZE"), 100, "PURVIEW_BATCH_SIZE"),
58
+ transport=typed_transport,
59
+ host=os.getenv("PURVIEW_MCP_HOST", "127.0.0.1").strip(),
60
+ port=_as_int(os.getenv("PURVIEW_MCP_PORT"), 8000, "PURVIEW_MCP_PORT"),
61
+ )