Introducing a new way to review your PRs.

Read the announcement

open-metadata / openmetadata

The Open Context Layer for Data and AI , OpenMetadata is the open platform for building trusted data context and business semantics for humans, AI assistants, and agents.

View on GitHub

26 documents · Updated Nov 23, 2026

docs / client-sdk-mcp-integrations

Client, SDK, and MCP integrations

OpenMetadata exposes programmatic surfaces for applications and AI tools. The Java client gives typed access to REST operations. The Java and Python SDKs provide resource-oriented access to metadata, search, lineage, governance, and ontology work. The MCP server presents selected catalog actions and prompts as governed interfaces for MCP-compatible assistants. These surfaces share the server contracts described in Metadata schema contracts and belong to the wider metadata contracts and clients model.

Integration surface map

The integration surfaces share the OpenMetadata API and its schema models, but they serve different callers. Choose the surface that matches the caller's language and interaction style.

SurfacePrimary callerMain value
Java clientJava applications that need direct API coverageGenerated, typed REST interfaces
Java SDKJava applications that need a resource-oriented APIService objects, fluent operations, search, lineage, governance, and ontology helpers
Python SDKPython scripts and applicationsTyped entity facades over the ingestion client
MCP serverAI assistants and agentsSearch, context, lineage, governance, selected metadata and graph actions, and prompts as MCP interfaces

Java and Python applications normally use a configured application token. MCP clients establish a user session through OAuth. SSO and SAML flows ask the user to approve the MCP client after sign-in, while Basic Auth and LDAP use a browser login form. The server then applies that user's OpenMetadata permissions and any active persona scope to each tool call. MCP access is user authentication for catalog access, not connector authentication for a data source. The MCP surface is available only when its setting is enabled and its application is active. A setting change or application disable takes effect at request time and returns 404 for MCP and discovery routes without a restart. The application state is refreshed in the background, so a database read outage keeps the last known state instead of blocking a request. A missing MCP setting uses the enabled schema default. The OAuth surface accepts only scopes known to the server and stores access and refresh tokens so revocation can take effect across server instances. Access tokens last ten minutes. Refresh grants last thirty days and rotate without extending that grant.

References: openmetadata-clients/…/pom.xml• L12-16 openmetadata-clients/pom.xml• L12-21 openmetadata-sdk/pom.xml• L13-16 ingestion/…/README.md• L1-5 openmetadata-mcp/README.md• L3-9 openmetadata-mcp/…/McpAvailabilityFilter.java• L23-45 openmetadata-mcp/…/McpAvailabilityFilter.java• L47-96 openmetadata-mcp/…/McpServer.java• L76-103 openmetadata-mcp/…/AuthEnrichedMcpContextExtractor.java• L13-25 openmetadata-mcp/…/UserSSOOAuthProvider.java• L83-116

Java client surface

The Java client is a generated REST boundary for Java callers. It builds typed API interfaces and models from the server's OpenAPI description. Its gateway supplies the server URL, authentication, headers, and optional version validation.

REST operation access

The client maps Java methods to OpenMetadata HTTP paths and returns generated model or response types. This is useful when an application needs close coverage of the REST contract or must call an operation that has no higher-level SDK helper.

The gateway accepts an OpenMetadataConnection, adds the configured bearer token through an authentication provider, and builds a client for a specific API interface. The Java client build generates its API and model classes from the server OpenAPI description. Its REST surface therefore follows the server contract and must be regenerated with contract changes.

References: openmetadata-clients/…/OpenMetadata.java• L34-49 openmetadata-clients/…/OpenMetadata.java• L56-90 openmetadata-clients/…/pom.xml• L176-199 openmetadata-clients/pom.xml• L12-17

Java SDK surface

The Java SDK is the higher-level Java surface for application code. An OpenMetadataClient groups domain services behind names such as tables(), users(), glossaries(), dataContracts(), search(), lineage(), and ontologyBulk() so callers work with product concepts instead of raw paths.

Client configuration

An application creates an OpenMetadataConfig with a server URL and access token. The client applies common request settings and bearer authentication, then exposes one service object for each supported product area. The SDK also supports a process-wide default client for code that uses fluent entry points.

References: openmetadata-sdk/…/OpenMetadataConfig.java• L6-15 openmetadata-sdk/…/OpenMetadataConfig.java• L63-139 openmetadata-sdk/…/OpenMetadataClient.java• L98-101 openmetadata-sdk/…/OpenMetadataClient.java• L144-180

Entity operations

Entity services give applications a common way to create, retrieve, list, update, restore, and delete metadata. They also provide entity-specific actions where the product needs more than basic lifecycle access.

The SDK represents ordinary edits as partial changes. It can compare an entity with the state previously read by the client and send the resulting patch, or it can send a patch document directly. This keeps application updates aligned with the server's partial-update model.

References: openmetadata-sdk/…/EntityServiceBase.java• L81-165 openmetadata-sdk/…/EntityServiceBase.java• L234-310 openmetadata-sdk/…/EntityServiceBase.java• L376-445

Search and lineage access

Search and lineage are first-class SDK APIs because they connect individual entities to discovery and dependency analysis. Search supports structured queries and result paging. Lineage supports dependency reads and lineage changes.

These APIs return server response shapes rather than hiding discovery or dependency data behind a narrow entity facade. Applications can control query depth and result size while using the same concepts as the OpenMetadata platform.

References: openmetadata-sdk/…/OpenMetadataClient.java• L176-180 openmetadata-sdk/…/OpenMetadataClient.java• L592-607 openmetadata-sdk/…/EntityServiceBase.java• L191-230

Glossary relation access

The SDK gives applications a typed way to use relations between glossary terms. Applications can read the configured relation vocabulary, add or remove a named relation, inspect relation usage, and load a bounded relation graph.

