MCPApiModule - MCP integrations use the shared MCPApiModule for MCP protocol communication - Developer Guide - Cortex - Cortex - Security Operations

MCP Integration Contributor Guide

Product
Cortex
Creation date
2026-05-20
Last date published
2026-05-20
Category
Developer Guide
Abstract

MCP integrations use the shared MCPApiModule for MCP protocol communication

All MCP integrations use the shared MCPApiModule to handle MCP protocol communication. You should not reimplement MCP logic, as the module provides everything you need:

Key classes and functions

Client class: Handles all MCP communication
  • test_connection(): Verify connectivity to the MCP server.

  • list_tools(server_name): Retrieve available tools.

  • call_tool(tool_name, arguments): Execute a tool.

  • close(): Clean up the connection.

AuthMethods enum: Supported authentication types
  • Simple auth methods: BASIC, TOKEN, BEARER, API_KEY, RAW_TOKEN, CLIENT_CREDENTIALS.

  • OAuth methods requiring user authorization: AUTHORIZATION_CODE, DYNAMIC_CLIENT_REGISTRATION.

Utility functions
  • parse_custom_headers(text): Parse multiline header input.

  • extract_root_error_message(exception): Unwrap nested exceptions for error reporting.

  • generate_login_url(oauth_handler, ...): Generate OAuth login URLs.

  • REDIRECT_URI: Default OAuth redirect URI constant.

Refer to Packs/ApiModules/Scripts/MCPApiModule/MCPApiModule.py in the content repository for the complete API.