Apidays India 2025

8-9 October

Chancery Pavilion Hotel, Bengaluru

Apidays India 2025

8-9 October

Chancery Pavilion Hotel, Bengaluru

Curate, Validate and Publish an MCP Server from an OpenAPI Spec with Specmatic Genie

By Jaydeep Kulkarni

Share this page

In this walk-through we’ll show exactly how we took the Postman APIs, curated the set of API end points we want to expose via MCP, validate those end point work the way we want and then wrapped into an MCP server using Specmatic Genie — without writing a single line of code. We’ll demonstrate how an OpenAPI specification can be turned into a fully operational MCP server, complete with a virtual test service, Docker image, and a client integration (Claude Desktop). Below we’ll reproduce the process step-by-step, explain what’s happening under the hood, and share best practices so you can reproduce it reliably for your own agentic workflows.

Why this matters: agentic workflows and tool-wrapping

If you’re designing agentic workflows — automation pipelines that rely on AI agents to perform steps like creating workspaces, provisioning collections, or calling third-party APIs — you want those agents to use stable, discoverable tools. Wrapping APIs (like Postman APIs) as MCP tools provides a clean, standardized interface your agent can call. Doing this manually requires writing server glue, authorization handling, tool metadata, and containerization. Specmatic Genie automates all of that from an OpenAPI specification.

What we start with

  • An OpenAPI specification that describes the APIs you want to expose (Postman APIs in our example: workspaces, collections, billing).
  • Specmatic Genie (web UI) to ingest and enrich the OpenAPI spec.
  • A target environment to run the resulting MCP server (Docker) and an MCP client to test integration (Claude Desktop).
OpenAPI spec shows endpoints for workspaces and collections

Step 1 — Upload the OpenAPI spec and let Genie enrich it

Upload your OpenAPI spec into Specmatic Genie. Genie performs two important operations immediately:

  1. Validation — the spec is validated for syntax and basic structure.
  2. Enrichment — Genie analyzes each endpoint and prepares metadata so endpoints can be mapped to MCP tools automatically (parameters, required fields, descriptions, authentication requirements, etc.).

During enrichment you’ll see progress indicators and a short wait while Genie prepares virtual tooling for each endpoint. Once complete, Genie presents a summary view showing all the endpoints it discovered and a short description for each.

Spec upload progress and enrichment stage in Genie

Step 2 — Curate the endpoints you want to expose

Not every API in the spec should be exposed to your agents. For example, billing or account administration endpoints are often sensitive and unnecessary for routine workflows. Genie makes pruning trivial: you can instruct it to remove endpoints using natural language. I removed the accounts/billing endpoint to keep the MCP server focused on workspaces and collections.

Genie UI after removing accounts endpoint from the spec

After curation, you have a neat subset of APIs that you intend to wrap as MCP tools. This is your “toolset” that your agent will interact with.

Step 3 — Test endpoints with the virtual service

Before publishing anything, test the endpoints in Genie. One of the most powerful features here is the virtual service Genie spins up automatically from your OpenAPI spec. Every endpoint is mounted as an MCP tool and calls to those tools are handled by this virtual service. This creates a highly realistic simulation of the real API behavior without contacting the live third-party service yet.

Genie's virtual service showing logs of an API request

In our demo we did two quick checks:

  • Create a workspace. We asked Genie how to create one — it indicated required fields like name, type, description, and about. I told it to create a workspace called Genie with type personal. The virtual service showed the request that would be made and returned a simulated ID.
  • Create a collection. We asked Genie for the required parameters and then instructed it to create a collection named payments under the Genie workspace. Logs showed the workspace ID being passed in and a collection response returned.
Log entry showing collection created under workspace Genie

Testing with Genie’s virtual service lets you iterate quickly; you can validate shapes, parameter mapping, and error behavior, and tweak what’s exposed without touching production APIs or credentials.

Step 4 — Publish the MCP server (automated Docker image)

Once you’re satisfied with the endpoints and tests, move to the MCP tab in Genie. Genie will produce a Docker image that packages the MCP server with the curated tools and the necessary runtime to serve them. Several key things are displayed for you:

  • The Docker image name and tag that will be published.
  • Instructions on how to pull and run the image.
  • Any environment variables inferred from the OpenAPI spec (for Postman, Genie detected that an API key is required and flagged it as an environment variable to pass into the container).
  • The default endpoint and port used by the MCP server so you can configure clients.
MCP tab showing Docker image name and run instructions

Click publish. Genie handles building and pushing the Docker image to the registry. Monitor the publishing workflow; when complete you’ll have an image tag you can pull and run locally or in your infrastructure.

Publishing status indicates MCP server created and pushed to registry

Step 5 — Run your MCP server container

Pull the image and run it with the required environment variables. In our case we supplied:

  • POSTMAN_BASE_URL — the base URL for Postman APIs
  • POSTMAN_API_KEY — the API key to authenticate real Postman calls

The container exposes an MCP endpoint (default port was shown in Genie). I kept the default host port mapping and launched the container. Once the container was running, the MCP server was live and ready to accept MCP client integrations.

Terminal showing Docker image pulled and run command with env vars

Step 6 — Integrate and test with an MCP client (Claude Desktop)

