Token导航 LogoToken导航TokenDH.com
MCP API Tools logo
运维云端stdio官方级别未说明来源级核验

MCP API Tools

MCP Server

一个基于FastAPI的服务器,集成Google Gemini AI并提供多种工具(天气、新闻、搜索等)的自动路由功能。

工具数

5

提示词数

0

GitHub Stars

0

资源数

0
FastAPIPython云端部署

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

jamalexfo

提供方

jamalexfo

最后核验

2026/5/17 20:19

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -r requirements.txt

详细介绍

MCP Server dengan Google AI Studio

Server FastAPI yang menyediakan berbagai tools dan integrasi dengan Google Gemini AI.

Fitur

  • Auto Tool Router: Routing otomatis ke tool yang tepat berdasarkan prompt
  • Google Gemini Integration: Integrasi dengan Google AI Studio (Gemini 2.0 Flash Exp) menggunakan LangChain
  • Multiple Tools:

- Weather (Cuaca) - News (Berita) - Web Search (Pencarian Web) - Dictionary (Kamus) - Quotes (Kutipan Bijak)

Persyaratan

  • Python 3.8+
  • pip (Python package manager)

Instalasi

  1. Clone atau download repository ini
  1. Install dependencies:
pip install -r requirements.txt

Atau install manual:

pip install fastapi uvicorn requests pydantic python-dotenv streamlit langchain-google-genai
  1. PENTING: Konfigurasi API Key Google

a. Dapatkan API key dari Google AI Studio

b. Buat/edit file .env di root folder project:

   GOOGLE_API_KEY=your_actual_api_key_here

c. Pastikan API key valid dan aktif (bukan expired atau restricted)

Catatan: Ganti your_actual_api_key_here dengan API key Anda sendiri

Menjalankan Aplikasi

1. Jalankan FastAPI Server

Buka terminal pertama dan jalankan:

uvicorn server:app --reload

Server akan berjalan di http://localhost:8000

2. Jalankan Streamlit App (Opsional)

Buka terminal kedua dan jalankan:

streamlit run app.py

Aplikasi Streamlit akan terbuka otomatis di browser (http://localhost:8501)

Cara Penggunaan

Menggunakan Streamlit UI (Recommended)

Setelah menjalankan kedua server (FastAPI dan Streamlit), buka browser di http://localhost:8501

Fitur Streamlit App:

  1. Auto Tool Router: Masukkan pertanyaan dan sistem otomatis memilih tool yang tepat
  2. Google Gemini AI: Chat interaktif dengan AI Google Gemini
  3. Manual Tools: Pilih dan gunakan tool secara manual:

- Weather Tool: Cek cuaca kota - News Tool: Cari berita berdasarkan topik - Dictionary Tool: Cari definisi kata - Quotes Tool: Dapatkan kutipan bijak - Web Search Tool: Pencarian web

Menggunakan API (curl/Postman)

1. Auto Tool Router (/auto)

Endpoint ini secara otomatis memilih tool yang tepat berdasarkan kata kunci dalam prompt.

Endpoint: POST /auto

Request Body:

{
  "prompt": "cuaca di Jakarta"
}

Contoh Penggunaan:

Cek Cuaca

curl -X POST http://localhost:8000/auto \
  -H "Content-Type: application/json" \
  -d "{\"prompt\": \"cuaca di Bandung\"}"

Cari Berita

curl -X POST http://localhost:8000/auto \
  -H "Content-Type: application/json" \
  -d "{\"prompt\": \"berita teknologi\"}"

Cari Definisi Kata

curl -X POST http://localhost:8000/auto \
  -H "Content-Type: application/json" \
  -d "{\"prompt\": \"definisi technology\"}"

Dapatkan Quote

curl -X POST http://localhost:8000/auto \
  -H "Content-Type: application/json" \
  -d "{\"prompt\": \"quote bijak\"}"

Web Search (Default)

curl -X POST http://localhost:8000/auto \
  -H "Content-Type: application/json" \
  -d "{\"prompt\": \"python programming\"}"

2. Google Gemini LLM (/llm)

Endpoint untuk berkomunikasi langsung dengan Google Gemini AI.

Endpoint: POST /llm

Request Body:

{
  "prompt": "Jelaskan apa itu artificial intelligence"
}

Contoh Penggunaan:

curl -X POST http://localhost:8000/llm \
  -H "Content-Type: application/json" \
  -d "{\"prompt\": \"Apa itu FastAPI?\"}"

3. Health Check (/)

Cek status server.

Endpoint: GET /

curl http://localhost:8000/

Response:

{
  "status": "MCP Server with Google AI Studio - OK"
}

Dokumentasi API Interaktif

Setelah server berjalan, akses dokumentasi API interaktif di:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

Struktur Proyek

.
├── .env                      # Environment variables (API keys)
├── server.py                 # Main FastAPI application
├── app.py                    # Streamlit frontend application
├── providers/
│   ├── google_llm.py        # Google Gemini integration
│   └── ollama_llm.py        # Ollama integration (optional)
└── tools/
    ├── weather_tool.py      # Weather API
    ├── news_tool.py         # News API
    ├── search_tool.py       # DuckDuckGo search
    ├── dictionary_tool.py   # Dictionary API
    └── quotes_tool.py       # Quotes API

Kata Kunci Auto Router

Auto router mendeteksi kata kunci berikut:

Kata KunciToolContoh
cuaca, weatherWeather Tool"cuaca di Jakarta"
berita, newsNews Tool"berita teknologi"
definisi, artiDictionary Tool"definisi python"
quote, bijakQuotes Tool"quote bijak"
LainnyaWeb Search"python tutorial"

Screenshot Streamlit App

Aplikasi Streamlit menyediakan 3 mode:

  1. Auto Tool Router - Routing otomatis berdasarkan kata kunci
  2. Google Gemini AI - Chat interface dengan history
  3. Manual Tools - Pilih tool secara manual dengan UI yang user-friendly

Troubleshooting

Error: Module not found

Pastikan semua dependencies sudah terinstall:

pip install fastapi uvicorn requests pydantic python-dotenv streamlit langchain-google-genai

Streamlit tidak bisa connect ke server

Pastikan FastAPI server sudah berjalan di http://localhost:8000 sebelum menjalankan Streamlit

Error: API key not valid / GOOGLE_API_KEY not found

Penyebab umum:

  • API key tidak ada di file .env
  • API key expired atau tidak valid
  • API key memiliki restrictions yang tidak sesuai

Solusi:

  1. Pastikan file .env ada di root folder project
  2. Dapatkan API key baru dari Google AI Studio
  3. Copy API key dan paste ke file .env:
   GOOGLE_API_KEY=AIzaSy...your_actual_key
  1. Restart server FastAPI setelah mengubah .env
  2. Pastikan tidak ada spasi atau karakter tambahan di API key

Server tidak bisa diakses

Pastikan server sudah berjalan dengan perintah:

uvicorn server:app --reload

Request loading lama / timeout

Lihat panduan lengkap di TROUBLESHOOTING.md

Quick Fix:

  1. Test components:
   python test_simple.py
  1. Try server without LLM:
   uvicorn server_simple:app --reload --port 8001
  1. Check API key dan ganti jika perlu di file .env
  1. Ganti model di providers/google_llm.py:
   model="models/gemini-1.5-flash"  # More stable

目录标签

目录标签

FastAPIPython云端部署AI集成本地部署自动路由多工具服务GoogleGemini

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

api-key

部署方式(deploymentType,部署类型)

remote-capable

工具数量(toolCount,工具数)

5

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdioapi-keyremote-capable

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP