Skip to main content
Glama
zhangwanli09

internal-swagger-mcp

by zhangwanli09

internal-swagger-mcp

Let AI agents query your internal Swagger platform's API docs via MCP.

This server talks to the internal Swagger management platform's private share endpoint (/flow/swagger/share?uid=...), not a public OpenAPI URL.

Tools

Tool

Purpose

swagger_list_sources

List all configured services and their cache status

swagger_search_api

Search APIs by keyword (filterable by method / service)

swagger_get_api_detail

View an API's full parameters and mock example

swagger_refresh_cache

Force-refresh the doc cache (default TTL is 30 minutes)

Related MCP server: mcp-swagger

Connecting MCP clients

Requires Node.js ≥ 18. Swagger sources are always supplied by the client — this server holds no configuration. Pass them in stdio mode via the SWAGGER_SOURCES env var or --sources-file, and in HTTP mode via the X-Swagger-Sources header per request. Use project scope for every client's MCP config so each repo pins its own sources and the config can be committed to git. In the snippets below, <SOURCE> looks like http://your-server/...#/swaggerManage?uid=xxx; if swagger_list_sources works inside the client, the integration is up.

Start in HTTP mode (for deploying on a shared internal host):

npx -y internal-swagger-mcp --http   # defaults to port 3000; override with --port or PORT

Claude Code

Official docs — using --scope project writes to the project root's .mcp.json.

Local (stdio):

claude mcp add swagger --scope project --env SWAGGER_SOURCES='["<SOURCE>"]' -- npx -y internal-swagger-mcp

Remote (HTTP):

claude mcp add --transport http swagger --scope project http://<internal-IP>:3000/mcp --header 'X-Swagger-Sources: ["<SOURCE>"]'

opencode

Official docs — place this in opencode.json at the project root.

Local (stdio):

{
  "mcp": {
    "swagger": {
      "type": "local",
      "command": ["npx", "-y", "internal-swagger-mcp"],
      "environment": {
        "SWAGGER_SOURCES": "[\"<SOURCE>\"]"
      }
    }
  }
}

Remote (HTTP):

{
  "mcp": {
    "swagger": {
      "type": "remote",
      "url": "http://<internal-IP>:3000/mcp",
      "headers": {
        "X-Swagger-Sources": "[\"<SOURCE>\"]"
      }
    }
  }
}

Cursor

Official docs — place this in .cursor/mcp.json at the project root.

Local (stdio):

{
  "mcpServers": {
    "swagger": {
      "command": "npx",
      "args": ["-y", "internal-swagger-mcp"],
      "env": {
        "SWAGGER_SOURCES": "[\"<SOURCE>\"]"
      }
    }
  }
}

Remote (HTTP):

{
  "mcpServers": {
    "swagger": {
      "url": "http://<internal-IP>:3000/mcp",
      "headers": {
        "X-Swagger-Sources": "[\"<SOURCE>\"]"
      }
    }
  }
}

Sources file

When the source list belongs to the project, pass --sources-file <path> instead of pasting the same JSON-as-string into every client's env. Use a path relative to the project root (e.g. ./swagger-sources.json) — it resolves from process.cwd(), which is the project root under project-scoped configs in Claude Code, Cursor, opencode, etc. — so the MCP config can be committed and shared as-is.

swagger-sources.json (each entry is a <SOURCE> URL as defined above):

[
  "<SOURCE_1>",
  "<SOURCE_2>"
]

Each client config then becomes a thin wrapper around the same command:

Claude Code:

claude mcp add swagger --scope project -- npx -y internal-swagger-mcp --sources-file ./swagger-sources.json

opencode (opencode.json):

{
  "mcp": {
    "swagger": {
      "type": "local",
      "command": ["npx", "-y", "internal-swagger-mcp", "--sources-file", "./swagger-sources.json"]
    }
  }
}

Cursor (.cursor/mcp.json) — and other clients using the mcpServers shape:

{
  "mcpServers": {
    "swagger": {
      "command": "npx",
      "args": ["-y", "internal-swagger-mcp", "--sources-file", "./swagger-sources.json"]
    }
  }
}

The file is read once at startup; the source list is fixed for the server's lifetime (clients relaunch on config change anyway). When both --sources-file and SWAGGER_SOURCES are provided, the file wins. The flag is rejected in --http mode because HTTP sources are inherently per-request.

HTTP deployment security

The server binds to 0.0.0.0 by default for easy intranet sharing, and prints a warning if started bare. In production, set at least one of the following:

Environment variable

Effect

MCP_BIND_HOST

Bind address; set to 127.0.0.1 to restrict access to the local host (default 0.0.0.0)

MCP_BEARER_TOKEN

Require an Authorization: Bearer <token> header on every request

MCP_ALLOWED_ORIGINS

Comma-separated Origin allowlist (DNS-rebinding protection)

