test-lnar-hosting-python-postgres
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
test-lnar-hosting-python-postgres
Notes の CRUD を提供する FastAPI サーバーと、それを MCP ツールとして公開する MCP サーバーのサンプルです。
test-lnar-hosting-python の PostgreSQL 版です。元のサンプルがデータをプロセス内メモリ(dict)に
持っていたのに対し、本リポジトリは PostgreSQL にデータを永続化 します。プロセスを再起動・
再デプロイしてもノートは消えません。
FastAPI の /mcp に MCP Streamable HTTP エンドポイントをマウントしているため、1プロセス・1ポートで REST API と MCP の両方を提供します。
データストア
ノートは PostgreSQL の
notesテーブルに保存されます(起動時に自動作成)。接続先は環境変数
DATABASE_URLから読み込みます(例:postgresql://user:pass@host:5432/dbname)。lnar 上では、設置したマネージドDB(または接続した外部DB)の接続文字列が
DATABASE_URLとして自動注入されます。ローカル開発では未設定時に
postgresql://postgres:postgres@localhost:5432/postgresを使います。
CREATE TABLE notes (
id UUID PRIMARY KEY,
title TEXT NOT NULL,
content TEXT NOT NULL,
tags TEXT[] NOT NULL DEFAULT '{}'
);Related MCP server: Notes MCP Server
起動方法
1. 依存関係のインストール
uv sync2. PostgreSQL を用意(ローカル例)
docker run --rm -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres:163. サーバーを起動
# 既定以外の DB に繋ぐ場合は DATABASE_URL を設定
export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres"
uvicorn api:app --reloadREST API ドキュメント: http://localhost:8000/docs
MCP エンドポイント: http://localhost:8000/mcp
エンドポイント一覧
Method | Path | 説明 |
GET |
| ヘルスチェック |
GET |
| API のバージョン情報を取得 |
GET |
| ノートの一覧を取得 |
GET |
| ノートの件数を取得 |
GET |
| タグ一覧を取得 |
POST |
| ノートを作成 |
DELETE |
| すべてのノートを削除(0件のときは 204) |
GET |
| ノートを ID で取得 |
PUT |
| ノートを更新 |
DELETE |
| ノートを削除 |
GET |
| ログストリーミング検証用 |
MCP ツール一覧
ツール名 | 説明 |
| すべてのノートの一覧を取得 |
| ノートの件数を取得 |
| タグ一覧を取得 |
| ID を指定してノートを取得 |
| 新しいノートを作成 |
| ノートのタイトル/本文/タグを更新 |
| ノートを ID で削除 |
| すべてのノートを一括削除 |
curl での動作確認
# ノート作成
curl -s -X POST http://localhost:8000/notes \
-H 'Content-Type: application/json' \
-d '{"title": "memo", "content": "hello", "tags": ["a"]}'
# 一覧取得
curl -s http://localhost:8000/notes
# 件数取得
curl -s http://localhost:8000/notes/count
# 永続化の確認: サーバーを再起動してもノートが残るMCP クライアントからの接続
supergateway 経由で Streamable HTTP に接続する場合(lnar ダッシュボードで表示される設定):
{
"mcpServers": {
"test-lnar-hosting-python-postgres": {
"command": "npx",
"args": ["-y", "supergateway", "--streamableHttp", "http://localhost:8000/mcp"]
}
}
}stdio transport(Claude Desktop / MCP Inspector 直接接続)を使う場合:
python mcp_server.pyTool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Google Keep-style notes app with an MCP server for AI agents to read/write notes.
Linked markdown notes as memory for AI apps: search, read, save and link notes over MCP.
Plain Markdown notes you own, shared by every AI client you connect, over one MCP endpoint.
Remote MCP server for notes, tasks, kanban boards and docs - the Slates agentic workspace
Related MCP Servers
- FlicenseNot gradedqualityDmaintenancePersonal note management server that enables creating, reading, updating, deleting, listing, and searching notes with support for titles, content, and tags.-
- FlicenseNot gradedqualityDmaintenanceA minimal MCP server for persistent note-taking, enabling create, update, delete, and search of notes with tags, plus resource-based retrieval of all notes or by title.-
- FlicenseNot gradedqualityDmaintenanceEnables natural language CRUD operations on notes by integrating FastAPI, Gemini, and MCP.-
- FlicenseNot gradedqualityDmaintenanceMCP server for a JWT-authenticated note-taking API, exposing CRUD tools for notes.-