### Clone Repository and Install Dependencies Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md Clone the api-docs-mcp repository and install its dependencies using pnpm. ```bash git clone https://github.com/EliFuzz/api-docs-mcp.git cd api-docs-mcp pnpm install ``` -------------------------------- ### Build the Project Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md Build the api-docs-mcp project after installing dependencies. ```bash pnpm build ``` -------------------------------- ### Start API Docs MCP Server Locally Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md Command to start the API Docs MCP server locally after configuring the API_SOURCES environment variable. The server communicates via standard input/output. ```bash pnpm start ``` -------------------------------- ### API Docs Tool Output Example Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md An example of the output from the `api_docs` tool, showing structured data for GitHubGraphQL and PetstoreAPI sources. ```json { "sources": [ { "sourceName": "GitHubGraphQL", "resources": [ { "resourceName": "getUser", "resourceType": "query", "resourceDescription": "Fetch a user by username" }, { "resourceName": "createIssue", "resourceType": "mutation", "resourceDescription": "Create a new issue in a repository" } ] }, { "sourceName": "PetstoreAPI", "resources": [ { "resourceName": "getPetById", "resourceType": "GET", "resourceDescription": "Find pet by ID" }, { "resourceName": "addPet", "resourceType": "POST", "resourceDescription": "Add a new pet to the store" } ] } ] } ``` -------------------------------- ### API Search Tool Output Example Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md An example of the output from the `api_search` tool, detailing the request, response, and error structure for the `getUser` query from GitHubGraphQL. ```json { "details": [ { "sourceName": "GitHubGraphQL", "resources": [ { "resourceName": "getUser", "resourceType": "query", "resourceDescription": "Fetch a user by username", "details": { "request": "{ username: String! }", "response": "{ id: ID!, login: String!, name: String }", "error": "{ message: String!, code: Int! }" } } ] } ] } ``` -------------------------------- ### FileSource Example for Local gRPC Proto File Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md Configure a local gRPC proto file using FileSource. Specify the name and the path to the proto file. ```json { "name": "MyGrpcFile", "path": "/path/to/your/service.proto", "type": "grpc" } ``` -------------------------------- ### FileSource Example for Local GraphQL Schema Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md Configure a local GraphQL schema using FileSource. Specify the name and the path to the schema file. ```json { "name": "MyGraphQLFile", "path": "/path/to/your/schema.graphql", "type": "gql" } ``` -------------------------------- ### UrlSource Example for Remote OpenAPI Endpoint Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md Configure a remote OpenAPI endpoint using UrlSource. Specify the name, URL, and method. ```json { "name": "PetstoreAPI", "method": "GET", "url": "https://petstore.swagger.io/v2/swagger.json", "type": "api" } ``` -------------------------------- ### UrlSource Example for Remote gRPC Endpoint Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md Configure a remote gRPC endpoint using UrlSource. Specify the name and URL, including the protocol. ```json { "name": "MyGrpcService", "url": "grpc://localhost:9090", "type": "grpc" } ``` -------------------------------- ### FileSource Example for Local OpenAPI Schema Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md Configure a local OpenAPI JSON schema using FileSource. Specify the name and the path to the schema file. ```json { "name": "MyOpenAPIFile", "path": "/path/to/your/openapi.json", "type": "api" } ``` -------------------------------- ### UrlSource Example for Remote GraphQL Endpoint Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md Configure a remote GraphQL endpoint using UrlSource. Specify the name, URL, method, and any necessary headers. ```json { "name": "GitHubGraphQL", "method": "POST", "url": "https://api.github.com/graphql", "headers": { "Authorization": "Bearer YOUR_GITHUB_TOKEN" }, "type": "gql" } ``` -------------------------------- ### Set API_SOURCES Environment Variable in Shell Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md Configure the API sources by exporting the API_SOURCES environment variable in your shell before running the server. This example shows how to define GraphQL and REST API sources. ```bash export API_SOURCES='[{"name": "MyGraphQLFile", "path": "./example/fixtures/graphql/graphql-schema.graphql", "type": "gql"}, {"name": "PetstoreAPI", "method": "GET", "url": "https://petstore.swagger.io/v2/swagger.json", "type": "api"}]' ``` -------------------------------- ### API Docs Tool Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md The `api_docs` tool provides a list of all available API methods from the configured sources. It can optionally filter by a specific source name. ```APIDOC ## API Docs Tool ### Description Get a list of all available API methods from configured sources. You can optionally filter the results by providing a source name. ### Input Schema ```typescript { sourceName?: string; // The name of the API source (e.g., "GitHub") from MCP configuration environment variables. If not provided, docs from all sources will be returned. } ``` ### Output Schema ```typescript { sources: Array<{ sourceName: string; // The name of the source API resources: Array<{ resourceName: string; // The name of the API resource resourceType: string; // The type of the API resource (e.g., "POST", "GET", "mutation", "query") resourceDescription: string; // A brief description of the API resource }>; }>; } ``` ### Output Example ```json { "sources": [ { "sourceName": "GitHubGraphQL", "resources": [ { "resourceName": "getUser", "resourceType": "query", "resourceDescription": "Fetch a user by username" }, { "resourceName": "createIssue", "resourceType": "mutation", "resourceDescription": "Create a new issue in a repository" } ] }, { "sourceName": "PetstoreAPI", "resources": [ { "resourceName": "getPetById", "resourceType": "GET", "resourceDescription": "Find pet by ID" }, { "resourceName": "addPet", "resourceType": "POST", "resourceDescription": "Add a new pet to the store" } ] } ] } ``` ``` -------------------------------- ### API Search Tool Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md The `api_search` tool allows you to find detailed documentation for a specific API method by its resource name. ```APIDOC ## API Search Tool ### Description Search for a specific API method by name and get its full definition, including request, response, and error details. ### Input Schema ```typescript { resourceName: string; // The exact resource name of the API method to search for that was provided in `api_docs` tool's output } ``` ### Output Schema ```typescript { details: Array<{ sourceName: string; // The name of the source API resources: Array<{ resourceName: string; // The name of the resource resourceType: "query" | "mutation" | "subscription"; // The type of GraphQL resource resourceDescription: string; // Context or description of the resource details: { request?: string; // The request structure or input parameters for the API method response?: string; // The response structure or output format for the API method error?: string; // Error information or error handling details for the API method }; }>; }>; } ``` ### Output Example ```json { "details": [ { "sourceName": "GitHubGraphQL", "resources": [ { "resourceName": "getUser", "resourceType": "query", "resourceDescription": "Fetch a user by username", "details": { "request": "{ username: String! }", "response": "{ id: ID!, login: String!, name: String }", "error": "{ message: String!, code: Int! }" } } ] } ] } ``` ``` -------------------------------- ### API Docs Tool Output Schema Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md Defines the output schema for the `api_docs` tool, listing available API methods categorized by source and resource type. ```typescript { sources: Array<{ sourceName: string; // The name of the source API resources: Array<{ resourceName: string; // The name of the API resource resourceType: string; // The type of the API resource (e.g., "POST", "GET", "mutation", "query") resourceDescription: string; // A brief description of the API resource }>; }>; } ``` -------------------------------- ### API Search Tool Input Schema Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md Defines the input schema for the `api_search` tool, requiring the exact `resourceName` to find detailed documentation. ```typescript { resourceName: string; // The exact resource name of the API method to search for that was provided in `api_docs` tool's output } ``` -------------------------------- ### Configure API_SOURCES in mcp.json Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md Alternatively, set the API_SOURCES environment variable within the MCP configuration file (`mcp.json`) for MCP execution. This JSON snippet demonstrates the structure for defining API sources. ```json "api-docs-mcp": { "type": "stdio", "command": "npx", "args": [ "api-docs-mcp" ], "env": { "API_SOURCES": "[{\"name\": \"MyGraphQLFile\", \"path\": \"./example/fixtures/graphql/graphql-schema.graphql\", \"type\": \"gql\"}, {\"name\": \"PetstoreAPI\", \"method\": \"GET\", \"url\": \"https://petstore.swagger.io/v2/swagger.json\", \"type\": \"api\"}]" } } ``` -------------------------------- ### API Search Tool Output Schema Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md Defines the output schema for the `api_search` tool, providing detailed information including request, response, and error structures for a specific API method. ```typescript { details: Array<{ sourceName: string; // The name of the source API resources: Array<{ resourceName: string; // The name of the resource resourceType: "query" | "mutation" | "subscription"; // The type of GraphQL resource resourceDescription: string; // Context or description of the resource details: { request?: string; // The request structure or input parameters for the API method response?: string; // The response structure or output format for the API method error?: string; // Error information or error handling details for the API method }; }>; }>; } ``` -------------------------------- ### API Docs Tool Input Schema Source: https://github.com/elifuzz/api-docs-mcp/blob/main/README.md Defines the input schema for the `api_docs` tool. Optionally accepts a `sourceName` to filter results from a specific API source. ```typescript { sourceName?: string; // The name of the API source (e.g., "GitHub") from MCP configuration environment variables. If not provided, docs from all sources will be returned. } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.