Shipfox

Use Your Own MCP Server

Give an agent step the tools of your own MCP server.

Use mcp_servers to give an agent step the tools of an MCP server. Use it when Shipfox has no integration for the service.

Each entry in mcp_servers has one of these two fields:

  • command: The runner starts the server when the step starts. The runner stops the server when the step ends.
  • url: You run the server. The runner connects to it.

The example uses command to start mongodb-mcp-server. The agent uses it to read a database. For a different server, change the command, the arguments, and the environment variables.

Before you begin

  • Complete onboarding in Shipfox.
  • Create a secret named MONGO_URI. Put the connection string of the database in it. Use a database user that can only read.
  • Let the runner connect to the database. For MongoDB Atlas, add the public IP address of the runner to the IP access list of the project.

Add the MCP server to the agent step

Create .shipfox/workflows/investigate-slow-queries.yml:

# yaml-language-server: $schema=https://www.shipfox.io/docs/workflow.schema.json
name: Investigate slow queries
runner: shipfox

triggers:
  manual:
    source: manual

jobs:
  investigate:
    steps:
      - prompt: |
          Find the slowest queries on the orders collection.
          Explain why each one is slow and suggest an index.
          Do not change any data.
        mcp_servers:
          # The agent sees each tool as <name>__<tool>, for example mongodb__find.
          mongodb:
            # The runner starts this program without a shell.
            # command and args cannot contain workflow expressions.
            command: npx
            args: [-y, mongodb-mcp-server@1.2.0]
            # env values can read secrets. Shipfox masks secrets in the step log.
            env:
              MDB_MCP_CONNECTION_STRING: ${{ secrets.MONGO_URI }}
              MDB_MCP_READ_ONLY: "true"
            # include is optional. Without it, the agent gets all tools of the server.
            include: [find, aggregate, list-collections, explain]

Push the file to the default branch of the project.

Verify the result

Start the workflow

Select Run, then open the new run.

Inspect the agent step

Open the agent step. Confirm that the agent calls a mongodb tool, such as find.

Adapt it to your workflow

To...Change this
Start a different serverCopy the command, args, and env from the documentation of the server or from your .mcp.json file.
Connect to a server that you runUse url and headers instead of command. See Connect to a server that you run.
Use two servers in one stepAdd a second entry under mcp_servers. Give each entry a different name.
Use a server and an integrationAdd integrations to the same step. See Agent integration fields.
Start the server in your own imageRun the job in a container. See Run a job in a container.
See all fieldsSee MCP server fields.

Connect to a server that you run

Use url when the server already runs, for example in your network. The runner connects to the server when the step starts.

# yaml-language-server: $schema=https://www.shipfox.io/docs/workflow.schema.json
name: Answer from the internal docs
runner: shipfox

triggers:
  manual:
    source: manual

jobs:
  answer:
    steps:
      - prompt: Find the runbook for a failed deploy and summarize it.
        mcp_servers:
          internal_docs:
            # url must be an http or https URL. It cannot contain workflow expressions.
            url: https://docs-mcp.example.com/mcp
            # headers values can read secrets. Shipfox masks secrets in the step log.
            headers:
              Authorization: Bearer ${{ secrets.DOCS_MCP_TOKEN }}
  • Make sure that the server accepts connections from the runner.
  • The server must use the Streamable HTTP transport.
  • To authenticate, send a token in headers.

If the step fails before the agent starts

The step fails with An MCP server is unavailable in these cases:

  • The server stops, or it does not answer at its url.
  • The server does not answer within 120 seconds.
  • The server does not list a tool from include.
  • The server lists a tool that the agent cannot use.

When a command server does not start, the message shows the last part of its error output.

To fix the problem:

  • Make sure that the command exists on the runner or in the image of the job container.
  • Make sure that the runner can reach the url. Make sure that the server accepts the headers.
  • Compare the names in include with the tool names in the documentation of the server.
  • A full tool name has at most 64 characters. If a name is too long, give the server a shorter name or leave the tool out of include.
Was this page helpful?
Edit this page on GitHub

On this page