-
Notifications
You must be signed in to change notification settings - Fork 422
feat(mcp): add mcp-server package #7517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2025 Clerk, Inc. | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| <p align="center"> | ||
| <a href="https://clerk.com?utm_source=github&utm_medium=clerk_mcp_server" target="_blank" rel="noopener noreferrer"> | ||
| <picture> | ||
| <source media="(prefers-color-scheme: dark)" srcset="https://images.clerk.com/static/logo-dark-mode-400x400.png"> | ||
| <img src="https://images.clerk.com/static/logo-light-mode-400x400.png" height="64"> | ||
| </picture> | ||
| </a> | ||
| <br /> | ||
| <h1 align="center">@clerk/mcp-server</h1> | ||
| </p> | ||
|
|
||
| <div align="center"> | ||
|
|
||
| [](https://clerk.com/discord) | ||
| [](https://clerk.com/docs?utm_source=github&utm_medium=clerk_mcp_server) | ||
| [](https://twitter.com/intent/follow?screen_name=ClerkDev) | ||
|
|
||
| [Changelog](https://github.com/clerk/javascript/blob/main/packages/mcp-server/CHANGELOG.md) | ||
| · | ||
| [Report a Bug](https://github.com/clerk/javascript/issues/new?assignees=&labels=needs-triage&projects=&template=BUG_REPORT.yml) | ||
| · | ||
| [Request a Feature](https://feedback.clerk.com/roadmap) | ||
| · | ||
| [Get Help](https://clerk.com/contact/support?utm_source=github&utm_medium=clerk_mcp_server) | ||
|
|
||
| </div> | ||
|
|
||
| ## Overview | ||
|
|
||
| Connect to Clerk's remote MCP (Model Context Protocol) server from any MCP-compatible client like Claude Desktop. This package provides a thin wrapper that proxies stdio communication to Clerk's hosted MCP server at `https://mcp.clerk.com`. | ||
|
|
||
| ## Quick Start | ||
|
|
||
| Run directly with npx: | ||
|
|
||
| ```bash | ||
| npx @clerk/mcp-server | ||
| ``` | ||
|
|
||
| ## Usage with MCP configuration | ||
|
|
||
| Add the following to your MCP configuration file: | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "clerk": { | ||
| "command": "npx", | ||
| "args": ["-y", "@clerk/mcp-server"] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Node.js 18 or higher | ||
| - An MCP-compatible client (e.g., Claude Desktop, Cursor, etc.) | ||
|
|
||
| ## How It Works | ||
|
|
||
| This package acts as a bridge between stdio-based MCP clients and Clerk's remote MCP server: | ||
|
|
||
| 1. Your MCP client (e.g., Claude Desktop) communicates with this package via stdio | ||
| 2. This package forwards requests to `https://mcp.clerk.com/mcp` via HTTP | ||
| 3. Responses are proxied back to your client | ||
|
|
||
| ## Support | ||
|
|
||
| You can get in touch with us in any of the following ways: | ||
|
|
||
| - Join our official community [Discord server](https://clerk.com/discord) | ||
| - On [our support page](https://clerk.com/contact/support?utm_source=github&utm_medium=clerk_mcp_server) | ||
|
|
||
| ## Contributing | ||
|
|
||
| We're open to all community contributions! If you'd like to contribute in any way, please read [our contribution guidelines](https://github.com/clerk/javascript/blob/main/docs/CONTRIBUTING.md) and [code of conduct](https://github.com/clerk/javascript/blob/main/docs/CODE_OF_CONDUCT.md). | ||
|
|
||
| ## License | ||
|
|
||
| This project is licensed under the **MIT license**. | ||
|
|
||
| See [LICENSE](https://github.com/clerk/javascript/blob/main/packages/mcp-server/LICENSE) for more information. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| { | ||
| "name": "@clerk/mcp-server", | ||
| "version": "0.0.0", | ||
| "description": "Connect to Clerk's remote MCP server via stdio", | ||
| "homepage": "https://clerk.com/", | ||
| "bugs": { | ||
| "url": "https://github.com/clerk/javascript/issues" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/clerk/javascript.git", | ||
| "directory": "packages/mcp-server" | ||
| }, | ||
| "license": "MIT", | ||
| "author": "Clerk", | ||
| "type": "module", | ||
| "main": "dist/cli.js", | ||
| "bin": { | ||
| "clerk-mcp": "dist/cli.js" | ||
| }, | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "scripts": { | ||
| "build": "tsup --env.NODE_ENV production", | ||
| "clean": "rimraf ./dist", | ||
| "dev": "tsup --watch", | ||
| "format": "node ../../scripts/format-package.mjs", | ||
| "format:check": "node ../../scripts/format-package.mjs --check", | ||
| "lint": "eslint src" | ||
| }, | ||
| "devDependencies": {}, | ||
| "engines": { | ||
| "node": ">=20" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { spawn } from 'node:child_process'; | ||
|
|
||
| const MCP_SERVER_URL = 'https://remote-mcp-server-staging.colinclerk.workers.dev/mcp'; | ||
|
|
||
| const args = ['-y', 'mcp-remote@latest', MCP_SERVER_URL, ...process.argv.slice(2)]; | ||
| const child = spawn('npx', args, { stdio: 'inherit' }); | ||
|
|
||
| child.on('exit', code => process.exit(code ?? 0)); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "moduleResolution": "Bundler", | ||
| "module": "ESNext", | ||
| "sourceMap": false, | ||
| "strict": true, | ||
| "esModuleInterop": true, | ||
| "skipLibCheck": true, | ||
| "allowJs": true, | ||
| "target": "ES2022", | ||
| "emitDeclarationOnly": true, | ||
| "declaration": true, | ||
| "declarationMap": true, | ||
| "outDir": "dist", | ||
| "resolveJsonModule": true, | ||
| "declarationDir": "dist/types" | ||
| }, | ||
| "include": ["src"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { defineConfig } from 'tsup'; | ||
|
|
||
| import { name, version } from './package.json'; | ||
|
|
||
| export default defineConfig(overrideOptions => { | ||
| const isProd = overrideOptions.env?.NODE_ENV === 'production'; | ||
|
|
||
| return { | ||
| entry: ['src/cli.ts'], | ||
| dts: false, | ||
| clean: true, | ||
| bundle: true, | ||
| sourcemap: true, | ||
| format: 'esm', | ||
| define: { | ||
| PACKAGE_NAME: `"${name}"`, | ||
| PACKAGE_VERSION: `"${version}"`, | ||
| __DEV__: `${!isProd}`, | ||
| }, | ||
| banner: { | ||
| js: '#!/usr/bin/env node', | ||
| }, | ||
| }; | ||
| }); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
URL mismatch with documentation.
The hardcoded URL points to a staging server (
remote-mcp-server-staging.colinclerk.workers.dev), but the README documents the production URL ashttps://mcp.clerk.com. This inconsistency will cause the package to connect to the wrong server.🤖 Prompt for AI Agents