When MCP_ALLOWED_ORIGINS is set, requests without an Origin header are rejected — except for requests carrying a valid MCP_BEARER_TOKEN, so server-to-server calls still work.

Available Tools

4 tools
swagger_get_api_detailGet Swagger API DetailA
Read-onlyIdempotent

Get full details of a single API interface, including all parameter definitions and response examples.

Parameters:

  • source (required): Service name, from the [service name] returned by swagger_list_sources or swagger_search_api.

  • method (required): HTTP method, e.g. "GET", "POST".

  • path (required): Full interface path, e.g. "/qmAuthorityCenter/systemFun/initPerformanceSolution".

Response includes:

  • Basic interface info (name, description, status, Content-Type).

  • Full definitions for Query / Path / Header / Form / Body parameters (name, type, required, description). Required column: "是" = required, "否" = optional, "?" = platform metadata is ambiguous (checkType=1 with no error message — cross-check with backend code or treat as optional).

  • Sub-fields of nested Object parameters.

  • Response results (Demo JSON + output field table).

  • Mock response field table.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesFull interface path, e.g. /qmAuthorityCenter/systemFun/initPerformanceSolution
methodYesHTTP method.
sourceYesService name, from swagger_list_sources or swagger_search_api results.

Output Schema

ParametersJSON Schema
NameRequiredDescription
nameYes
pathYes
methodYes
statusYes
responsesYes
mockFieldsYes
moduleNameYes
parametersYes
sourceNameYes
contentTypeNo
descriptionYes
bodyRequestDemoNo

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, covering the safety profile. The description adds meaningful behavioral details: what the response includes (basic info, parameter definitions, response examples, mock field table) and explains the 'Required' column semantics ('是' = required, '否' = optional, '?' = ambiguous). This goes beyond annotations without contradicting them.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear first sentence and bullet points for parameters and response sections. While it is longer than necessary, every bullet adds meaningful detail (e.g., required column semantics, response components). It is front-loaded with the primary purpose and avoids fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the output schema exists (so return values are formally specified) and annotations declare safety traits, the description covers the essential operational context: how to specify the target API (source, method, path) and what the response contains. It does not cover error scenarios or rate limits, but these are not critical for a read-only detail operation. The description is sufficiently complete for a well-annotated tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage for all three parameters, with clear explanations (e.g., method enum, path example, source from sibling tools). The description adds little beyond what the schema already provides—the source field is explained more explicitly in the schema, and the path/method examples are duplicated. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Get full details of a single API interface, including all parameter definitions and response examples.' This is a specific verb+resource combination that distinguishes it from sibling tools like swagger_list_sources (listing sources) and swagger_search_api (searching APIs).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly tells the agent that the 'source' parameter comes from the output of swagger_list_sources or swagger_search_api, providing context on when to use this tool. However, it does not explicitly state when not to use it or compare with alternatives, so it falls short of a perfect 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

swagger_list_sourcesList Swagger SourcesA
Read-onlyIdempotent

List all configured Swagger documentation sources and their cache status.

For each service, returns:

  • name: Service name (from config, or auto-read from projectName).

  • fetchedAt: Last cache time (null means not yet loaded).

  • totalInterfaces: Total interface count (shown when loaded).

  • modules: Module list.

Use this before calling swagger_search_api to discover which services are available.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
sourcesYes

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds valuable behavioral nuance beyond the annotations: it explains that fetchedAt may be null (meaning not yet loaded) and that totalInterfaces is only shown when loaded. This clarifies caching behavior and return semantics, which the annotations do not cover. No contradictions with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured: a clear opening sentence, a bulleted list of return fields, and a usage tip. Every sentence serves a purpose, and it is easy to scan.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a parameterless read-only list operation with an output schema, the description is fully complete. It explains what is returned, including edge cases, and how it fits into the broader workflow with sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so the baseline is 4. The description focuses on return fields rather than parameters, which is appropriate. It doesn't need to add parameter details because none exist.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's specific function: 'List all configured Swagger documentation sources and their cache status.' It uses a strong verb ('List') and a specific resource ('Swagger documentation sources'), and effectively distinguishes itself from siblings by noting it should be used before swagger_search_api.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit usage guidance is provided: 'Use this before calling swagger_search_api to discover which services are available.' This tells the agent exactly when to employ this tool and mentions a sibling tool as the subsequent step.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

swagger_refresh_cacheRefresh Swagger CacheA
Idempotent

Force-refetch Swagger documentation data and update the cache.

Use this after the documentation has been updated (interfaces added or modified) to fetch the latest data.

Parameters:

  • source (optional): Service name. Omit to refresh all services.

Returns: Refresh results, including success/failure status and updated interface counts.

ParametersJSON Schema
NameRequiredDescriptionDefault
sourceNoService name. Omit to refresh the cache for all services.

