Skip to content

MCP Client

lacause edited this page Mar 29, 2026 · 1 revision

MCP Client — External Server Integration

OCC can consume any external MCP server as a pre-tool, giving your chains access to 10,000+ tools in the MCP ecosystem (GitHub, Slack, PostgreSQL, Brave Search, file systems, databases, etc.).

Quick Start

  1. Create occ-mcp-servers.json at the project root:
{
  "github": {
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-github"],
    "env": {
      "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token"
    }
  }
}
  1. Use mcp_call in any chain:
steps:
  - id: find_repos
    pre_tools:
      - type: mcp_call
        server: "github"
        tool: "search_repositories"
        args:
          query: "{input.topic} stars:>100"
        inject_as: repos
    prompt: |
      Analyze these GitHub repositories: {repos}
    output_var: analysis

Configuration

Server config file

OCC looks for MCP server configs in this order:

  1. MCP_SERVERS_CONFIG env var (custom path)
  2. occ-mcp-servers.json next to the chains directory
  3. ~/.occ/mcp-servers.json (user-level)

Server definition

{
  "server-name": {
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-name"],
    "env": {
      "API_KEY": "your_key"
    }
  }
}
Field Required Description
command Yes Executable to run
args No Command-line arguments
env No Environment variables (merged with process.env)

Pre-tool: mcp_call

pre_tools:
  - type: mcp_call
    server: "server-name"       # Must match a key in occ-mcp-servers.json
    tool: "tool_name"           # Tool exposed by the MCP server
    args:                       # Arguments for the tool
      query: "{input.topic}"    # Supports {variable} interpolation
      max_results: 10
    inject_as: result_var

Popular MCP Servers

Server npm package Tools
GitHub @modelcontextprotocol/server-github search_repositories, create_issue, list_commits, etc.
Brave Search @modelcontextprotocol/server-brave-search web_search, local_search
PostgreSQL @modelcontextprotocol/server-postgres query, list_tables, describe_table
Filesystem @modelcontextprotocol/server-filesystem read_file, write_file, list_directory
Slack @anthropic/mcp-server-slack send_message, list_channels, search_messages
Google Drive @anthropic/mcp-server-gdrive search_files, read_file

See https://github.com/modelcontextprotocol/servers for the full list.

Discovery

REST API

# List all servers and their available tools
curl http://localhost:4242/mcp-servers

Response:

{
  "github": ["search_repositories: Search GitHub repos", "create_issue: Create an issue", ...],
  "brave-search": ["web_search: Search the web", "local_search: Local results"]
}

Health check

curl http://localhost:4242/health

Includes mcpServers field listing configured server names.

Connection Management

  • Servers are connected on first use (lazy initialization)
  • Connections are cached and reused across chain executions
  • Graceful handling when no servers are configured (no errors, just a log message)

Example: Multi-Source Research Chain

name: mcp-research
description: "Research using GitHub + Brave Search + local files"
inputs:
  - name: topic

steps:
  - id: search_web
    pre_tools:
      - type: mcp_call
        server: "brave-search"
        tool: "web_search"
        args: { query: "{input.topic} latest developments" }
        inject_as: web_results
    prompt: "Summarize web findings: {web_results}"
    output_var: web_summary

  - id: search_github
    pre_tools:
      - type: mcp_call
        server: "github"
        tool: "search_repositories"
        args: { query: "{input.topic}" }
        inject_as: github_repos
    prompt: "Analyze relevant repos: {github_repos}"
    output_var: github_summary

  - id: synthesize
    depends_on: [search_web, search_github]
    prompt: |
      Combine these research sources:
      Web: {web_summary}
      GitHub: {github_summary}
    output_var: report

output: report

See Also

Clone this wiki locally