Skip to main content

Barndoor SDK Examples

This directory contains working examples that demonstrate how to use the Barndoor TypeScript SDK with MCP servers.

Key Patterns

Both examples follow the same proven pattern:

Configuration

Both examples use the same authentication pattern:
  1. Environment Variables (create a .env file):
  2. Server Configuration: Change the SERVER_SLUG constant in each file to target different MCP servers:
    • 'salesforce' - Salesforce integration
    • 'notion' - Notion integration
    • Or any other configured MCP server

Working Examples

1. basic-mcp-client.js - Direct MCP Client

Basic example showing direct MCP server interaction without AI frameworks. What it does:
  • Authenticates with Barndoor
  • Connects to an MCP server
  • Lists available tools and resources
  • Executes basic operations
Requirements:
Run:
Requirements:

2. openai-integration.js - OpenAI + MCP Integration

Complete example showing how to integrate OpenAI’s function calling with MCP tools. What it does:
  • Authenticates with Barndoor
  • Connects to an MCP server (Salesforce by default)
  • Lets OpenAI decide which MCP tools to call
  • Executes the tools and feeds results back to OpenAI
Environment:
Run:
This pattern uses the @modelcontextprotocol/sdk package internally and handles all the complex MCP protocol details for you. Note: While the SDK is written in TypeScript, the current examples are still in JavaScript (.js files) for broader compatibility. You can easily convert them to TypeScript by changing the file extensions to .ts and adding type annotations as needed.