Relation graph requests accept a traversal depth, optional relation types, and node and edge limits. A relation type can be defined through the settings service, while its use remains subject to server permissions.

References: openmetadata-sdk/…/GlossaryRelationTypes.java• L27-59 openmetadata-sdk/…/GlossaryRelationTypes.java• L80-120 openmetadata-sdk/…/GlossaryTerms.java• L249-258 openmetadata-sdk/…/GlossaryTermService.java• L35-115

Ontology operations

The SDK exposes Ontology Studio as a typed application surface. It lets a client inspect and change ontology resources through bounded operations rather than treating ontology work as untyped REST calls.

CapabilityApplication value
Relationship types and axiomsDefine graph vocabulary and validate rules before persistence
Change sets and edit locksHold an authoring session, review changes, and avoid conflicting edits
Structure and impactPreview structural differences and inspect deletion effects
Packs, patterns, subsets, and modelingReuse ontology content and build focused graph views
Reasoning and AI proposalsManage inference and request reviewable AI suggestions

The service map exposes these operations from the same configured OpenMetadataClient as ordinary metadata services. Typed models carry server validation and review results back to the application.

References: openmetadata-sdk/…/OpenMetadataClient.java• L144-158 openmetadata-sdk/…/RelationshipTypeService.java• L24-49 openmetadata-sdk/…/OntologyChangeSetService.java• L27-79 openmetadata-sdk/…/OntologyEditLockService.java• L24-61 openmetadata-sdk/…/OntologyImpactService.java• L24-47 openmetadata-sdk/…/OntologyPackService.java• L24-49 openmetadata-sdk/…/OntologyReasoningService.java• L22-35 openmetadata-sdk/…/OntologyAiService.java• L28-66

Fluent application model

The fluent layer gives Java callers a readable alternative to direct service calls. OM.init(...) connects a client to fluent entity entry points. Callers can then find entities by ID or fully qualified name, include related data, save changes, and confirm destructive actions.

The fluent layer is an access style over the same client services. It does not create a separate metadata store or permission model. Glossary term builders also provide typed relation creation, removal, and bounded graph reads.

References: openmetadata-sdk/…/OM.java• L21-69 openmetadata-sdk/…/Tables.java• L14-48 openmetadata-sdk/…/Tables.java• L67-198 openmetadata-sdk/…/GlossaryTerms.java• L293-409

Python SDK surface

The Python SDK packages common OpenMetadata operations for Python applications and scripts. It uses typed generated models for data and plural facade classes for operations. This keeps entity data separate from the methods that act on it.

SDK configuration

metadata.sdk.configure(...) creates the default client used by the facades. Callers can pass a server URL and JWT or API key directly, provide a config object, or load the connection from environment variables. SSL verification, a CA bundle, and the client timeout are part of the connection configuration.

References: ingestion/…/__init__.py• L77-152 ingestion/…/config.py• L17-41 ingestion/…/config.py• L43-85

Entity and workflow access

Python facades cover common data assets, services, governance objects, users and teams, and data quality objects. They provide create, retrieve, update, delete, list, and automatic all-page iteration for supported entities. Search and lineage are separate SDK APIs because they describe relationships across many entities.

The SDK can resolve user and team references by exact name, email, or flexible name search. When a facade is not available, application code can use the underlying OpenMetadata ingestion client exposed by the SDK. Generated singular classes remain data models. The plural facade is the operation surface.

The underlying ingestion client also supports query metadata and query cost records. It keeps query identity and reference caches scoped to one client, resolves concurrent query creation by reading the existing record, and can continue cost tracking when SQL masking cannot parse a statement.

References: ingestion/…/__init__.py• L9-47 ingestion/…/__init__.py• L162-197 ingestion/…/README.md• L64-78 ingestion/…/query_mixin.py• L53-190 ingestion/…/user_mixin.py• L47-295

MCP server surface

The MCP server adapts OpenMetadata capabilities to the Model Context Protocol. It exposes an HTTP endpoint at /mcp, advertises the tools and prompts it can handle, and turns each tool call into an OpenMetadata operation under a user security context. The endpoint and its discovery routes are gated at request time by both the MCP setting and the active MCP application, so administrators can turn the surface off without a restart.

The server loads tool and prompt descriptions from shared JSON definitions. Tool descriptions carry titles and action hints for MCP clients, while the server exposes only capabilities that have handlers. Tool arguments are passed to the individual tools for their own rules rather than being rejected by the protocol SDK's default schema validator. A tool with an invalid schema is skipped instead of taking down the whole MCP endpoint.

The server advertises only tools and prompts. It does not claim protocol features that it cannot handle. Knowledge-graph tools that need a live RDF store are omitted from discovery when RDF is disabled, while ontology_describe can still serve the bundled ontology. Server settings can disable named tools for all callers. Read-only mode hides write tools from discovery, and both settings are checked again when a call runs, so a stale client cannot use a newly blocked tool. Changes to the advertised tool list take effect when the client lists tools again.

MCP request context also carries the active persona, an optional impersonation target, and a bounded client label derived from User-Agent. The label supports usage views for common clients such as Claude Desktop, Cursor, and VS Code. Unknown clients still produce a safe product label. The server resolves these values from request headers and clears request state before and after callback execution.

References: openmetadata-mcp/README.md• L11-46 openmetadata-mcp/…/McpAvailabilityFilter.java• L47-96 openmetadata-mcp/…/McpServer.java• L89-183 openmetadata-mcp/…/McpServer.java• L402-425 openmetadata-mcp/…/McpServer.java• L454-553 openmetadata-mcp/…/AuthEnrichedMcpContextExtractor.java• L13-35 openmetadata-mcp/…/AuthEnrichedMcpContextExtractor.java• L66-141 openmetadata-mcp/…/OAuthHttpStatelessServerTransportProviderTest.java• L364-393

