odatav4-mcp

odatav4-mcp

An MCP server for OData v4 endpoints, especially Microsoft Dataverse/Dynamics 365, enabling authentication, schema discovery, querying, CRUD, and more via natural language.

Category
访问服务器

README

odatav4-mcp

An MCP (Model Context Protocol) server for OData v4 endpoints, tuned for Microsoft Dataverse / Dynamics 365 but usable with any OData v4 service.

  • Zero-registration auth: signs in with Entra ID using the well-known Microsoft public client (51f81489-12ee-4a9e-aac9-25749fb2a1de, the same app XrmToolBox and the Dataverse samples use). The default flow opens your browser with a localhost redirect (works where Conditional Access blocks device-code flow); device-code flow is available for headless/SSH sessions. MFA works; tokens are cached on disk so you sign in once, not per session.
  • One config value: just the endpoint URL.
  • Full OData surface: metadata discovery, queries ($filter/$select/$expand/ $apply/$count), paging, CRUD, associations, functions/actions, and a raw request escape hatch.

Install

git clone <this-repo> odatav4-mcp
cd odatav4-mcp
npm install        # also compiles TypeScript (prepare script)

Optional but recommended — sign in once from a terminal so the MCP client never has to relay sign-in instructions:

ODATA_URL=https://yourorg.crm.dynamics.com npm run login
# headless / SSH (no local browser):
ODATA_URL=https://yourorg.crm.dynamics.com npm run login -- --devicecode

Configuration

Env var Required Description
ODATA_URL yes Service root. A bare Dataverse org URL (https://yourorg.crm.dynamics.com) is expanded to /api/data/v9.2/ automatically.
ODATA_TENANT no Tenant id or domain (default organizations). Set this if your account exists in multiple tenants.
ODATA_CLIENT_ID no Override the Entra app id (default: the well-known Dataverse dev-tools client).
ODATA_LOGIN_FLOW no interactive (default: opens a browser, localhost redirect) or devicecode (enter a code at microsoft.com/devicelogin — for headless/SSH, or if your tenant blocks the browser flow).
ODATA_AUTH no Set to none for anonymous OData services (e.g. public test services).
ODATA_CACHE_DIR no Where tokens and $metadata are cached (default ~/.config/odatav4-mcp/<host>).

Hook up to your client

Use the absolute path to dist/index.js in all cases.

GitHub Copilot (VS Code)

Create .vscode/mcp.json in your workspace (or add via MCP: Add Server):

{
  "servers": {
    "dataverse": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/odatav4-mcp/dist/index.js"],
      "env": { "ODATA_URL": "https://yourorg.crm.dynamics.com" }
    }
  }
}

Claude Code

claude mcp add dataverse --env ODATA_URL=https://yourorg.crm.dynamics.com -- node /path/to/odatav4-mcp/dist/index.js

Codex CLI

In ~/.codex/config.toml:

[mcp_servers.dataverse]
command = "node"
args = ["/path/to/odatav4-mcp/dist/index.js"]
env = { ODATA_URL = "https://yourorg.crm.dynamics.com" }

Tools

Tool Purpose
login, auth_status, logout Device-code sign-in and token management
service_info, whoami Connection status; Dataverse WhoAmI
list_entity_sets, describe_entity, list_operations Schema discovery from $metadata (cached 6h)
query, next_page, get_record Reads with full OData query options and paging
create_record, update_record, delete_record CRUD (update sends If-Match: * to prevent accidental upserts)
associate_records, disassociate_records N:N / collection navigation $ref operations
call_function, call_action OData functions (GET) and actions (POST), bound or unbound — covers Dataverse messages and custom APIs
raw_request Any other request, restricted to the configured host

Notes

  • Auth flow: silent token refresh from the on-disk MSAL cache first; if that fails, tools return an instruction to run the login tool. By default that opens your system browser (on WSL it launches the Windows browser via wslview or rundll32.exe) and completes through a localhost redirect; MSAL runs the loopback listener automatically. The login tool accepts {"flow": "devicecode"} to switch flows per call. Both flows are attempted against the same well-known client id, which has http://localhost registered as a redirect URI.
  • The token cache (msal-cache.json) contains refresh tokens; it is written with mode 600 into your home config directory. Delete it (or use logout) to revoke local access.
  • Dataverse $metadata is large (10 MB+); it is cached on disk for 6 hours. Pass refresh: true to list_entity_sets to force a re-download.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选