> ## Documentation Index
> Fetch the complete documentation index at: https://docs.routemcp.io/llms.txt
> Use this file to discover all available pages before exploring further.

# SDKs & Libraries

> Client libraries and SDKs for the RouteMCP API

## Connect SDK

The official Connect SDK — [`@routemcp/connect-sdk`](https://www.npmjs.com/package/@routemcp/connect-sdk) — lets you embed the provider connection flow in any web app. It ships with both a vanilla JS/TypeScript API and a React component, with no runtime dependencies.

### Installation

<CodeGroup>
  ```bash npm theme={null}
  npm install @routemcp/connect-sdk
  ```

  ```bash pnpm theme={null}
  pnpm add @routemcp/connect-sdk
  ```

  ```bash yarn theme={null}
  yarn add @routemcp/connect-sdk
  ```
</CodeGroup>

**Requirements:** Node >= 20, pnpm >= 9 (for development). No peer dependencies required for vanilla JS usage; React >= 19 required for the React subpath.

***

### Vanilla JS / TypeScript

```ts theme={null}
import { RouteMCPConnect } from '@routemcp/connect-sdk';

const instance = RouteMCPConnect.open({
  token: 'ct_abc123...',         // Connect token from POST /connect/token
  onSuccess: (data) => {
    console.log('Connected:', data);
    // Now you can call the unified API for this user
  },
  onError: (err) => {
    console.error('Connection failed:', err);
  },
  onClose: () => {
    console.log('Modal closed');
  },
});
```

***

### React

Import from the `/react` subpath:

```tsx theme={null}
import { ConnectButton } from '@routemcp/connect-sdk/react';

function MyConnectButton({ token }: { token: string }) {
  return (
    <ConnectButton
      token={token}
      onSuccess={(data) => console.log('Connected:', data)}
      onError={(err) => console.error('Error:', err)}
      onClose={() => console.log('Closed')}
    />
  );
}
```

***

### CDN (no bundler)

For quick prototyping without a build step:

```html theme={null}
<script src="https://connect.routemcp.com/sdk.js"></script>
<script>
  RouteMCP.connect({
    token: "ct_abc123...",
    onSuccess: (connection) => console.log("Connected!", connection),
    onError: (error) => console.error("Connection failed:", error),
    onClose: () => console.log("Widget closed")
  });
</script>
```

***

### Package Details

|                |                                                                                                                      |
| -------------- | -------------------------------------------------------------------------------------------------------------------- |
| **Package**    | [`@routemcp/connect-sdk`](https://www.npmjs.com/package/@routemcp/connect-sdk)                                       |
| **Version**    | `1.0.0`                                                                                                              |
| **License**    | MIT                                                                                                                  |
| **Exports**    | `@routemcp/connect-sdk` (vanilla/TS), `@routemcp/connect-sdk/react`                                                  |
| **Bundle**     | ESM + CJS, fully tree-shakeable (`sideEffects: false`)                                                               |
| **Types**      | Bundled — no `@types/*` needed                                                                                       |
| **Repository** | [github.com/CodisteEmeringTech/router-mcp-connect-sdk](https://github.com/CodisteEmeringTech/router-mcp-connect-sdk) |

***

## REST API

The API follows REST conventions and works with any HTTP client:

* **cURL** — command line
* **fetch / axios** — JavaScript / TypeScript
* **requests / httpx** — Python
* **net/http** — Go
* **HttpClient** — C# / .NET

See the [Authentication Guide](/guides/authentication) for code examples in JavaScript and Python.

## OpenAPI Spec

The full OpenAPI specification is available for generating custom clients:

* **Download**: [openapi.json](/api-reference/openapi.json)
* **Use with**: [openapi-generator](https://openapi-generator.tech/), [Orval](https://orval.dev/), [swagger-codegen](https://swagger.io/tools/swagger-codegen/)

```bash theme={null}
# Generate a TypeScript client
npx openapi-generator-cli generate \
  -i https://docs.routemcp.io/api-reference/openapi.json \
  -g typescript-fetch \
  -o ./routemcp-client
```