Output Schema

ParametersJSON Schema
NameRequiredDescription
failedNo
refreshedYes

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover idempotence, non-destructiveness, and non-read-only. The description adds context about force-refetch semantics (ignoring cache), that it updates the cache, and the return shape (success/failure and interface counts). This goes beyond annotations, though it doesn't disclose every possible side effect.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and well-structured: it starts with the core action, then provides a usage hint, parameter explanation, and return summary. Every sentence contributes value without redundancy or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simple signature (one optional param), full schema coverage, rich annotations, and existing output schema, the description provides sufficient context for an agent to invoke it correctly. It covers purpose, usage timing, parameter behavior, and return contents.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 100% description coverage for the single 'source' parameter, and the description repeats the schema text almost exactly. No additional meaning is added; the baseline of 3 for full schema coverage applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Force-refetch') and resource ('Swagger documentation data'), and it distinguishes itself from sibling tools (list, search, get detail) by focusing on cache refresh. The action is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use the tool ('after the documentation has been updated...') but does not mention when not to use it or explicitly reference alternatives. This clear context earns a 4, lacking only the exclusion/alternative guidance for a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

swagger_search_apiSearch Swagger APIA
Read-only

Search API interfaces in the internal Swagger documentation.

Searches by keyword across interface name, description, path, and module name. Optionally filter by HTTP method and service.

Parameters:

  • keyword (required): Search keyword, e.g. "登录", "user", "/api/order". Chinese is supported.

  • method (optional): HTTP method filter, e.g. "GET", "POST".

  • source (optional): Service name filter, taken from swagger_list_sources results.

  • include_deprecated (optional): Whether to include deprecated interfaces. Default false.

  • limit (optional): Maximum number of results. Default 20.

Response: Each matched interface includes: service name, module name, HTTP method, full path, interface name, description, status.

Examples:

  • Search login interfaces: keyword="登录"

  • Search POST interfaces: keyword="用户", method="POST"

  • Search within a specific service: keyword="order", source="订单服务"

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of results. Default 20, max 50.
methodNoFilter by HTTP method. Omit to search all methods.
sourceNoRestrict the search to a specific service name (from swagger_list_sources). Omit to search all services.
keywordYesSearch keyword. Matches interface name / description / path / module name. Chinese is supported.
include_deprecatedNoWhether to include deprecated interfaces. Default false.

Output Schema

ParametersJSON Schema
NameRequiredDescription
totalYes
failedNo
keywordYes
resultsYes
truncatedYes

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate readOnlyHint=true and destructiveHint=false, and the description does not contradict them. It adds valuable behavioral context: search scope, default for include_deprecated, default/max limit, and response fields, giving a clear picture beyond the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with sections for parameters, response, and examples. It is lengthy but every sentence earns its place, and the front-loaded summary makes intent immediately clear. No filler or redundant content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (5 params, filters, response fields), the description is complete: it covers search behavior, filters, defaults, response content, and examples. With an output schema present and good annotations, there are no significant gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% (all parameters described in schema). The description still adds meaning beyond schema by providing example keywords, explaining the source origin from swagger_list_sources, and clarifying enum usage (HTTP method). This compensates with practical guidance.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: 'Search API interfaces in the internal Swagger documentation' and specifies the searchable fields (name, description, path, module). This distinguishes it from siblings like swagger_list_sources (lists sources) and swagger_get_api_detail (fetches details).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides concrete usage context through examples and notes that the 'source' parameter comes from swagger_list_sources results. However, it does not explicitly state when to use this tool versus alternatives or mention exclusions, which prevents a perfect score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updatesv1.0.5
    • First observedswagger_get_api_detail
    • First observedswagger_list_sources
    • First observedswagger_refresh_cache
    • First observedswagger_search_api

TDQS

A4.5/5.0
Disambiguation5/5

Each tool serves a distinct function: listing sources, searching APIs, fetching details, and refreshing cache. There is no overlap between these operations.

Naming Consistency5/5

All tool names follow the consistent pattern 'swagger_<verb>_<noun>' with lowercase and underscores. The naming is uniform and predictable.

Tool Count5/5

Four tools are well-scoped for a Swagger documentation MCP server, covering the essential operations without unnecessary bloat.

Completeness5/5

The tool surface covers the full workflow: discover sources, search endpoints, get detailed specs, and refresh cached docs. No obvious gaps exist for the stated purpose.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    Provides LLM-agnostic access to API documentation through MCP and REST endpoints, enabling AI assistants to retrieve, search, and proxy requests to whitelisted APIs across multiple platforms.
    -
  • A
    license
    A
    quality
    D
    maintenance
    Exposes Swagger/OpenAPI API documentation to AI models, enabling exploration, search, and interaction with endpoints, schemas, and execution of API calls.
    14
    13
    2
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zhangwanli09/internal-swagger-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server