Demo HTTP MCP Server
test-http-mcp
http-mcp パッケージを使用してPythonで実装されたデモ用Model Context Protocol (MCP) サーバーです。HTTP (Starlette/Uvicorn) または stdio 経由で実行でき、MCP対応クライアントに対してツールやプロンプトを公開します。このプロジェクトには、NVD (National Vulnerability Database) を介して脆弱性を照会するためのチャットインターフェースを提供するReactフロントエンドが含まれています。

プロジェクト構成
test-http-mcp/
├── backend/ # Python backend (FastAPI + MCP server)
│ ├── app/ # Application source code
│ │ ├── app.py # FastAPI app, routes, MCP mount
│ │ ├── main.py # Entry points (HTTP / stdio)
│ │ ├── agen_memory.py # SQLite message persistence
│ │ ├── config.py # Settings via pydantic-settings
│ │ ├── auth0/ # Auth0 integration
│ │ │ ├── __init__.py # JWT token validator
│ │ │ └── client_store.py # Dynamic client registration (RFC 7591)
│ │ ├── tools/ # MCP tools (CPE/CVE search via NVD)
│ │ └── prompts/ # MCP prompt templates
│ ├── pyproject.toml # Python deps & scripts
│ ├── uv.lock # Locked dependencies
│ ├── ruff.toml # Linter config
│ ├── mypy.ini # Type-checker config
│ └── .envrc # direnv auto-activation
├── frontend/ # React + TypeScript frontend (Vite)
│ ├── src/
│ │ ├── components/ # ChatApp, ChatInput, MessageList, MessageBubble
│ │ ├── api.ts # API client (fetch history, stream messages)
│ │ ├── types.ts # Shared TypeScript types
│ │ ├── App.tsx # Root component
│ │ └── App.css # Styles
│ ├── vite.config.ts # Vite config with dev proxy
│ └── package.json # Node dependencies
├── AGENTS.md
├── LICENSE
└── README.md認証 (Auth0)
MCPエンドポイント (/mcp/) はAuth0 OAuth2認証で保護されています。ツールを使用するには、アクセストークンにスコープ (tool:search_cpe, tool:search_cve) が含まれている必要があります。
必要な環境変数
変数 | 説明 |
| Auth0テナントドメイン (例: |
| トークン検証用のAPI識別子 |
| MCPアプリ用のAuth0アプリケーションクライアントID |
| 管理APIクライアントID (動的登録用) |
| 管理APIクライアントシークレット |
| スコープ強制を無効にする場合は |
これらを backend/.env (git-ignored) に配置してください。
アプリのマウント構造
パス | アプリ | 認証 |
| 保護されたMCPサーバー | Auth0 Bearerトークンが必要 |
| 動的クライアント登録 (RFC 7591) | 認証不要 |
| OAuth/リソースメタデータ | 認証不要 |
| チャットインターフェースエンドポイント | 認証不要 (注記参照) |
| フロントエンド静的ファイル | 認証不要 |
注記: チャットエンドポイントはローカル開発用に意図的に認証を無効にしています。localhost以外に公開する前に認証を追加してください。
要件
Python 3.13
Node.js 18+ および npm
uv(推奨) またはpip
インストール
バックエンド (using uv):
cd backend
uv run python -V # creates a venv and syncs deps from pyprojectバックエンド (using pip):
cd backend
python3.13 -m venv .venv
source .venv/bin/activate
pip install .フロントエンド:
cd frontend
npm install実行
開発 (フロントエンドとバックエンドを個別に実行)
バックエンドを起動:
cd backend
uv run run-app
# → API on http://localhost:8000
# → MCP endpoint on http://localhost:8000/mcp/フロントエンド開発サーバーを起動 (別のターミナルで):
cd frontend
npm run dev
# → UI on http://localhost:5173 (proxies /api/* → backend)本番環境 (バックエンドがビルド済みフロントエンドを配信)
フロントエンドをビルドし、バックエンドを起動:
cd frontend && npm run build && cd ..
cd backend && uv run run-app
# → Everything on http://localhost:8000実行 (stdioモード)
Cursorやその他のMCPクライアントでの使用
Auth0が有効な場合、クライアントはOAuth2アクセストークンを取得する必要があります。サーバーは /register で RFC 7591 動的クライアント登録 をサポートしているため、認証仕様を実装しているMCPクライアントは自動的に登録されます。
HTTPモード用の .cursor/mcp.json の例:
{
"mcpServers": {
"test-http-mcp": {
"type": "http",
"url": "http://localhost:8000/mcp/"
}
}
}Gemini での使用:
{
"mcpServers": {
"test": {
"httpUrl": "http://localhost:8000/mcp/",
"timeout": 5000
}
}
}stdio経由で接続するための .cursor/mcp.json エントリの例:
{
"mcpServers": {
"test_studio": {
"command": "uv",
"args": ["run", "--project", "backend", "run-stdio"],
"env": { "AUTHORIZATION_TOKEN": "Bearer TEST_TOKEN" }
}
}
}このサーバーが公開するもの
ツール (
backend/app/tools/を参照):search_cpe(product, version, vendor)— NVDを介して共通プラットフォーム列挙 (CPE) を検索search_cve(cpe_name)— 指定されたCPEの共通脆弱性識別子 (CVE) を検索
プロンプト (
backend/app/prompts/を参照):sync_nvd_search(dependency, version)— シンプルな脆弱性検索プロンプトasync_nvd_search(dependency, version)— 事前に取得したCVEデータを使用した高度なプロンプト
プロジェクトスクリプト
backend/pyproject.toml に2つのコンソールエントリポイントが定義されています:
run-app→app.main:run_httprun-stdio→app.main:run_stdiorun-app-local→app.app:main(自動リロード付き)
開発
一般的なタスク (backend/ ディレクトリから実行):
uv run ruff check . # lint
uv run mypy . # type check
uv run pytest # tests
uv run mdformat . # format markdownフロントエンドタスク (frontend/ ディレクトリから実行):
npm run dev # start dev server
npm run build # production build
npm run lint # lint with ESLint
npx tsc --noEmit # type check実装上の注意
ルートASGIアプリは
auth_mcpによって作成されたAuth0保護されたMCPアプリであり、FastAPIサブアプリを/apiにマウントします。/mcp/のMCPエンドポイントには、適切なツールスコープを持つ有効なAuth0 Bearerトークンが必要です。/registerでの動的クライアント登録は、事前に作成されたAuth0アプリケーションにプロキシし、許可されたコールバックURLを更新します。リダイレクトURIは検証されます (HTTPS必須。localhostのみHTTP許可)。チャットインターフェースは、MCPツールを呼び出して脆弱性を検索できるOllamaエージェントと共に
pydantic-aiを使用します。チャット履歴は
agen_memory.pyを介してローカルのSQLiteデータベースに永続化されます。Reactフロントエンドは、改行区切りのJSONとしてレスポンスをストリーミングし、
markedライブラリを使用してマークダウンをレンダリングします。本番環境では、バックエンドは
frontend/dist/からビルド済みフロントエンドを配信し、SPAフォールバックルーティングを行います (パストラバーサル保護済み)。開発環境では、Viteが
/api/*リクエストをポート8000のバックエンドにプロキシします。
ライセンス
MIT — LICENSE を参照してください。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA minimal Model Context Protocol server demo that exposes tools through HTTP API, including greeting, weather lookup, and HTTP request capabilities. Demonstrates MCP server implementation with stdio communication and HTTP gateway functionality.8ISC
- FlicenseBqualityDmaintenanceA demonstration server showcasing MCP capabilities with basic tools including addition calculations and weather API integration for fetching city weather data.22
- FlicenseNot gradedqualityCmaintenanceA basic MCP server for testing with echo, datetime, and calculator tools.88
- AlicenseAqualityCmaintenanceA minimal MCP server example demonstrating Tools, Resources, and Prompts. It enables calculations, time queries, note management, and code review prompts via stdio transport.310MIT
Related MCP Connectors
MCP server exposing the Backtest360 engine API as tools for AI agents.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
MCP server for generating rough-draft project plans from natural-language prompts.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/yeison-liscano/demo_http_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server