Skip to content

Instantly share code, notes, and snippets.

@WebCloud
Created July 28, 2025 21:22
Show Gist options
  • Save WebCloud/3e75ae968ca82a3f5a132587b4745c88 to your computer and use it in GitHub Desktop.
Save WebCloud/3e75ae968ca82a3f5a132587b4745c88 to your computer and use it in GitHub Desktop.
MCP example
const mcpClient = new MCPClient({
servers: {
myServer: {
url: new URL('https://my-mcp-server.com'),
authorization: {
redirectUris: ['http://localhost:3000/oauth/callback'],
scopes: ['read', 'write'],
onAuthorizationNeeded: async (serverUrl, authUrl, context) => {
// Redirect user to authUrl, then call:
await mcpClient.provideAuthorizationCode('myServer', code, state);
},
},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment