> ## Documentation Index
> Fetch the complete documentation index at: https://palmier.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP

> Create and manage your MCP servers

MCP (Model Context Protocol) servers enable your agents to interact with external services and tools.

Palmier agent acts as a MCP client that support connecting to both local and remote MCP servers of your choice.

We fully support and manage OAuth and token-based connection to your MCP servers, unlocking agent's capabilities to integrate with your resources.

### MCP Types

Palmier supports two main types of MCP servers, each with different connection methods and authentication options:

### Local MCP Servers

**Local servers** run as processes inside the sandbox environment via stdio and cannot be accessed outside of the sandbox. You define the commands which are executed on sandbox start up.

**Characteristics:**

* Command-based execution (e.g., `npx @example/mcp-server`)
* Runs locally for enhanced security
* Direct process communication
* No network connectivity required
* Environment variables or argument flags for configuration

**Best for:**

* Sensitive operations requiring local access
* Development and testing environments
* Services that don't require remote API access

### Remote MCP Servers

**Remote servers** connect over HTTP/HTTPS and support multiple transport protocols and authentication methods.

**Transport Protocols:**

* **SSE (Server-Sent Events)** - Real-time streaming communication
* **HTTP Streamable** - HTTP-based streaming for continuous data flow

**Authentication Methods:**

* **OAuth** - Secure OAuth 2.0 flow for services like Linear, Sentry.
* **PAT (Personal Access Token)** - API token-based authentication

**Characteristics:**

* HTTPS endpoint connection
* Managed authentication flows
* Automatic token refresh for OAuth
* Managed personal tokens via Secrets

**Best for:**

* Cloud-based services and APIs
* Services requiring OAuth authentication
* Production environments with managed authentication

## MCP Server Library

The MCP Server Library contains a curated collection of pre-configured MCP servers for popular services across different categories:

<CardGroup cols={2}>
  <Card title="Development & Code Management" icon="code">
    GitHub, Linear, Notion
  </Card>

  <Card title="Project Management" icon="tasks">
    Asana, Monday.com
  </Card>

  <Card title="Communication" icon="comments">
    Slack
  </Card>

  <Card title="Payment & Analytics" icon="chart-line">
    Stripe, Sentry
  </Card>

  <Card title="Databases" icon="database">
    MongoDB, Neon, Supabase
  </Card>

  <Card title="AI & Analysis" icon="brain">
    Deepwiki, Sequentialthinking
  </Card>

  <Card title="Web Automation" icon="globe">
    Playwright
  </Card>

  <Card title="Cloud Services" icon="cloud">
    AWS CloudWatch Logs
  </Card>
</CardGroup>

## Setting Up MCP Servers

### Using Pre-configured Servers

<Steps>
  <Step title="Browse the MCP Server Library">
    Use the search functionality to find the service you need
  </Step>

  <Step title="Add MCP to Your List">
    If the remote MCP servers require OAuth, we will redirect you to authorize. Otherwise, the MCP will be added to your list.
  </Step>

  <Step title="Configure Setting">
    Navigate to your MCP and configure the settings:

    * For MCP servers that require PAT, you will need to add the header `Authorization: Bearer ${{ secrets.YOUR_KEY }}`
    * You can also configure the environment variables or commands for your local MCP servers, or extra headers for your remote MCP servers.
  </Step>

  <Step title="Add MCP to your agent">
    Once the MCP setting is saved, you can now configure your custom agents to add these MCP servers as tools.
  </Step>
</Steps>

### Creating Custom MCP Servers

You can also create your own custom MCP servers:

<AccordionGroup>
  <Accordion title="Basic Configuration">
    1. **Click "Add MCP Server"** from the library interface
    2. **Configure Basic Settings**:
       * **Name** - Unique identifier for your MCP server
       * **Description** - Brief description of what the server provides
       * **Type** - Choose between Local or Remote server
  </Accordion>

  <Accordion title="Local Server Setup">
    **Local Server Configuration**:

    * **Command** - The command to start your MCP server (e.g., `npx @example/mcp-server`)
    * **Environment Variables** - Add any required environment variables
  </Accordion>

  <Accordion title="Remote Server Setup">
    **Remote Server Configuration**:

    * **Base URL** - The HTTP endpoint for your MCP server
    * **Authentication** - Configure OAuth, Token Auth, or No Auth.
    * **Transport** - Select transport protocol (SSE, httpstreamable)

    <Note>
      Test your remote server endpoint before adding it to ensure connectivity.
    </Note>
  </Accordion>
</AccordionGroup>

## Authentication Methods

<AccordionGroup>
  <Accordion title="OAuth Flow">
    For services requiring OAuth (like Linear):

    1. Select "OAuth" as the authentication method
    2. You'll be redirected to the service for authentication
    3. Complete the OAuth flow in your browser
    4. Return to Palmier to complete the setup
  </Accordion>

  <Accordion title="Token Authentication">
    For API token-based services:

    1. Obtain an API token from the service
    2. Add the token to your secrets
    3. Select "Token Auth" as the authentication method
    4. Enter your secret reference to your token: `${{ secrets.TOKEN }}`
  </Accordion>

  <Accordion title="Local Servers">
    We handle the secure connection between the agent and the sandbox, so no authentication is required on your end.

    If your local server requires secret keys, you should store them in Secrets and reference it.
  </Accordion>
</AccordionGroup>

## Best Practices

### Agent Specialization Over Generalization

<Warning>
  **Avoid: Generic Agents with Many MCP Servers**

  * Don't create a single agent with 10+ MCP servers
  * Agents become overwhelmed with too many capabilities
  * Context switching between different tools reduces effectiveness
  * Harder to maintain and debug
</Warning>

<Tip>
  **Recommended: Specialized Agents with Focused MCP Abilities**

  * Create multiple specific agents with 2-5 relevant MCP servers each
  * Each agent should have a clear, focused purpose
  * Better performance and more reliable results
  * Easier to maintain and optimize
</Tip>

### Example Agent Configurations

<CardGroup cols={3}>
  <Card title="Development Agent" icon="code">
    **Focus**: Code management, issue tracking, error monitoring

    * GitHub MCP server
    * Linear MCP server
    * Sentry MCP server
  </Card>

  <Card title="Content Management Agent" icon="file-text">
    **Focus**: Documentation, team communication

    * Notion MCP server
    * Slack MCP server
  </Card>

  <Card title="Business Operations Agent" icon="briefcase">
    **Focus**: Financial operations, project management

    * Stripe MCP server
    * Asana MCP server
    * Monday.com MCP server
  </Card>
</CardGroup>

## Troubleshooting

### Common Issues

<AccordionGroup>
  <Accordion title="Connection Failures">
    * Verify API tokens are valid and not expired
    * Check network connectivity to remote servers
    * Ensure local MCP server packages are properly installed
  </Accordion>

  <Accordion title="Authentication Errors">
    * Re-authenticate OAuth connections if expired
    * Verify token permissions match required scopes
    * Check environment variables are properly set
  </Accordion>

  <Accordion title="Performance Issues">
    * Reduce the number of MCP servers per agent
    * Check for API rate limiting
    * Monitor server response times
  </Accordion>
</AccordionGroup>

### Getting Help

<CardGroup cols={2}>
  <Card title="Documentation" icon="book">
    Check the "View Documentation" link for each MCP server for detailed setup instructions
  </Card>

  <Card title="Testing" icon="flask">
    Test connections individually before combining servers and monitor agent logs for detailed error messages
  </Card>
</CardGroup>
