MCP Server for Vertex AI Search
MCP server to search private data in Vertex AI Search.
Tools
search: Search for Vertex AI Search and returns result chunks. Returns a dictionary with a "response" key. The value of "response" is a list of dictionaries, each containing the title of the source document and the extracted content chunk. Example:
{
"response": [
{
"title": "Sample Document Title 1",
"content": "Extracted text segment from the document."
},
{
"title": "Sample Document Title 2",
"content": "Another extracted text segment."
}
]
}
Prerequisites
- Install uv from Astral or the GitHub README
- Install Python 3.13 using
uv python install 3.13 - Create a Vertex AI Search app
i. Official Document
Configuration
Add the following to your server configuration:
{
"mcpServers": {
"vais-mcp": {
"command": "uvx",
"args": ["vais-mcp@latest"],
"env": {
"GOOGLE_CLOUD_PROJECT_ID": "<google_cloud_project_id>",
"VAIS_ENGINE_ID": "<vais_engine_id>"
}
}
}
}
If you want to run with Docker, you will need to obtain a service account key beforehand and mount its path into the Docker container, configured within your mcp.json:
{
"mcpServers": {
"vais-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GOOGLE_CLOUD_PROJECT_ID",
"-e",
"VAIS_ENGINE_ID",
"-e",
"USE_MOUNTED_SA_KEY",
"-v",
"/your/local/path/to/sa-key.json:/app/secrets/sa-key.json:ro",
"mrmtsntr/vais-mcp:latest"
],
"env": {
"GOOGLE_CLOUD_PROJECT_ID": "<google_cloud_project_id>",
"VAIS_ENGINE_ID": "<vais_engine_id>",
"USE_MOUNTED_SA_KEY": "true"
}
}
}
}
Note: When using Docker as shown above, ensure the local path /your/local/path/to/sa-key.json correctly points to your service account key file.
Note: You can find the Vertex AI Search engine ID in the app url.
https://console.cloud.google.com/gen-app-builder/locations/<location>/engines/<engine_id>/overview/system...
Optional Parameters
You can configure the following optional parameters in the environment or server configuration:
vais_location: The location of the Vertex AI Search engine. (Default: "global")page_size: The number of documents to retrieve as search results. (Default: 5)max_extractive_segment_count: The maximum number of extractive chunks to retrieve from each document. (Default: 2)log_level: Specifies the logging level. (Default: "WARNING")IMPERSONATE_SERVICE_ACCOUNT: The email address of a service account to impersonate for Google Cloud authentication. See the "Google Cloud Authentication" section for details.USE_MOUNTED_SA_KEY: Set totrueto indicate that a service account key file is mounted at/app/secrets/sa-key.jsoninside the container and should be used for authentication. (Default:false) Iffalse, Application Default Credentials (ADC) will be used (unlessIMPERSONATE_SERVICE_ACCOUNTis set and it also uses a mounted key as its source). If you set this totrue, you must mount your local SA key file to/app/secrets/sa-key.jsonin the Docker container (e.g., using the-v /path/to/your/local-sa-key.json:/app/secrets/sa-key.jsonflag withdocker run).
Example:
"env": {
"GOOGLE_CLOUD_PROJECT_ID": "<google_cloud_project_id>",
"VAIS_ENGINE_ID": "<vais_engine_id>",
"VAIS_LOCATION": "us-central1",
"PAGE_SIZE": "20",
"MAX_EXTRACTIVE_SEGMENT_COUNT": "8",
"LOG_LEVEL": "DEBUG",
"IMPERSONATE_SERVICE_ACCOUNT": "target-sa@project.iam.gserviceaccount.com",
"USE_MOUNTED_SA_KEY": "true"
}
Google Cloud Authentication
This MCP server authenticates to Google Cloud using the following methods, taking into account the IMPERSONATE_SERVICE_ACCOUNT and USE_MOUNTED_SA_KEY environment variables:
-
Service Account Impersonation:
- If the
IMPERSONATE_SERVICE_ACCOUNTenvironment variable is set to the email address of a target service account, the server will attempt to impersonate that service account.- If
USE_MOUNTED_SA_KEYistrue(and a service account key file is mounted to/app/secrets/sa-key.jsonin the container), the service account key file at/app/secrets/sa-key.jsonwill be used as the source credentials for impersonation. - If
USE_MOUNTED_SA_KEYisfalse, Application Default Credentials (ADC) will be used as the source credentials for impersonation.
- If
- If the
-
Direct Authentication (No Impersonation):
- If
IMPERSONATE_SERVICE_ACCOUNTis not set:- If
USE_MOUNTED_SA_KEYistrue(and a service account key file is mounted to/app/secrets/sa-key.json), the server will directly use the service account key file at/app/secrets/sa-key.jsonfor authentication. - If
USE_MOUNTED_SA_KEYisfalse, the server will use ADC for authentication.
- If
- If
ADC automatically find credentials from the environment, such as your local user credentials (set up via gcloud auth application-default login) or a service account attached to the compute resource. For more details, see the official documentation.
When using Docker via mcp.json:
If you set USE_MOUNTED_SA_KEY to "true" in the env section of your mcp.json configuration, and correctly mount your local service account key file to /app/secrets/sa-key.json using the -v flag within the args section, the mounted service account key will be used for authentication as described in the flows above.
Note:
-
The account used for authentication must have the "Discovery Engine Viewer" role (
roles/discoveryengine.viewer). This is required to access Vertex AI Search resources. For more information about roles, see AI Applications roles and permissions. -
If you are running locally, you can set up ADC by running:
gcloud auth application-default login
-
For production environments, it is recommended to use a service account with the minimum required permissions.
Development
Building
To prepare this package for distribution:
- Sync dependencies and update lockfile:
uv sync
Debugging
You can launch the MCP Inspector using following command:
npx @modelcontextprotocol/inspector uvx vais-mcp@latest GOOGLE_CLOUD_PROJECT_ID=<google_cloud_project_id> VAIS_ENGINE_ID=<vais_engine_id>
Metadata
Release files for vais-mcp 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| vais_mcp-1.0.0.tar.gz | 31.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vais_mcp-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.1 kB
Release files / vais_mcp-1.0.0.tar.gz
| Download URL | vais_mcp-1.0.0.tar.gz |
|---|---|
| Size | 31.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d28c4ba8c5dc3f89f30f0fada3fbb7b99023a7cb08c6f6ce6d77953a05c1d9f7
|
|
BLAKE2b-256 checksum How to use checksums |
2c9420a6bc4bc78246add4c6d5ad0782c055a4daaecd71f22f75c6652ab520a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.10
|
Release files / vais_mcp-1.0.0-py3-none-any.whl
| Download URL | vais_mcp-1.0.0-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33d180aef804d13d191ecc0c0ffd50b678397628ba7eae6975360d18a3bee2c8
|
|
BLAKE2b-256 checksum How to use checksums |
175a2d036d3d65a877d272621302b0967ce90cb9f201e6e635a57297da68f953
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.10
|
Security for vais-mcp 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.