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.
Connect SDK
The official Connect SDK — @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
npm install @routemcp/connect-sdk
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
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:
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:
<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 |
| 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 |
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 for code examples in JavaScript and Python.
OpenAPI Spec
The full OpenAPI specification is available for generating custom clients:
# Generate a TypeScript client
npx openapi-generator-cli generate \
-i https://docs.routemcp.io/api-reference/openapi.json \
-g typescript-fetch \
-o ./routemcp-client