Skip to main content
Glama

Admissions MCP Hub

一个受治理的 Model Context Protocol 服务器,通过单一 MCP 契约向两个独立的 AI 聊天应用提供课程、批次、费用、潜在学员和回调能力。


这证明了什么

  • 一个 MCP 服务器、两个独立客户端(学员 + 顾问)——无需重复集成

  • 数据库凭据、认证、审计、验证——全部集中在服务器端

  • 写入操作需要确认门禁(prepare → confirm)——LLM 无法单独创建潜在学员

  • 每次工具调用都会被审计(操作者、客户端、参数哈希、结果、延迟)

  • 一个无 MCP 对比演示展示了没有 MCP 时你会失去什么

Architecture


Related MCP server: company-state-mcp

快速开始

# 1. PostgreSQL
docker compose up -d postgres

# 2. Migrate + seed
uv sync
uv run alembic upgrade head
uv run python scripts/seed_demo.py

# 3. Start services (4 terminals)
uv run uvicorn services.mcp_server.app:asgi_app --port 8010
uv run uvicorn services.learner_host.api:app --port 8020
uv run uvicorn services.counsellor_host.api:app --port 8030
uv run streamlit run ui/app.py --server.port 8501

打开 http://localhost:8501——两个聊天标签页(学员 + 顾问)。

无 MCP 对比: uv run streamlit run ui/no_mcp_demo.py --server.port 8502


试用

🎓 学员助手

提示词

结果

What courses do you have?

列出 4 门课程

Tell me about the agentic AI course

批次日期 + 费用报价 + 政策

What is the admissions policy?

返回政策文本

I'd like a callback

✅/❌ 创建潜在学员前的确认门禁

🎧 顾问控制台

提示词

结果

What courses are available?

列出 4 门课程

Show me upcoming batches for agentic AI

3 个有名额的批次

Generate a fee quote for mlops

报价 ID + 总计(INR)

List my leads

显示已分配的潜在学员

Update stage for SCAI-XXXXXXXX to enrolled

✅/❌ 确认门禁

完整提示词与预期答案请参阅 RUN_GUIDE.md。


架构

端口

服务

角色

5433

PostgreSQL

权威数据源(课程、批次、潜在学员、审计)

8010

MCP Server

工具(11)+ 资源(8)+ 提示词(2)、JWT 认证、RBAC、审计

8020

Learner Host

LangGraph 应用——学员 JWT、写入确认门禁

8030

Counsellor Host

LangGraph 应用——顾问 JWT、潜在学员管理

8501

Streamlit UI

两个聊天标签页(基于 MCP)

8502

No-MCP Demo

相同流程、直连数据库——展示 MCP 所防护的风险

技术栈: Python 3.11 · MCP SDK · LangGraph · FastAPI · SQLAlchemy 2 · PostgreSQL 16 · Pydantic v2 · Ollama (qwen3.5:2b) · Streamlit


核心概念

概念

位置

重要性

确认门禁

leads_prepare → leads_confirm_create

没有人工 ✅,LLM 无法创建潜在学员

幂等性

IdempotencyRepository(参数哈希)

网络重试不会产生重复数据

RBAC

_runner.py 中的 ROLE_TOOLS 映射

学员无法查看他人的潜在学员

审计

ToolAuditEvent 表

每次调用均记录:谁、什么操作、结果、延迟

无状态性

服务器生成的 ID(quote_id、lead_id)

无需会话即可水平扩展


项目结构

scai-mcp-admissions/
├── services/
│   ├── mcp_server/          # MCP server (tools, resources, prompts, auth, audit)
│   ├── learner_host/        # LangGraph learner app (port 8020)
│   └── counsellor_host/     # LangGraph counsellor app (port 8030)
├── ui/
│   ├── app.py               # Streamlit — 2 chat tabs (MCP)
│   └── no_mcp_demo.py       # Streamlit — no-MCP comparison (direct DB)
├── packages/
│   ├── contracts/           # Pydantic tool inputs/outputs + domain models
│   ├── shared/              # Config, LLM adapter, JWT tokens
│   └── observability/       # Structured logging, tracing
├── scripts/
│   ├── seed_demo.py         # Seed 4 courses, 4 batches, 4 fee plans, 3 policies
│   ├── issue_dev_token.py   # Issue dev JWTs for manual testing
│   └── run_demo_checks.py   # Smoke tests against running server
├── tests/                   # unit, contract, integration, security, e2e
├── migrations/              # Alembic migrations
├── data/demo_seed/          # Seed data + knowledge_base.json
├── mcp_concept.ipynb        # MCP concept notebook (what/why/how/scale/use cases)
├── mcp_flow_diagram.mmd     # Mermaid source for architecture diagram
├── mcp_flow_diagram.png     # Rendered architecture diagram
├── RUN_GUIDE.md             # Step-by-step run guide with test prompts
└── docker-compose.yml        # PostgreSQL 16

测试

uv run pytest              # all tests
uv run pytest -m unit      # just unit tests
uv run pytest -m contract  # contract tests

参考资料

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables AI agents to safely query and act on school data (attendance, fees, student records) with strict role-based access control and a two-step write approval flow.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Single source of truth and control for agent-operated companies, managing business state with deterministic policy enforcement, seat identity, and hash-chained audit trail.
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables controlled AI-agent access to enterprise-shaped tools with a deny-by-default gated write path, human approval, dry-run execution, and append-only audit logging.
    1
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables secure enterprise integration by bridging SQL, financial, SCADA, and document backends to LLM agents with RBAC, DLP redaction, human-in-the-loop approvals, and OpenTelemetry tracing.
    MIT