
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
A Model Context Protocol server that provides access to BigQuery. This server enables LLMs to inspect database schemas and execute queries.
Features:
This server can be deployed in multiple ways to suit different use cases:
uvx or uv for local use with Claude Desktop or other MCP clientsAll deployment methods support both stdio (for local MCP clients) and HTTP/SSE (for cloud/remote access) transports.
The server implements three tools:
execute-query: Executes a SQL query using BigQuery dialect
query (string) - SELECT SQL query to executelist-tables: Lists all tables in the BigQuery database
dataset.table)describe-table: Describes the schema of a specific table
table_name (string) - Fully-qualified table name (e.g., my_dataset.my_table)Once connected to an MCP client (like Claude Desktop), you can ask questions like:
analytics.user_events table"analytics.user_events table"The LLM will automatically use the appropriate tools to answer your questions.
The server can be configured either with command line arguments or environment variables.
| Argument | Environment Variable | Required | Description |
|---|---|---|---|
--project | BIGQUERY_PROJECT | Yes | The GCP project ID. |
--location | BIGQUERY_LOCATION | Yes | The GCP location (e.g. europe-west4, us-central1). |
--dataset | BIGQUERY_DATASETS | No | Only take specific BigQuery datasets into ***ation. Several datasets can be specified by repeating the argument (e.g. --dataset my_dataset_1 --dataset my_dataset_2) or by joining them with a comma in the environment variable (e.g. BIGQUERY_DATASETS=my_dataset_1,my_dataset_2). If not provided, all datasets in the project will be ***ed. |
--key-file | BIGQUERY_KEY_FILE | No | Path to a service account key file for BigQuery. If not provided, the server will use Application Default Credentials (ADC). |
--transport | MCP_TRANSPORT | No | Transport type: stdio (default), http, or sse. Use stdio for local MCP clients, http/sse for cloud deployments. |
--port | PORT or MCP_PORT | No | Port number for HTTP/SSE transport (default: 8080). Ignored when using stdio transport. |
Installing via Smithery
To install BigQuery Server for Claude Desktop automatically via Smithery:
bashnpx -y @smithery/cli install mcp-server-bigquery --client claude
Claude Desktop
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
Development/Unpublished Servers Configuration
json"mcpServers": { "bigquery": { "command": "uv", "args": [ "--directory", "{{PATH_TO_REPO}}", "run", "mcp-server-bigquery", "--project", "{{GCP_PROJECT_ID}}", "--location", "{{GCP_LOCATION}}" ] } }
Published Servers Configuration
json"mcpServers": { "bigquery": { "command": "uvx", "args": [ "mcp-server-bigquery", "--project", "{{GCP_PROJECT_ID}}", "--location", "{{GCP_LOCATION}}" ] } }
Remote Server Configuration (SSE)
To connect to a remotely deployed server (e.g., on Cloud Run):
json"mcpServers": { "bigquery": { "transport": "sse", "url": "https://your-server-url.run.app/messages" } }
Replace {{PATH_TO_REPO}}, {{GCP_PROJECT_ID}}, {{GCP_LOCATION}}, and https://your-server-url.run.app with the appropriate values.
The server can be deployed as a Docker container for cloud environments (e.g., Google Cloud Run, Kubernetes).
Docker images are automatically built and published to Docker Hub via GitHub Actions. You can use the pre-built images or build your own.
Using Pre-built Images
bash# Pull the latest image from Docker Hub docker pull timoschd/mcp-server-bigquery:latest # Or pull a specific version docker pull timoschd/mcp-server-bigquery:v0.3.0
Building Your Own Image
bashdocker build -t mcp-server-bigquery . # or with Podman podman build -t mcp-server-bigquery .
The repository includes a GitHub Actions workflow that automatically builds and publishes multi-architecture images (amd64/arm64) to Docker Hub. See .github/workflows/README.md for setup instructions.
Running with Docker
Local stdio mode:
bashdocker run -it \ -e BIGQUERY_PROJECT=your-project-id \ -e BIGQUERY_LOCATION=us-central1 \ timoschd/mcp-server-bigquery:latest
HTTP/SSE mode (for cloud deployment):
bashdocker run -p 8080:8080 \ -e BIGQUERY_PROJECT=your-project-id \ -e BIGQUERY_LOCATION=us-central1 \ -e MCP_TRANSPORT=http \ -e PORT=8080 \ timoschd/mcp-server-bigquery:latest
With service account authentication:
bashdocker run -p 8080:8080 \ -v /path/to/key.json:/app/secrets/key.json \ -e BIGQUERY_PROJECT=your-project-id \ -e BIGQUERY_LOCATION=us-central1 \ -e BIGQUERY_KEY_FILE=/app/secrets/key.json \ -e MCP_TRANSPORT=http \ timoschd/mcp-server-bigquery:latest
Using Podman Compose/ Docker Compose
A podman-compose.yml file is provided for easy local development:
bash# Copy and customize the environment file cp .env.example .env # Start the service podman-compose up
OR
bashdocker-compose up
The compose file supports configurable environment variables:
PORT: External port mapping (default: 8085)BIGQUERY_PROJECT: Your GCP project IDBIGQUERY_LOCATION: BigQuery location/regionBIGQUERY_KEY_FILE: Optional path to service account keyDeploying to Google Cloud Run
Manual deployment:
bash# Build and push to Google Container Registry gcloud builds submit --tag gcr.io/YOUR_PROJECT_ID/mcp-server-bigquery # Deploy to Cloud Run gcloud run deploy mcp-server-bigquery \ --image gcr.io/YOUR_PROJECT_ID/mcp-server-bigquery \ --platform managed \ --region us-central1 \ --set-env-vars BIGQUERY_PROJECT=your-project-id,BIGQUERY_LOCATION=us-central1,MCP_TRANSPORT=http \ --allow-unauthenticated \ --port 8080
Automated deployment with GitHub Actions:
An example GitHub Actions workflow is provided for automated deployments. See .github/workflows/README.md for detailed setup instructions.
bash# Copy the example workflow cp .github/workflows/deploy-cloud-run.yml.example .github/workflows/deploy-cloud-run.yml # Configure GitHub Secrets (see workflow README for details) # Then push to trigger deployment git push origin main
To prepare the package for distribution:
Increase the version number in pyproject.toml
Sync dependencies and update lockfile:
bashuv sync
bashuv build
This will create source and wheel distributions in the dist/ directory.
bashuv publish
Note: You'll need to set PyPI credentials via environment variables or command flags:
--token or UV_PUBLISH_TOKEN--username/UV_PUBLISH_USERNAME and --password/UV_PUBLISH_PASSWORDSince MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the https://github.com/modelcontextprotocol/inspector.
Using MCP Inspector (stdio mode)
You can launch the MCP Inspector via https://docs.npmjs.com/downloading-and-installing-node-js-and-npm with this command:
bashnpx @modelcontextprotocol/inspector uv --directory {{PATH_TO_REPO}} run mcp-server-bigquery --project {{GCP_PROJECT_ID}} --location {{GCP_LOCATION}}
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
Testing HTTP/SSE mode
For testing the HTTP/SSE transport locally:
bash# Start the server in HTTP mode uv run mcp-server-bigquery --project {{GCP_PROJECT_ID}} --location {{GCP_LOCATION}} --transport http --port 8080 # In another terminal, test the health endpoint curl http://localhost:8080/health
Viewing Logs
The server logs to both stdout and /tmp/mcp_bigquery_server.log. When running in Docker:
bash# View container logs docker logs <container-id> # Or access the log file docker exec <container-id> cat /tmp/mcp_bigquery_server.log
The server supports two transport modes:
GET /: Health check endpointGET /health: Health check endpointGET /messages: SSE connection for receiving eventsPOST /messages: Send tool invocation requests--transport http or MCP_TRANSPORT=httpConnecting MCP Clients to Remote SSE Server
To connect an MCP client (like Claude Desktop or Windsurf) to a remotely deployed server using SSE transport:
Configuration example (e.g., in mcp_config.json or Claude Desktop config):
json{ "mcpServers": { "bigquery": { "disabled": false, "transport": "sse", "url": "https://your-server-url.run.app/messages" } } }
Replace https://your-server-url.run.app with your actual deployment URL:
https://mcp-server-bigquery-xxxxx-uc.a.run.apphttps://bigquery-mcp.yourdomain.comhttp://localhost:8080The /messages path is required for SSE communication.
The server supports multiple authentication methods:
Service Account Key File (Recommended for production):
bash--key-file /path/to/service-account-key.json # or export BIGQUERY_KEY_FILE=/path/to/service-account-key.json
Application Default Credentials (ADC):
gcloud auth application-default loginFor questions, issues, or feedback:
MIT
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务