To prove the end-to-end flow, we integrated the MCP server with Cloud Desktop. Claude Desktop accepts MCP servers via a config file (cloud-desktop-config.json). We added an entry pointing Claude Desktop to my locally running MCP server (e.g., http://localhost:1990/mcp/sc).

Cloud Desktop showing Postman MCP listed in tools

After launching Claude Desktop, the Postman MCP tools appeared in the tool list. We invoked one of the tools via Claude (the AI client) and asked it to create a workspace. The MCP server handled the request, forwarded it to the real Postman APIs using the API key we provided, and a new workspace named Specmatic appeared in our Postman account.

Postman showing newly created workspace 'Specmatic' in UI

This proves the full lifecycle: OpenAPI -> Genie’s enrichment and virtual testing -> Dockerized MCP server -> Client integration -> Actual API invocation.

Best practices and tips

  • Curate aggressively: Only expose endpoints your agents need. Avoid exposing admin or billing endpoints unless required.
  • Use the virtual service extensively: Test normal and error conditions before connecting live credentials.
  • Store secrets securely: When running the Docker container in production, inject API keys via secure secret managers or environment injection mechanisms rather than hard-coding them into Docker commands.
  • Version your MCP images: Use semantic tagging so agents and clients can pin to a stable MCP server version.
  • Document tool contracts: Even though Genie enriches the spec, maintain a short README showing which tools are available and sample calls for downstream developers and agents.

Conclusion

Specmatic Genie makes it straightforward to publish an MCP server from an OpenAPI spec with minimal effort. The workflow we followed — upload, enrich, curate, test with the virtual service, publish as Docker, run, and integrate with a client — is repeatable and safe. For agentic workflows that need reliable access to third-party APIs, this approach saves developer time and reduces error-prone boilerplate.

If you maintain APIs or build agent-driven automation, consider adopting a spec-first flow and tools like Genie to streamline the publishing and tooling process. The result is a robust, discoverable MCP toolset your agents can rely on.

FAQ

Q: Do I need to write code to create the MCP server?

A: No. Specmatic Genie generates the MCP server and a Docker image from your OpenAPI spec, so you don’t need to write server glue code. You may still write custom logic later if you want behavior beyond what the spec describes.

Q: Can I exclude endpoints from the generated MCP server?

A: Yes. Genie allows you to curate the spec and remove endpoints using a simple UI and natural-language instructions, so you can control which tools are exposed to agents.

Q: Is there a way to test without connecting to production APIs?

A: Genie creates a virtual service that simulates real API calls based on the OpenAPI spec. Use it to validate requests, responses, and interactions before supplying real credentials.

Q: How do I handle authentication and secrets?

A: Genie infers required auth parameters (e.g., API keys) from the spec and documents them as environment variables. For running containers, inject these secrets via your platform’s secret manager or environment variable injection — avoid committing them to source control.

Q: Can the generated MCP server be used with other clients besides Claude Desktop?

A: Yes. The MCP server is a standard MCP endpoint (HTTP) and can be integrated with any MCP-compatible client or service. Claude Desktop was used only as a convenient demo client.

Q: Does this workflow support AsyncAPI or event-driven specs?

A: The demo focused on OpenAPI. If you have AsyncAPI or other protocol specs, check Genie’s documentation for support and recommended patterns for generating tooling for event-driven endpoints.

Related Posts

arazzo openapi asyncapi demo with specmatic

By Hari Krishnan

Authoring & Leveraging Arazzo Spec for OpenAPI & AsyncAPI Workflow Testing

Seamlessly test both synchronous and asynchronous APIs in realistic workflows before they ever hit production! Discover how combining OpenAPI and AsyncAPI specs can simplify complex
Read More
Arazzo API workflow demo

By Hari Krishnan

Visual Workflow Mocking and Testing with Specmatic and Arazzo API Specifications

Table of Contents API workflow testing with Arazzo and Specmatic: Visual authoring, workflow mocking, and backend verification Here we'll walk through a practical approach to
Read More
Specmatic vs Microcks comparison

By Hari Krishnan

Specmatic vs Microcks

When evaluating tools for API testing and mocking, the choice often comes down to understanding not just what each tool can do, but how their
Read More
jaydeep aws lambda

By Jaydeep Kulkarni

AWS Lambda Data Pipeline Testing using LocalStack with Specmatic

Table of Contents Mastering Testing AWS Lambda Functions with LocalStack and Specmatic With fast-evolving data ecosystems, building reliable and scalable data products is essential. One
Read More
api days revised 1920x1080

By John

New features and a BIG Announcement! Specmatic is bringing apidays to India!

In the past few months, we have launched a flurry of exciting features, presented at several global conferences and onboarded several new team members. We
Read More
Speakers presenting on API Governance at tech conference.

Update: See how Specmatic is transforming API testing & development

We've been hard at work, rolling out exciting new features and sharing the power of Specmatic and Contract Driven Development around the globe! Let's explore
Read More

By Joel Rosario

Build Apps from API specs using AI: Self-Correcting Contract-Driven Agentic Workflows with Specmatic

Harnessing the Power of API Specifications for Robust Microservices  Modern microservice architecture hinges on precise and dependable communication between services. This is where API specifications
Read More

OpenAPI Examples Simplified: Visualize and Generate Domain-Specific Test Data​

Streamlining API Development: An Interactive Guide to Example Generation and Validation using Specmatic  A robust, streamlined approach to API development is crucial for maintaining efficiency,
Read More

By Hari Krishnan

Pact’s Dependency Drag​: Why Consumer-Driven Contracts Don’t Support Parallel Development

Exploring the challenges and limitations of using Pact for contract testing in a microservices environment.  In the domain of microservices, ensuring seamless communication between different
Read More

By Naresh Jain

OpenAPI’s Broken Tooling: Roundtrip Fidelity Failure with CodeGen and DocGen​

Exploring the Strengths and Weaknesses of Automated API Development  Maintaining well-documented and reliable APIs is essential for any microservices development pipelines. At the heart of
Read More