MCP discovery and transport

An MCP client learns the server endpoint from MCP and OAuth server metadata. Root-level well-known requests and MCP-scoped discovery requests return live authorization, token, registration, revocation, protected-resource, and OpenID discovery details. The well-known filter serves the supported root and /mcp discovery paths directly so the application shell cannot replace them. The advertised URLs use the configured public base URL and /mcp. When MCP is unavailable, these discovery paths and /mcp return 404.

The transport accepts authenticated MCP JSON-RPC messages at /mcp through POST. GET is not a message method for this stateless endpoint. Requests must use application/json and must accept JSON or Server-Sent Events (SSE), which is a one-way event format. JSON is preferred when the client accepts both formats. SSE is used when the client accepts only SSE. The transport accepts the supported protocol version and refuses a named version it does not implement. Browser clients must also pass the MCP protocol, method, client identity, persona, and related headers through the configured CORS policy.

The transport bounds request bodies before parsing. MCP messages larger than 4 MiB and registration bodies larger than 64 KiB are rejected. Registration and token exchange have per-process IP rate limits. Forwarded addresses are trusted only from a loopback proxy. A remote web callback receives an error page with a user-clicked link instead of an automatic redirect.

The public base URL must match the deployment path or the reverse proxy must add that path. MCP settings persist in the database and are polled across cluster instances. A configuration update can change token validation, discovery metadata, base URL, and allowed origins while the server runs. The discovery document advertises only scopes supported by the configured identity provider and the signing algorithm used by tokens issued by OpenMetadata. Dynamic registration validates redirect URIs, accepts public PKCE clients without a secret, and keeps only supported grant and response types.

References: openmetadata-mcp/…/McpAvailabilityFilter.java• L23-45 openmetadata-mcp/…/McpServer.java• L254-391 openmetadata-mcp/…/HttpServletStatelessServerTransport.java• L117-224 openmetadata-mcp/…/HttpServletStatelessServerTransport.java• L305-337 openmetadata-mcp/…/HttpServletStatelessServerTransport.java• L353-435 openmetadata-mcp/…/OAuthHttpStatelessServerTransportProvider.java• L163-210 openmetadata-mcp/…/OAuthHttpStatelessServerTransportProvider.java• L218-311 openmetadata-mcp/…/OAuthHttpStatelessServerTransportProvider.java• L408-519 openmetadata-mcp/…/OAuthHttpStatelessServerTransportProvider.java• L1000-1107 openmetadata-mcp/…/OAuthHttpStatelessServerTransportProviderTest.java• L455-481 openmetadata-mcp/…/OAuthHttpStatelessServerTransportProviderTest.java• L630-677

User authentication

MCP access uses user authentication rather than connector authentication for a data source. The OAuth provider selects the configured OpenMetadata authentication path and issues an OpenMetadata JWT for the authenticated user. Supported paths include OIDC-style SSO, SAML, Basic Auth, and LDAP credential checks.

Public MCP clients use the Authorization Code flow with PKCE. Registration records the client and redirect URI. The authorization request stores PKCE and redirect state before the browser leaves OpenMetadata, so the flow can survive a cross-site redirect. SSO and SAML sign-in validate the identity and then show an OpenMetadata consent page before a code is issued. Basic Auth and LDAP use a browser login form with a session-bound CSRF token. A successful password login changes the session ID. The active authenticator is resolved at login time, so a security configuration change applies to later logins without rebuilding MCP.

OIDC ID tokens are accepted only after expiry, issuer, optional audience, key ID, and RSA signature checks pass against the provider's cached JWKS keys. Google permits its equivalent schemeless issuer form. The validated claims then map to an existing OpenMetadata user. This keeps identity proof separate from the OpenMetadata access token that the MCP server issues.

The authorization code is short-lived and single-use. Code exchange requires the original client, redirect URI, and PKCE verifier. It issues a ten-minute access token and a refresh token whose grant ends thirty days after sign-in. Refresh rotation does not extend that grant. Access and refresh tokens are persisted in protected form. Revoking a refresh token also revokes its related access tokens, while a concurrent refresh can consume a token only once.

The callback validates issuer, audience when configured, expiry, signature, and trusted key ID before it maps claims to an existing OpenMetadata user. Provider free-text errors are not relayed. The server sends a safe OAuth error only to a registered redirect URI. Login forms check CSRF state, and remote error callbacks require the user to follow a link. If the server cannot confirm a stored bearer token for a short time, it returns a retryable unavailable response instead of treating the token as invalid.

References: openmetadata-mcp/README.md• L5-31 openmetadata-mcp/…/AuthorizationHandler.java• L34-190 openmetadata-mcp/…/IdTokenValidator.java• L37-52 openmetadata-mcp/…/IdTokenValidator.java• L141-273 openmetadata-mcp/…/BasicAuthLoginServlet.java• L38-51 openmetadata-mcp/…/BasicAuthLoginServlet.java• L105-238 openmetadata-mcp/…/McpPendingAuthRequestRepository.java• L13-16 openmetadata-mcp/…/McpPendingAuthRequestRepository.java• L32-125 openmetadata-mcp/…/UserSSOOAuthProvider.java• L229-328 openmetadata-mcp/…/UserSSOOAuthProvider.java• L497-623 openmetadata-mcp/…/UserSSOOAuthProvider.java• L651-730 openmetadata-mcp/…/UserSSOOAuthProvider.java• L843-1065 openmetadata-mcp/…/UserSSOOAuthProvider.java• L1092-1217 openmetadata-mcp/…/IdTokenValidatorTest.java• L88-235

Governed tool execution

After authentication, the server validates the bearer token and builds a catalog security context. The authorizer checks the user's rights before a tool reads or changes metadata. An active persona can add a search boundary. A bot can request an impersonated view when the platform permits it, and the MCP bot remains the actor recorded for ordinary calls. The server also records the MCP client name, latency, tool outcome, and failure category for usage reporting. Usage tracking is best effort and does not control billing, rate limits, or whether the tool call succeeds.

The tool set covers these jobs:

  • Discovery and context: keyword search, semantic search, entity details, user and persona context, business context, concept context, knowledge content, and root-cause analysis.
  • Metadata action: generic entity creation, JSON Patch updates, lineage changes, data quality actions, and selected governance actions.
  • Knowledge graph access: read-only SPARQL, entity neighborhoods, tag or glossary-term lookup, SHACL validation, and ontology description when RDF is available or the bundled ontology can answer the request.

Tool and prompt names are part of the client contract. Tool definitions and prompt definitions are loaded from JSON, while dispatch maps the advertised names to governed operations. Tool results contain serialized text and structured content. A logical tool failure is marked as an MCP error. A useful partial result remains successful when it carries paging or truncation markers.

Generic creation resolves the requested type from the registered repository and uses repository-owned type information to expose accepted and required fields. Shared fields stay at the top level. Type-specific fields go under attributes. The flow supplies limited defaults and excludes fields maintained by relationships or background work. Owner names must resolve to users or teams instead of being silently dropped. A resolved name is checked for overwrite rights before the repository chooses create or update. Types that need dedicated authentication, scheduling, specialized authorization, or secret handling remain on dedicated APIs. Test cases use create_test_case, which preserves test-suite setup and test-specific authorization. Approval-held writes return pendingApproval and a change request ID instead of claiming that the entity changed.

Generic updates accept an RFC 6902 JSON Patch document. The tool checks the document shape before authorization, rejects protected service connection paths, time-series entities, and resources with a dedicated patch lifecycle, then sends the named operations to the repository. Successful writes return compact results and publish a masked change event. The write records the caller and marks the change as automated. Approval-held patches return the published entity with a pending marker until a reviewer approves the change.

Read-only mode is a server-wide MCP boundary. It uses each tool's read-only annotation to filter discovery, but keeps describe_entity_type as a helper for read-only clients. Execution checks the current setting again, so a write cannot pass through while clients still hold an older tool list. Named disabled tools follow the same call-time refusal rule.

References: openmetadata-mcp/…/McpServer.java• L454-517 openmetadata-mcp/…/McpServer.java• L520-553 openmetadata-mcp/…/AuthEnrichedMcpContextExtractor.java• L66-84 openmetadata-mcp/…/CommonUtils.java• L45-97 openmetadata-mcp/…/CommonUtils.java• L137-165 openmetadata-mcp/…/CommonUtils.java• L249-305 openmetadata-mcp/…/CreateEntityTool.java• L52-161 openmetadata-mcp/…/CreateEntityTool.java• L176-190 openmetadata-mcp/…/CreateTestCaseTool.java• L61-137 openmetadata-mcp/…/PatchEntityTool.java• L31-147 openmetadata-mcp/…/PatchEntityTool.java• L149-270 openmetadata-mcp/…/McpResponseUtils.java• L58-89 openmetadata-mcp/…/McpResponseUtils.java• L127-169 openmetadata-mcp/…/McpUsageRecorder.java• L27-101 openmetadata-mcp/…/tools.json• L511-636 openmetadata-mcp/…/GetEntityToolTest.java• L320-371

Prompt surface

Prompts provide reusable instructions for an assistant without replacing catalog operations. The current search prompt turns a query, entity type, and result limit into an instruction to call search and summarize linked results; the actual catalog read still occurs through a tool.

Prompt definitions are discovered separately from tools. Prompt dispatch uses the authenticated request context and returns a protocol prompt result. Unknown or failed prompt calls return an error result rather than silently selecting another prompt.

References: openmetadata-mcp/…/DefaultPromptsContext.java• L11-41 openmetadata-mcp/…/SearchPrompt.java• L7-33 openmetadata-mcp/…/McpUtils.java• L120-145 openmetadata-mcp/…/McpServerRequestContextTest.java• L225-285

Discovery and context tools

Keyword search is best for known names and structured properties. Semantic search is best for a business idea when exact identifiers are not known. Both paths honor the active persona boundary unless the caller explicitly requests a bypass, and semantic results collapse matching passages to one visible result per entity.

An active persona search scope combines with the caller's filter and limits the entity types searched. A missing or invalid saved scope does not replace the normal search behavior. When a scoped search returns no results, the response explains that ignorePersonaScope=true can be used for an explicit broader search.

Keyword search returns exact total counts and pages through the supported result window. It resolves a registered entity type to that type's search index. A broad search also includes AI governance assets. Filters remain combined with the text query and deleted-entity setting. Search results are compact, mark shortened fields, preserve metric hierarchy, and provide a cursor when the result or response-size limit removes more results. A caller must narrow the query after the search engine's result window rather than assume that an offset can reach every match.

find_context searches glossary definitions, metrics, and Context Center articles. It returns definitions and candidate assets, which the caller can pass to an exact detail or concept-context request. company_context uses one surface for either searching approved, shared, file-extracted knowledge pills by question or reading one pill by its exact FQN. These two modes are mutually exclusive. Question search needs vector embeddings and returns markdown by default or JSON when requested. A direct FQN read does not need vector search and applies the same caller visibility and source-document redaction rules.

get_persona_context returns one bounded part of a persona's shared AI context in markdown or JSON. Part one also carries the persona prompt when one exists. The response includes a fingerprint and continuation markers so an assistant can request later parts without treating a clipped context document as complete.

get_entity_details reads one entity or up to ten entityType:fqn references in one call. Batch entries resolve independently, so one bad reference or denied read does not hide the other results. Optional lineage, quality, asset context, and knowledge content can be included. Metric reads include visible child expressions for a bounded set of variants. Wide column lists and large schema or SQL fields stay bounded and report their paging or truncation state.

Entity reads apply per-entity visibility rules and mask stored credentials or user authentication data before returning the result. Metric and metric-group relations are filtered to the caller's visible entities. Content-only reads keep the lower basic-view boundary. A caller should use the exact entity type and fully qualified name returned by discovery rather than rebuild those values.

References: openmetadata-mcp/…/SearchMetadataTool.java• L173-351 openmetadata-mcp/…/SearchMetadataTool.java• L401-550 openmetadata-mcp/…/SemanticSearchTool.java• L121-187 openmetadata-mcp/…/FindContextTool.java• L22-75 openmetadata-mcp/…/CompanyContextTool.java• L37-99 openmetadata-mcp/…/CompanyContextTool.java• L105-197 openmetadata-mcp/…/CompanyContextTool.java• L200-283 openmetadata-mcp/…/GetPersonaContextTool.java• L34-83 openmetadata-mcp/…/PersonaSearchScope.java• L34-99 openmetadata-mcp/…/GetEntityTool.java• L147-318 openmetadata-mcp/…/CommonUtils.java• L45-84 openmetadata-mcp/…/tools.json• L4-53 openmetadata-mcp/…/tools.json• L187-352 openmetadata-mcp/…/CompanyContextToolTest.java• L76-155 openmetadata-mcp/…/CompanyContextToolTest.java• L285-443 openmetadata-mcp/…/GetEntityToolTest.java• L125-209

Lineage and quality tools

get_entity_lineage gives a compact upstream and downstream graph for one entity. Table-level identity and relationship data are returned by default. Transformation SQL and column mappings are opt-in because they can dominate the response.

The tool can focus on one column by accepting its exact FQN. It validates that the column belongs to the requested entity, follows mappings across bounded hops, and reports unknown or omitted edges instead of presenting an incomplete graph as complete. Root-cause analysis combines data-quality failures with upstream causes and downstream impact while keeping the caller's security identity in every lineage read.

Lineage authorizes the root, every visible graph node, and each named pipeline. Results report completeness, counts, cursors, hidden nodes, unchecked nodes beyond the authorization limit, and truncation when response limits affect the graph. Root-cause results distinguish failures on the analyzed asset from failures inherited from upstream. They include downstream impact only when either kind of failure exists and can add the upstream producers when no failing upstream test is found. Callers must treat these markers and status fields as part of the result contract.

References: openmetadata-mcp/…/GetLineageTool.java• L43-164 openmetadata-mcp/…/GetLineageTool.java• L211-247 openmetadata-mcp/…/GetLineageTool.java• L441-519 openmetadata-mcp/…/RootCauseAnalysisTool.java• L62-159 openmetadata-mcp/…/RootCauseAnalysisTool.java• L162-265 openmetadata-mcp/…/tools.json• L639-692 openmetadata-mcp/…/tools.json• L869-917

Knowledge graph tools

The graph tools expose read-only views of RDF-backed OpenMetadata data. sparql_query runs a guarded read-only graph query. entity_neighborhood returns a bounded multi-hop graph. find_by_tag finds linked entities. shacl_validate checks a scoped subgraph or an explicitly requested full graph. ontology_describe returns the bundled ontology or a focused description of one valid resource.

RDF-dependent tools require an enabled RDF repository and an administrator principal for the most powerful graph operations. Expensive reads use shared admission limits and timeouts. Graph bodies are bounded by UTF-8 bytes and report truncation. Full-graph validation is explicit because it can load the complete dataset. ontology_describe remains available without a live RDF store because its default answer comes from the bundled ontology. Tool descriptions must use vocabulary that the RDF projection declares and stores.

References: openmetadata-mcp/…/McpServer.java• L119-157 openmetadata-mcp/…/RdfMcpTool.java• L26-79 openmetadata-mcp/…/SparqlQueryTool.java• L27-95 openmetadata-mcp/…/EntityNeighborhoodTool.java• L30-109 openmetadata-mcp/…/OntologyDescribeTool.java• L27-127 openmetadata-mcp/…/ShaclValidateTool.java• L25-109 openmetadata-mcp/…/SparqlQueryToolTest.java• L68-189 openmetadata-mcp/…/RdfToolDescriptionVocabularyTest.java• L38-129

MCP request flow

The request path links an external assistant to the same catalog security and metadata services used by other platform callers. OAuth discovery and authorization complete the user session before the stateless transport accepts authenticated MCP messages. Availability checks can stop the flow before discovery or transport when the MCP setting or application is inactive.

This diagram shows how a client moves from OAuth discovery to user approval and then to a governed catalog operation.

sequenceDiagram
    participant A as MCP client
    participant W as Discovery metadata
    participant O as OAuth endpoints
    participant S as SSO, SAML, or login
    participant U as OpenMetadata consent
    participant M as /mcp transport
    participant Z as OpenMetadata authorizer
    participant C as Metadata or graph services

    A->>W: Discover resource and authorization metadata
    A->>O: Register client
    A->>O: Authorize with PKCE
    O->>S: Authenticate user
    S-->>O: Return authenticated identity
    O->>U: Ask user to approve MCP client
    U-->>O: Return approved decision
    O-->>A: Return authorization code
    A->>O: Exchange code and verifier
    O-->>A: Return access and refresh tokens
    A->>M: POST JSON-RPC with bearer token
    M->>Z: Validate token and build user context
    Z->>C: Authorize and run operation
    C-->>M: Catalog result
    M-->>A: Structured content and text result

