Third-party Integrations (Examples)
Relevant source files
The following files were used as context for generating this wiki page:
Third-party integrations in the Speakeasy project demonstrate how to connect AI agents to external services, APIs, and Model Context Protocol (MCP) servers. These examples showcase patterns for building "Speakeasy Functions" that serve as secure bridges, providing orchestration, data transformation, and access control for external systems.
Integrations typically follow a pattern where the AI Control Plane manages distribution, fine-grained permissions, and observability for tools interacting with SaaS vendors (e.g., SpaceX API, Pinecone, Resend, Supabase) and internal infrastructure.
Integration Patterns and Architecture
Speakeasy utilizes a proxy/interceptor pattern for third-party integrations. This architecture allows the platform to validate tool calls, enforce security policies, and transform data before it reaches the external service.
The flow diagram illustrates how a Speakeasy Function intercepts agent requests to validate authorization before executing external API calls.
Sources: examples/functions-approve/readme.md:46-75, README.md:52-56
Core Integration Components
| Component | Description |
|---|---|
| Speakeasy Functions | Serverless runners that implement tool logic and API orchestration. |
| MCP Servers | Servers implementing the Model Context Protocol to expose tools to agents. |
| Zod Schemas | Used for type-safe validation of inputs and environment configurations. |
| Environment Variables | Store sensitive credentials and configuration (e.g., API keys, approval tokens). |
Sources: examples/functions-basic/README.md:25-28, examples/functions-approve/src/functions.ts:153-157
Example: Approval Flow Integration
The approval flow integration demonstrates a security layer that intercepts tool calls requiring administrative oversight. This is critical for integrations involving destructive actions or sensitive data access.
Approval Logic Sequence
The sequence diagram shows the interaction between the AI agent and the proxy function to verify administrative approval stored in environment variables.
Sources: examples/functions-approve/src/functions.ts:162-243, examples/functions-approve/readme.md:46-75
Implementation Details
- Prefix Matching: Tools starting with
protected_tool_are automatically intercepted. - Validation Strategies: The system supports environment variable checks, API-based validation, and database-backed validation.
- Masking: Sensitive values are masked in logs and responses to prevent secret exposure.
Sources: examples/functions-approve/src/functions.ts:50-130
External AI Coding Assistant Integrations
Speakeasy provides specific integration paths and instructions for major AI coding assistants. These integrations allow teams to distribute MCP servers and plugins centrally.
Supported Assistant Platforms
| Platform | Integration Method | Key Configuration |
|---|---|---|
| Claude Code | Managed Settings | OTEL_EXPORTER_OTLP_ENDPOINT, extraKnownMarketplaces |
| Cursor | Team Marketplaces | Import from private GitHub repository; set as "Required". |
| Codex | Device Agent (MDM) | Fleet-based rollout; ~/.codex/config.toml modifications. |
| GitHub Copilot | CLI Plugins | ZIP-based install with embedded hooks-scoped API keys. |
| OpenCode | Local Plugin | .opencode/plugin/agenthooks.ts and speakeasy.json. |
Sources: client/dashboard/src/pages/setup/setup-data.ts:25-300, client/dashboard/src/pages/plugins/InstallInstructionsDialog.tsx:50-500
Claude Code Integration Flow
Claude Code integrates via a specific settings.json structure that registers the Speakeasy marketplace and enables OTLP (OpenTelemetry) telemetry for observability.
The diagram shows how Claude Code configuration links local settings to the Speakeasy marketplace and telemetry collectors.
Sources: client/dashboard/src/pages/setup/setup-data.ts:15-40
Example: UI-Based Integrations (Mermaid App)
The Mermaid App integration demonstrates how to render framework-based frontends (React + Vite) as MCP Apps (SEP-1865).
- Bundling: Uses
vite-plugin-singlefileto create a self-contained HTML file. - UI Resource: Exposes HTML via
functions.experimental_uiResource. - Data Bridge: Passes structured data to the widget using
ctx.json(...)which is consumed byGram.onData(cb)in the frontend.
Sources: examples/mermaid-app/README.md:1-20
Conclusion
The examples of third-party integrations within the Speakeasy project highlight a flexible, security-first approach to connecting AI agents with the broader software ecosystem. By utilizing Speakeasy Functions as an orchestration layer, developers can implement robust validation, complex API sequencing, and rich UI experiences while maintaining centralized control and observability.
Sources: README.md:10-15, examples/functions-basic/README.md:1-5