Skip to main content
Connect an AI tool, such as Claude Code or Codex, to the MCP server built into Bytebase. It takes three steps:
  1. Add Bytebase to your AI tool.
  2. Sign in to Bytebase in your browser.
  3. Try a prompt.
In Bytebase, the Integration > MCP page shows the setup for each tool with your URL filled in. This guide adds the other ways to set up each tool, and what to check when a tool does not connect.

Before you start

  • External URL. The external URL must be configured. In this guide, <external_url> is that URL with no slash at the end, such as https://bytebase.example.com. Your AI tool connects to <external_url>/mcp.
  • An address your AI tool can reach. The AI tool connects from the computer it runs on. http://localhost:8080 works only for a tool on the same computer as Bytebase. For any other address, use https://. Some tools, such as Claude Code and Gemini CLI, can refuse to sign in over plain http://.
  • Access policy. The workspace access policy must not be Disabled. A new workspace starts at Read-only.
  • Your own Bytebase account. You sign in as yourself. Your AI tool can do only what your Bytebase permissions and the access policy allow.

Claude Code

Run in your terminal:
Claude Code adds Bytebase for the project folder you ran the command in. To use Bytebase in every project, add --scope user:
Sign in. In Claude Code, run /mcp, select bytebase, and choose Authenticate. In the browser window that opens, sign in to Bytebase and click Allow access. The Code tab in Claude Desktop uses this setup too.
Share the setup with your team. Add --scope project to the command. Claude Code writes a .mcp.json file in the project’s root folder, which you can commit. Each person still signs in as themselves.Add it without the command. Create .mcp.json in your project’s root folder:
.mcp.json
The next time you start Claude Code in that folder, it asks you to approve the server.Add it from JSON.
Sign in from your shell. Run claude mcp login bytebase. On a computer with no browser, such as over SSH, add --no-browser. Claude Code prints the sign-in URL. Open it on your own computer, then paste the address your browser ends on back into the terminal.
  • Run claude mcp get bytebase to see the server’s status.
  • /mcp does not list bytebase: you added it in another project folder. Run the command again in this folder, or with --scope user.
  • The command fails with MCP server bytebase already exists: run claude mcp remove bytebase, then add it again.
  • The browser does not open: copy the URL Claude Code shows and open it yourself.
  • For anything else, see Troubleshooting.
See also the Claude Code MCP documentation.

Claude Desktop

Claude Desktop has two ways to reach Bytebase. Pick one by where your Bytebase runs: Tools on your computer, and Claude Desktop through the bytebase-mcp npm package, connect to Bytebase from inside your network. A Claude connector connects from Anthropic's servers on the internet, so it needs a public https address on port 443.

Add Bytebase to the config file

Claude Desktop starts the @bytebase/bytebase-mcp npm package on your computer, and the package connects to your Bytebase. This requires Node.js 20 or later on the computer that runs Claude Desktop. The package has not been tested on Windows yet.
  1. In Claude Desktop, click your name in the lower-left corner, then Settings > Desktop app > Extensions > Edit config. A folder opens. If your version has no Edit config, go to the file yourself:
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows, normally: %APPDATA%\Claude\claude_desktop_config.json
  2. From that folder, open claude_desktop_config.json in a text editor.
  3. Add the bytebase entry and save the file. BYTEBASE_URL is your external URL without /mcp. Where the entry goes depends on what the file already holds:
    Make this the whole file:
    claude_desktop_config.json
  4. Quit Claude Desktop and reopen it. Closing the window is not enough.
  5. In the browser window that opens, sign in to Bytebase and click Allow access.
  6. To check, click + in the chat box and select Connectors. bytebase is listed with its tools.

Use a connector instead

A connector needs no Node.js and no file to edit. Claude connects to Bytebase from Anthropic’s servers, not from your computer, so:
  • Bytebase must be reachable from the internet. An instance behind a firewall or a VPN does not connect.
  • The external URL must use https:// on port 443. Claude refuses a URL with another port, such as https://bytebase.example.com:8443.
Add the connector:
  1. In Claude Desktop or on claude.ai, go to Customize > Connectors.
  2. Click + Add, then Add custom connector.
  3. Enter a name, such as Bytebase, and the URL <external_url>/mcp.
  4. Follow the prompts. When Claude sends you to Bytebase, sign in and click Allow access.