References: openmetadata-mcp/…/McpAvailabilityFilter.java• L47-64 openmetadata-mcp/…/McpServer.java• L254-391 openmetadata-mcp/…/AuthorizationHandler.java• L34-190 openmetadata-mcp/…/UserSSOOAuthProvider.java• L331-482 openmetadata-mcp/…/UserSSOOAuthProvider.java• L497-730 openmetadata-mcp/…/OAuthHttpStatelessServerTransportProvider.java• L647-805 openmetadata-mcp/…/OAuthHttpStatelessServerTransportProvider.java• L807-999 openmetadata-mcp/…/McpServer.java• L454-553

Access boundaries

The surfaces differ mainly in who calls them and how the caller receives permissions. Java and Python applications normally hold a configured token. MCP clients first establish a user session, and each subsequent call carries the resulting bearer token.

The server remains the source of authorization for all surfaces. Client libraries make requests easier to form and decode; they do not replace server policy checks. MCP adds a tool and prompt contract plus AI-focused response limits. RDF tools add an administrator boundary and a deployment check for the graph store. Read-only MCP mode and disabled-tool settings add server-wide boundaries that apply even to administrators. MCP availability adds an outer deployment boundary: an inactive setting or application makes the surface absent rather than merely unauthorized.

Response and error contract

The Java SDK exposes typed responses and SDK exceptions for server failures. MCP returns serialized text and structured content for successful tool calls. It sets the protocol error flag for authorization, validation, missing-resource, rate-limit, timeout, and server failures.

Tool results use a shared response contract. A map with error is a logical failure. A partial result uses markers such as hasMore, nextCursor, truncated, or hiddenNodes; these markers do not turn a useful partial answer into a protocol error. The transport returns HTTP 401 with a bearer challenge when credentials are missing or rejected. Only a supplied but invalid bearer token carries the invalid_token challenge error. If the token store cannot be confirmed temporarily, the transport returns HTTP 503 with Retry-After and a retryable JSON-RPC error.

MCP error bodies contain only the JSON-RPC code and message. They do not serialize exception fields or caller-supplied error data. Large results are partial only when the response says so. Search and vector tools use cursors. Entity details page wide column lists and cap unusually large schema or SQL fields. Persona context returns bounded parts with a fingerprint and continuation markers. Lineage reports totals, returned counts, omitted oversized edges, and continuation cursors when the response budget clips the graph. RDF tools report bounded bodies and original byte counts. Create and patch responses are compact, mask credential-bearing fields on copies, and identify the operation or changed fields needed to confirm the write. Approval-held writes identify pendingApproval and a change request ID while leaving the published entity unchanged.

Callbacks also clear per-request state on both success and failure. A token that cannot be confirmed temporarily is reported as unavailable, while a fatal callback failure is reported as a safe internal error rather than leaving the MCP client waiting for a reply.

References: openmetadata-mcp/…/JsonRpcErrorBody.java• L11-84 openmetadata-mcp/…/OAuthHttpStatelessServerTransportProvider.java• L435-631 openmetadata-mcp/…/McpServer.java• L433-553 openmetadata-mcp/…/McpResponseUtils.java• L127-169 openmetadata-mcp/…/DefaultToolContext.java• L197-263 openmetadata-mcp/…/DefaultToolContext.java• L453-492 openmetadata-mcp/…/GetPersonaContextTool.java• L57-83 openmetadata-mcp/…/McpResponseTrim.java• L48-89 openmetadata-mcp/…/OAuthHttpStatelessServerTransportProviderTest.java• L719-866

Change checklist

When these files or sections are changed, remember to consider these:

  • Update the server OpenAPI contract and generated Java client together when a REST path, request, response, or auth behavior changes.
  • Keep Java SDK service paths, typed request and response models, and OpenMetadataClient getters aligned when a product endpoint changes.
  • Keep Python facade names, generated model imports, and the underlying ingestion client aligned when an entity or request model changes.
  • Keep query masking, service-qualified query identity, usage links, cost references, and per-client caches aligned across separate catalogs.
  • Keep glossary relation vocabulary, relation mutations, graph bounds, and fluent builders aligned.
  • Keep ontology service paths and typed models aligned across change sets, locks, impact previews, packs, patterns, reasoning, and AI proposals.
  • Keep MCP tool and prompt definitions, titles, annotations, dispatch names, capability flags, schema handling, read-only filtering, disabled-tool filtering, and structured-content behavior aligned. A tool that is advertised but not dispatched fails only when an assistant calls it.
  • Keep prompt text and prompt dispatch aligned. A prompt should guide a tool call, not become a second catalog access path.
  • Keep RDF-dependent tool discovery aligned with RDF startup state. A graph tool must not appear in tools/list when its repository cannot run it.
  • Keep MCP availability checks aligned across the /mcp transport, SSO and SAML callbacks, and root and MCP-scoped well-known discovery routes. A disabled application must not leave OAuth metadata reachable.
  • Keep public base URL, context path, well-known routes, OAuth discovery metadata, /mcp, /mcp/callback, consent, and allowed origins aligned.
  • Keep OAuth issuer, registered redirect URIs, pending request state, PKCE values, client identity, consent, and user mapping aligned across authorization and token exchange.
  • Keep OIDC issuer, audience, key ID, signing algorithm, JWKS URLs, key cache limits, and OpenMetadata token discovery aligned. Provider signing settings must not change the algorithm advertised for tokens issued by OpenMetadata.
  • Keep SSO callback error mapping and redirect handling aligned. Canonical OAuth errors may return to the MCP client, but provider free text must not reach the browser or redirect query.
  • Keep Basic Auth and LDAP form state, CSRF checks, account lockout behavior, runtime authenticator selection, and session renewal aligned.
  • Keep known scopes, provider-specific discovery scopes, requested scopes, and granted scopes aligned. Unknown scopes must not silently become granted permissions.
  • Keep access-token persistence, refresh-token expiry and rotation, client ownership, revocation, and token validation aligned across all servers.
  • Keep bearer challenge semantics, retryable token-store failures, CORS allowed headers, exposed headers, and browser origins aligned.
  • Keep JSON content negotiation, SSE fallback, context-path routing, protocol-version handling, request-size limits, IP rate limits, and JSON-RPC error envelopes aligned for every MCP client.
  • Keep generic create and patch lifecycle allowlists aligned with dedicated REST resources. Credential-bearing resources must not become reachable through generic tools.
  • Keep generic entity descriptions, repository-owned fields, shared parameters, required values, defaults, system-owned fields, owner resolution, overwrite authorization, and approval-held response markers aligned. A schema that advertises a field the create path rejects causes avoidable write failures.
  • Keep entity-read visibility checks and secret masking aligned across ordinary reads, content-only reads, compact writes, and change events.
  • Keep MCP usage payload names, app identity, client-name classification, extension type, outcome fields, and generated time-series columns aligned. Usage recording must remain best effort and must not become part of tool success.
  • Keep metric relation visibility, expression caps, search result hierarchy fields, entity-detail projections, and persona-context part markers aligned.
  • Keep active persona propagation, saved search scope compilation, entity-type limits, and the explicit ignorePersonaScope bypass aligned.
  • Keep exact search totals, entity-type index selection, default AI governance scope, persona scope, exclusions, result-window limits, and cursor offsets aligned.
  • Keep semantic-search filters, parent-level paging, persona scope, and visibility filtering aligned so cursors do not skip or repeat entities.
  • Keep company-context query and FQN modes aligned with file-extraction scope, shared visibility, approval state, source-document redaction, and vector-search availability.
  • Keep lineage node and pipeline authorization, depth bounds, column narrowing, SQL opt-in, edge paging, hidden-node markers, and root-cause status semantics aligned.
  • Keep graph admission, per-principal limits, timeout classification, byte limits, inference warnings, and the shared dispatch budget aligned.
  • Keep identity, active-persona propagation, MCP bot impersonation, client attribution, and authorization checks intact across transport and tool execution threads.
  • Clear request caches and thread-local identity state at both callback boundaries. MCP callbacks can run on reused workers.

