API Connect

API Connect

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only

Develop, Deploy & Test MCP Tools with IBM API Studio

By Madhavan Kidambi posted yesterday

  

As Agentic AI applications become increasingly complex and scale rapidly, they drive the expansion of tools and data needed to provide models with the right context. The Model Context Protocol (MCP) is an open standard designed to streamline how applications deliver contextual information to AI models.   In many ways, MCP often builds upon existing APIs. APIs standardized the way the capabilities, data & functions are exposed to users. MCP standardizes how these capabilities and functions are made available to agents and LLMs. 

MCP allows the AI models to connect to different data sources and tools by exposing the executable functions in a standard way through MCP tools, resources & servers. Here is brief of common MCP primitives

  1. MCP Tool - Tools are a powerful primitive in the MCP that enable servers to expose executable functionality to clients .

  2. MCP Server - An MCP server, or Model Context Protocol server, acts as a bridge between AI models and various tools or data sources, enabling them to interact in a standardized way.

Develop MCP Tools using API Studio

IBM API Studio offers a unified development experience for API Developers to author APIs, Policies, as well as Tests. It can be connected to a version control system to enable working at scale across distributed teams. 

API Studio now allows the developers to create the MCP tools from their existing APIs (for example from the Open API specification). The generated tools are packaged into an MCP Server, which can then be downloaded from Studio. The MCP server is a standalone executable that exposes the tools to MCP clients and AI Agents.

This flow is explained below

MCP Tools and Open API 

MCP Tools specification defines the schema for MCP tools. MCP clients relies on this specification to understand the tools and their signatures.

Likewise, Open API specification helps define REST APIs in a standard way. 

Both these specifications are similar in many ways.

  1. Use structured schemas to define interfaces.

  2. The parameter specifications are nearly identical, with both supporting typed arguments, required/optional flags, and human-readable descriptions. This makes them equally suitable for automated tooling and documentation generation.

  3. Above all , both serves as contract between system making integrations reliable.

Following diagram illustrates the similarities between the Open API and MCP tools specifications.

Such similarities between these specifications allows for a structured approach to generate MCP tools definition from Open API documents by API Studio.

Generate MCP Tools

Users can now see “Create MCP Tool” action in the Open API specification page in Studio. Clicking on this button allows users to convert a subset of Resource/Methods to MCP tools.

Clicking on “Next” will allow the users to enter the metadata like name, descriptions of the MCP Server Configuration and the MCP Tool

On clicking create, two files are generated - one each for MCP tools definition and MCP Server Configuration.

MCP Tools file contains the details on the tools and a reference to the API spec. The generated tools definitions can further be enhanced by the users.

kind: MCPTool
apiVersion: api.webmethods.io/beta
metadata:
  name: Hogwarts MCP Tools
  namespace: default
  version: '1.0'
  tags: []
  description: ''
spec:
  tools:
    - name: getSpells
      description: >
        Retrieve a comprehensive list of spells from the wizarding world
      inputSchema:
        type: object
        properties:
          Name:
            description: Filter spells by name (partial match supported)
            x-parameter-location: query
            type: string
          Type:
            description: Filter spells by their magical type or category
            x-parameter-location: query
            type: string
            enum:
              - None
              - Charm
              - Conjuration
              - Spell
            example: Charm
          Incantation:
            description: Filter spells by their spoken incantation
            x-parameter-location: query
            type: string
      x-original-path: /Spells
    - name: getWizards
      description: >
        Retrieve a list of wizards and witches from the magical world
      inputSchema:
        type: object
        properties:
          FirstName:
            description: Filter wizards by first name (partial match supported)
            x-parameter-location: query
            type: string
          LastName:
            description: Filter wizards by last name (partial match supported)
            x-parameter-location: query
            type: string
      x-original-path: /Wizards
  api:
    $path: /Project-Wizard-World/apis/Hogwarts-spec.json

An MCP Server file contains the MCP Server specific configurations and details needed for servers to make the backend API calls (MCP Server to API) .

kind: MCPServerConfig
apiVersion: api.webmethods.io/beta
metadata:
  name: Hogwarts MCP Server
  namespace: default
  version: '1.0'
  tags: []
spec:
  tools:
    - $ref: default:Hogwarts MCP Tools:1.0
  server:
    mode: stdio
  log-level: INFO

Design time governance - Linting

API Studio supports linting for MCP Tools and MCP Server configurations, allowing for capturing issues during the development cycle. For instance, tool description is an important field of the MCP tool that will help the AI agents to understand what the tool offers and when to use it. Linting feature mandates a proper description for the MCP Tools.

Create MCP Server

The MCP tools should be packaged and deployed in an MCP Server. This MCP Server exposes the tools to the clients and also acts as a proxy to the backend APIs.

 

The user can use the “Download MCP server” action to downloads the MCP server archive.

The archive contains the following

  1. An executable MCP server.

  2. Resources like the Open API definition , MCP Tools definition and the MCP Server configurations that are generated in the previous step.

The user needs to provide appropriate permissions before running the server.

Integrating with MCP Client

The server can then be configured in MCP Clients like Claude desktop, Co-pilot or any supported agents.

A sample to configure the MCP server to Claude Desktop is given below

(In case of Claude desktop on Mac, this needs to be configured at the file /Users/<>/Library/Application Support/Claude/claude_desktop_config.json)

{
    "mcpServers": {
        "Hogwarts": {
        "command": "/<Path_To_unzipped>/Hogwarts-Server/mcp-server"
        }
    }
}

Restart the Claude desktop and test if the tools we created are listed.

Your agent is now ready to leverage the tools provided by the MCP server. 

Whats next??

Subsequent updates of API Studio will provide

  • Support for IBM API Connect for authoring & testing of APIs & MCP assets.
  • Support for Streamable HTTP in MCP server
  • Support for Tools Annotations.
  • Support for Predefined Prompts
  • Low Code Development i.e Form view for MCP too
0 comments
65 views

Permalink