Connecting to the MCP Server
Swytchcode’s Model Context Protocol (MCP) server powers the intelligent layer of code generation, method discovery, and workflow orchestration. You can access it programmatically to interact with your API or SDK context via official tools or your own custom clients.
MCP Server Endpoint
MCP requests are served from:
https://api-v2.swytchcode.com/v2/mcp/mcp
Authentication
- To connect, you must include a valid Bearer token (also called the MCP key) in the request header.
- MCP keys can be retrieved from the Swytchcode web plugin interface
- All MCP requests must include the following header:
Authorization: Bearer <YOUR_MCP_KEY>
⚠️ Note: MCP keys are usage-limited and tied to your Swytchcode plan. Most premium plans include access by default. If you need more keys or higher limits, please contact sales.
What the MCP Server Offers
The MCP server is organized into three powerful categories:
Type | Description |
---|---|
Resources | List of available libraries (OpenAPI, Postman, or SDKs) |
Templated Resources | Detailed metadata on available methods and workflows per library |
Tools | Utilities for code generation, spec introspection, and more |
This structured context is what powers code generation, AI suggestions, and testing capabilities in the Swytchcode platform.
Connecting with an MCP Client
You can connect to the MCP server using any client that supports streaming HTTP with headers. Here are a couple of examples:
Using MCP Inspector
MCP Inspector is a CLI-based debug and inspection tool for MCP servers.
To connect:
npx @modelcontextprotocol/inspector
Then configure it as follows:
Setting | Value |
---|---|
Proxy Session Token | Paste the session token shown in your terminal |
Transport Type | Streamable HTTP |
MCP URL | https://api-v2.swytchcode.com/v2/mcp/mcp |
Authentication Header Name | authorization |
Bearer Token | Your Swytchcode MCP key |
Click Connect to browse and interact with Swytchcode’s MCP-powered Resources, Templates, and Tools.
Using the TypeScript Client
We maintain an official TypeScript MCP client for building integrations, automating workflows, or embedding MCP capabilities into your tools Explore here: https://github.com/Swytchcode/mcp-clients
Its a simple, reusable wrapper for the Model Context Protocol (MCP) SDK client, making it easy to connect, list tools/resources, call tools, and read resources from any Node.js or TypeScript project.
Installation
npm install# oryarn
Environment Setup
Set your MCP API key in your .env file:
MCP_KEY=your_api_key_here
Run
npm start# oryarn run start