Important failure modes

TriggerConsequenceGuard
Java client artifacts do not match the server OpenAPI contractRequests or response decoding can fail at the REST boundaryRegenerate the client with the server contract and keep versions aligned
SDK client is used before initialization or without a server URLCalls fail before they reach OpenMetadataConfigure one client with a valid URL and token before using service or fluent entry points
MCP setting is disabled or the MCP application is inactive/mcp and OAuth discovery return 404 until the surface is enabled againCheck both the current MCP setting and active application state when changing availability
MCP app state cannot be read during a database outageThe server keeps the last known availability stateRestore the database and confirm the app state refresh before treating a 404 or available route as current
MCP base URL omits a deployed context path without a proxy rewriteDiscovery advertises endpoints that the client cannot reachInclude the public context path in the base URL or verify the proxy rewrite
Discovery metadata and the OAuth issuer change out of stepThe client rejects a valid authorization responsePublish rebuilt metadata before changing the issuer
OpenMetadata signs tokens with an algorithm different from the one in OpenID discoveryClients reject tokens after authenticationAdvertise the algorithm used by the server's own JWT generator
An OIDC ID token has an unknown issuer, audience, key ID, or signatureMCP cannot map the identity to an OpenMetadata userValidate claims and the signature against the configured JWKS keys before accepting the callback
A client requests an unregistered redirect URI or unknown OAuth scopeAuthorization fails instead of granting the requested sessionRegister the exact redirect URI and request only supported, registered scopes
A public client is issued or required to use a secretPKCE-only clients cannot complete token exchangeRegister public clients with token_endpoint_auth_method=none and use PKCE
SSO succeeds but the user does not complete consentNo MCP authorization code is issuedKeep consent bound to the authenticated pending request and registered redirect URI
An identity provider returns a free-text error or unknown error codeThe MCP client receives unsafe or unusable callback dataCanonicalize the error and relay only a safe code to the registered redirect URI
Pending OAuth state expires or is not linked across the provider callbackThe browser cannot complete authorizationPreserve the database-backed pending request and its short TTL across redirects
Redirect URI or PKCE verifier does not match the stored requestToken exchange returns invalid_grantRegister and reuse the exact redirect URI and verifier
Refresh token is replayed or Fernet decryption failsThe MCP session must authenticate againAtomically rotate refresh tokens and treat decryption failure as re-authentication
A revoked access token is not removed from the shared token storeAnother server may continue to accept the session until token expiryPersist access tokens and validate the stored grant on every request
Basic or LDAP credentials are rejected or the account is blockedThe login form shows an inline error instead of issuing a codeKeep credential failures separate from authentication-service failures and retain CSRF checks
The configured password provider changes while the MCP server is runningA login can use the wrong authenticator or report an unavailable flowResolve the authenticator and SSO handler from current security configuration for each login or callback
A bearer token is missing or invalidThe transport returns HTTP 401 and does not run the toolComplete OAuth and send the current bearer token on every MCP request
The token store is temporarily unavailableA valid client may receive a retryable HTTP 503 instead of a new login challengeHonor Retry-After and retry the same bearer request
Browser origin or required MCP header is not allowed by CORSThe browser sees a network error before it can read the responseConfigure allowed origins, MCP headers, and exposed WWW-Authenticate and Retry-After headers
A request uses the wrong content type, unsupported protocol version, or accepts neither JSON nor SSEThe transport rejects it before tool executionSend Content-Type: application/json, use a supported version, and accept application/json or text/event-stream
A request body exceeds the transport limitThe MCP call or registration is rejected before parsingKeep MCP messages below 4 MiB and registration bodies below 64 KiB
A tool schema is invalid for the MCP SDKThat tool is skipped and disappears from discovery while the rest remain availableValidate every advertised schema before registration
An exception is serialized as the MCP error bodyInternal stack details or caller data leak to an unauthenticated clientReturn the bare JSON-RPC error envelope and keep the throwable in server logs
Read-only mode or a disabled tool hides discovery but execution does not check current settingsA stale client can still change metadata or call a blocked toolFilter discovery and reject the tool again at call time
create_entity receives an unknown field, unresolved owner, duplicate name without edit rights, or dedicated-lifecycle typeThe write is rejected and no generic update occursCall describe_entity_type, resolve owners with discovery, check overwrite rights, and route specialized types to dedicated APIs
A generic create schema is not derived from the same registered entity contract as the write pathThe tool advertises fields that persistence rejects or dropsKeep describe_entity_type, EntityCreationSpec, and repository binding aligned
company_context receives both lookup keys or no lookup keyThe tool cannot know whether to search or read and returns a caller errorPass exactly one of query and fqn
Company Context question search runs without vector embeddingsThe search path returns an unavailable semantic-search errorEnable vector embeddings or use the direct FQN mode
patch_entity receives a malformed operation or a protected or dedicated targetThe write is rejected before persistenceUse a valid RFC 6902 document and route service connections, time-series entities, and dedicated lifecycles through their REST APIs
An entity read or write response skips its own visibility rule or secret maskMCP returns private context or stored credentialsApply caller visibility checks and copy-based masking before returning the entity