On a Team or Enterprise plan, an Owner adds the connector first, under Organization settings > Connectors. Each member then clicks Connect on it under Customize > Connectors. See Anthropic’s custom connectors guide.
Claude Desktop writes a log for each server it starts. Bytebase’s log is mcp-server-bytebase.log, in ~/Library/Logs/Claude on macOS and %APPDATA%\Claude\logs on Windows.
  • Claude Desktop says it cannot read the config file: see A config file is not valid.
  • The log says npx was not found: see npx is not found.
  • No browser window opens: the first start can take a minute, because npx downloads the package. If it still does not open, find the sign-in URL in the log and open it yourself.
  • A chat that was open before you signed in has no Bytebase tools: start a new chat.
  • A session in the Code tab has no Bytebase tools: add Bytebase to Claude Code, which the Code tab also uses.
  • Do not put <external_url>/mcp in the config file as a url entry. The file is for servers that Claude Desktop starts with a command.
  • A connector does not connect: check that Bytebase is reachable from the internet on port 443.

Codex

Run in your terminal:
The Codex CLI, the ChatGPT desktop app, and the Codex IDE extension share this setup, so you add Bytebase once. Sign in. If no browser window opened, run:
In the browser window that opens, sign in to Bytebase and click Allow access.
In the ChatGPT desktop app:
  1. Open Settings, then select MCP servers.
  2. Select Add server.
  3. Enter the name bytebase, choose Streamable HTTP, and enter the URL <external_url>/mcp.
  4. Save the server, then select Restart.
  5. Select Authenticate on the server.
In the IDE extension: open the gear menu, select MCP servers, and follow the same steps. The last button there is Restart extension.In the config file: add this to ~/.codex/config.toml, then run codex mcp login bytebase.
~/.codex/config.toml
On a computer with no browser: run codex mcp login bytebase --no-browser. Codex prints the sign-in URL. Open it on your own computer, then paste the address your browser ends on back into the terminal.
  • Run codex mcp list. It shows each server, whether it is enabled, and its sign-in state.
  • In Codex, type /mcp to see the servers that are connected.
  • For anything else, see Troubleshooting.
See also the Codex MCP documentation.

Copilot CLI

Run in your terminal:
Sign in. Start Copilot CLI. If no browser window opens, run /mcp auth bytebase. In the browser window, sign in to Bytebase and click Allow access.
In Copilot CLI: enter /mcp add. In the form, set Server Name to bytebase, Server Type to HTTP, and URL to <external_url>/mcp. Press Ctrl+S to save.In the config file: add Bytebase to ~/.copilot/mcp-config.json. If the file already has mcpServers, add bytebase inside it.
~/.copilot/mcp-config.json
  • Run copilot mcp list in your terminal, or /mcp show bytebase in Copilot CLI, to see the server’s status.
  • For anything else, see Troubleshooting.
See also the Copilot CLI MCP documentation.

Gemini CLI

Run in your terminal:
Gemini CLI adds Bytebase for the project folder you ran the command in. To use Bytebase in every project, add --scope user:
Sign in. In Gemini CLI, run /mcp auth bytebase. In the browser window that opens, sign in to Bytebase and click Allow access.
In the settings file: add Bytebase to ~/.gemini/settings.json for every project, or to .gemini/settings.json in one project folder. If the file already has other settings, add mcpServers beside them.
~/.gemini/settings.json
  • Run gemini mcp list to see the server’s status.
  • Sign-in fails for a Bytebase on a private network address: Gemini CLI blocks sign-in to private addresses unless you allow it. See allowPrivateNetwork in the Gemini CLI documentation below.
  • For anything else, see Troubleshooting.
See also the Gemini CLI MCP documentation.

VS Code

In Bytebase, go to Integration > MCP, open the VS Code tab, and click Install in VS Code. VS Code opens and asks you to install the server. Sign in. The first time VS Code uses Bytebase, it asks you to sign in. In the browser window that opens, sign in to Bytebase and click Allow access.
From your terminal:
From the Command Palette:
  1. Run MCP: Add Server.
  2. Choose HTTP and enter <external_url>/mcp.
  3. Enter the name bytebase.
  4. Choose where to save it. Global makes Bytebase available in every workspace.
In a config file. VS Code reads two formats:
GitHub Copilot in VS Code and Copilot CLI share this file.
~/.copilot/mcp-config.json
VS Code’s documentation recommends the Copilot file for new setups and marks the VS Code file format as deprecated. See its MCP configuration reference.
  • Nothing happens when you click Install in VS Code: VS Code is not installed on this computer, or your browser blocked the link. Use the code --add-mcp command instead.
  • Run MCP: List Servers from the Command Palette and select bytebase. Choose Show Output to read the server’s log. Choose Authenticate, when it is offered, to sign in.
  • For anything else, see Troubleshooting.

Other tools

Any AI tool that connects to a remote MCP server over HTTP and signs in with OAuth can use Bytebase. Add this to the tool’s MCP config. The format can differ by tool, so check the tool’s own documentation.
If your tool can only start MCP servers as local commands, use the @bytebase/bytebase-mcp npm package. It requires Node.js 20 or later. BYTEBASE_URL is your external URL without /mcp.

Sign in

Bytebase signs your AI tool in with OAuth. Every tool ends on the same Bytebase page, Authorization Request. The page names your AI tool and the workspace, shows the workspace access policy as it is now, and lists what the session may and may not do. Click Allow access to connect. Older versions label the button Allow.
Authorization Request page under the Read-only access policy
If the page says MCP access is turned off, see The sign-in page says MCP access is turned off. Your AI tool stores the token and refreshes it automatically. The token works only at your external URL followed by /mcp. It is not an API credential: the rest of the Bytebase API refuses it. Use a service account for API access.

Try a prompt

Ask your AI tool something that only reads, which works under Read-only:
  • “List all projects in my Bytebase instance”
  • “Show me the schema of the <database> database”
To let your AI tool propose or make changes, a Workspace Admin or Workspace DBA switches the access policy to Read-write. Before a statement that may write runs, Bytebase asks you to confirm it in your AI tool. A tool that cannot show that question runs the statement without asking. See Read-write changes. For a full walkthrough, follow the Connect an AI Tool to Bytebase with MCP tutorial.

Troubleshooting

The MCP page says the External URL is not set

On Integration > MCP, the commands show a placeholder in place of your URL, and copy and install are off. Ask a workspace admin to configure the external URL, then reload the page.

The browser does not open for sign-in

Start the sign-in yourself: Sign-in ends by sending your browser to an address on the computer that runs your AI tool. If the tool runs on another computer, such as over SSH, use claude mcp login bytebase --no-browser or codex mcp login bytebase --no-browser.

Your AI tool cannot reach Bytebase

On the computer that runs your AI tool, run:
Bytebase answers with the address your AI tool must use:
  • No answer, or an error. That computer cannot reach Bytebase. Check the URL, your VPN, and your firewall.
  • resource is not the URL you gave your AI tool. Add Bytebase again with the URL in resource. Bytebase binds each sign-in to the external URL, so another address for the same instance does not work.
  • The URL starts with http:// and is not localhost. Some tools refuse to sign in. Serve Bytebase over https:// and update the external URL.
  • You use a Claude connector. Claude connects from Anthropic’s servers, not from your computer. See Use a connector instead.

The sign-in page says MCP access is turned off

Sign-in page when MCP access is turned off The workspace access policy is Disabled, so no AI tool can connect. Ask a Workspace Admin or Workspace DBA to set the access policy to Read-only or Read-write, then sign in again.

Bytebase refuses a request after sign-in

Your AI tool can do only what both the access policy and your own permissions allow. Under Read-only, it cannot change anything. See What each mode allows.

A config file is not valid

A JSON config file with one mistake is not read at all. Check these first:
  • A comma between entries, and none after the last one.
  • A closing } for every {.
  • Only one mcpServers in the file.
To find a mistake, run this with the path to your file. It prints Valid JSON, or the line of the first mistake:
The Claude Desktop section shows where a new entry goes in a file that already has content.

npx is not found

This applies to tools that start the @bytebase/bytebase-mcp package, such as Claude Desktop.
  1. Run node --version in your terminal. If the command is not found, or the version is below 20, install Node.js 20 or later.
  2. Check that the package runs and reaches Bytebase:
    The output includes "bytebase": true when the package reaches your Bytebase.
  3. If the command works in your terminal but your AI tool still cannot find npx, the tool does not see the same Node.js as your terminal. This can happen when Node.js was installed with a version manager such as nvm. Run which npx, then give the tool the full path and the folder it is in:
    <npx_folder> is the output of which npx without the final /npx.

Sign-in stopped working after a change

If you change the external URL, existing tokens stop working at /mcp. Refreshing does not help, because the refreshed token is still bound to the old URL. Remove Bytebase from each AI tool, add it again with the new URL, then sign in again.
Upgrading from 3.21 or earlier: each AI tool must sign in again. Tokens issued before 3.22.0 are not bound to the external URL, so refreshing them fails with invalid_grant. To recover, remove Bytebase from your AI tool, add it again, then sign in again. If your AI tool still has a working session, you can instead ask it to run reauthorize.
To remove Bytebase, run claude mcp remove bytebase, codex mcp remove bytebase, copilot mcp remove bytebase, or gemini mcp remove bytebase. In Claude Desktop, delete the bytebase entry from the config file, or remove the connector.