A lightweight, secure API & MCP for accessing and querying Google BigQuery datasets and Tavily search
git clone https://github.com/osushinekotan/bigquery-fastapi-mcp
cd bigquery-fastapi-mcp
uv sync
.env
file with your configurationBQ_PROJECT_ID=your-gcp-project-id
BQ_ALLOWED_DATASETS=dataset1,dataset2,dataset3
BQ_MAX_BYTES_BILLED=1073741824 # 1GB default
TAVILY_API_KEY=your-tavily-api-key
APP_HOST=127.0.0.1
APP_PORT=8000
# Either set the environment variable
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/service-account-key.json
# Or authenticate using gcloud
gcloud auth application-default login
uv run uvicorn app.main:app --reload
or
uv run python -m app.main
The API will be available at http://localhost:8000
API documentation will be available at http://localhost:8000/docs
GET /health/health
- Verify the API is runningGET /bigquery/list_datasets
- List all datasets in the project (filtered by allowed datasets)GET /bigquery/allowed_datasets
- Get configured allowed datasetsGET /bigquery/tables
- List all tables in allowed datasetsGET /bigquery/tables?dataset_id=your_dataset
- List tables in a specific datasetGET /bigquery/tables/{dataset_id}/{table_id}
- Get detailed information about a specific tablePOST /bigquery/query
- Execute a BigQuery queryExample request body:
{
"query": "SELECT * FROM `project.dataset.table` LIMIT 10",
"dry_run": true
}
POST /search/search
- Search the web using TavilyExample request body:
{
"query": "latest developments in AI",
"max_results": 5
}
POST /search/extract
- Extract content from web URLsExample request body:
{
"urls": ["https://example.com/article1", "https://example.com/article2"]
}
https://github.com/tadata-org/fastapi_mcp
Once your FastAPI app with MCP integration is running, you can connect to it with any MCP client supporting SSE, such as Cursor:
Run your application.
In Cursor -> Settings -> MCP, use the URL of your MCP server endpoint (e.g., http://localhost:8000/mcp
) as sse.
Cursor will discover all available tools and resources automatically.
If your MCP client does not support SSE, for example Claude Desktop:
Run your application.
Install mcp-proxy, for example: uv tool install mcp-proxy
.
Add in Claude Desktop MCP config file (claude_desktop_config.json
):
On Windows:
{
"mcpServers": {
"my-api-mcp-proxy": {
"command": "mcp-proxy",
"args": ["http://127.0.0.1:8000/mcp"]
}
}
}
On MacOS:
Find the path to mcp-proxy by running in Terminal: which mcp-proxy
.
{
"mcpServers": {
"my-api-mcp-proxy": {
"command": "/Full/Path/To/Your/Executable/mcp-proxy",
"args": ["http://127.0.0.1:8000/mcp"]
}
}
}
Find the path to mcp-proxy by running in Terminal: which uvx
.
{
"mcpServers": {
"my-api-mcp-proxy": {
"command": "/Full/Path/To/Your/uvx",
"args": ["mcp-proxy", "http://127.0.0.1:8000/mcp"]
}
}
}
{
"mcpServers": {
"my-api-mcp-proxy": {
"env": {},
"args": [
"http://127.0.0.1:8000/mcp"
],
"command": "mcp-proxy"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.