Key files

FileWhy to read it
openmetadata-clients/…/OpenMetadata.javaShows the Java client's connection, authentication, and typed API construction boundary
openmetadata-clients/…/pom.xmlShows the OpenAPI-generated Java REST surface
openmetadata-sdk/…/OpenMetadataClient.javaShows the Java SDK product service map
openmetadata-sdk/…/EntityServiceBase.javaShows the common entity lifecycle and patch contract
ingestion/…/__init__.pyShows Python SDK configuration and exported facades
ingestion/…/README.mdDescribes the Python SDK application model
openmetadata-mcp/README.mdGives the MCP OAuth purpose, authentication modes, configuration model, and deployment contract
openmetadata-mcp/…/McpAvailabilityFilter.javaShows request-time availability checks and the cached application state used to disable MCP without a restart
openmetadata-mcp/…/McpServer.javaShows MCP capability discovery, live tool gating, endpoint setup, security context, request cleanup, usage recording, and tool execution
openmetadata-mcp/…/AuthEnrichedMcpContextExtractor.javaShows how bearer, persona, impersonation, and MCP client identity enter a tool request
openmetadata-mcp/…/HttpServletStatelessServerTransport.javaShows authenticated POST handling, protocol checks, JSON and SSE negotiation, request-size limits, and safe JSON-RPC errors
openmetadata-mcp/…/OAuthHttpStatelessServerTransportProvider.javaShows OAuth discovery, base-path handling, CORS, bearer challenges, rate limits, and OAuth route handling
openmetadata-mcp/…/IdTokenValidator.javaShows OIDC claim and JWKS signature checks before user mapping
openmetadata-mcp/…/UserSSOOAuthProvider.javaShows user authentication, consent, authorization codes, PKCE, token lifetime, and refresh rotation rules
openmetadata-mcp/…/AuthorizationHandler.javaShows authorization request and PKCE validation
openmetadata-mcp/…/RegistrationHandler.javaShows dynamic client registration, public-client behavior, and redirect URI policy
openmetadata-mcp/…/BasicAuthLoginServlet.javaShows browser login, CSRF protection, runtime authenticator selection, and Basic Auth or LDAP completion
openmetadata-mcp/…/McpPendingAuthRequestRepository.javaShows database-backed OAuth state and consent lifetime across redirects
openmetadata-mcp/…/OAuthAuthorizationCodeRepository.javaShows short-lived, hashed, single-use authorization codes
openmetadata-mcp/…/OAuthTokenRepository.javaShows stored token validation, revocation, and atomic refresh rotation
openmetadata-mcp/…/tools.jsonDefines MCP tool names, parameters, descriptions, annotations, and caller contracts
openmetadata-mcp/…/DefaultToolContext.javaShows tool dispatch, structured results, protocol errors, usage categories, and response budget handling
openmetadata-mcp/…/CreateEntityTool.java, EntityCreationSpec.javaShow the repository-driven generic create boundary and the entity types that require dedicated APIs
openmetadata-mcp/…/CreateTestCaseTool.javaShows the dedicated test-case create lifecycle and approval-aware result
openmetadata-mcp/…/PatchEntityTool.javaShows the generic JSON Patch boundary, structural validation, protected connection paths, and dedicated resource lifecycles
openmetadata-mcp/…/CommonUtils.java, McpResponseUtils.javaShow caller-scoped visibility, owner resolution, overwrite checks, secret masking, and compact or pending write responses
openmetadata-mcp/…/CompanyContextTool.javaShows the shared Company Context search and exact-FQN read contract
openmetadata-mcp/…/SearchMetadataTool.javaShows keyword discovery, persona scope, exact totals, result-window paging, hierarchy fields, and response trimming
openmetadata-mcp/…/PersonaSearchScope.java, GetPersonaContextTool.javaShows persona-bounded search and paged shared AI context
openmetadata-mcp/…/GetLineageTool.javaShows compact lineage, per-node authorization, column filtering, edge paging, and completeness markers
openmetadata-mcp/…/RootCauseAnalysisTool.javaShows data-quality root cause, local versus upstream failures, impact analysis, and budget-aware results
openmetadata-mcp/…/DefaultPromptsContext.java, SearchPrompt.javaShows prompt discovery and the reusable search instruction surface
openmetadata-mcp/…/RdfMcpTool.java, SparqlQueryTool.java, EntityNeighborhoodTool.java, ShaclValidateTool.java, OntologyDescribeTool.javaShow guarded RDF query, neighborhood, validation, and ontology surfaces