
evangstav/python-memory-mcp-server
Productivity workflowЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
A Model Context Protocol (MCP) server that provides knowledge graph functionality for managing entities, relations, and observations in memory, with strict validation rules to maintain data...
Обзор
A Model Context Protocol (MCP) server that provides knowledge graph functionality for managing entities, relations, and observations in memory, with strict validation rules to maintain data consistency. - Must start with a lowercase letter - Can contain lowercase letters, numbers, and hyphens - Maximum length of 100 characters - Must be unique within the graph - Example valid names: python-project, meeting-notes-2024, user-john The following entity types are supported: - person: Human entities - concept: Abstract ideas or principles - project: Work initiatives or tasks - document: Any form of documentation - tool: Software tools or utilities - organization: Companies or groups - location: Physical or virtual places - event: Time-bound occurrences - Non-empty strings - Maximum length of 500 characters - Must be unique per entity - Should be factual and objective statements - Include timestamp when relevant The following relation types are supported: - knows: Person to person...
README
Показан фрагмент оригинального README. Открыть оригинал.
Memory MCP Server
A Model Context Protocol (MCP) server that provides knowledge graph functionality for managing entities, relations, and observations in memory, with strict validation rules to maintain data consistency.
Installation
Install the server in Claude Desktop:
mcp install main.py -v MEMORY_FILE_PATH=/path/to/memory.jsonl
Data Validation Rules
Entity Names
- Must start with a lowercase letter
- Can contain lowercase letters, numbers, and hyphens
- Maximum length of 100 characters
- Must be unique within the graph
- Example valid names:
python-project,meeting-notes-2024,user-john
Entity Types
The following entity types are supported:
person: Human entitiesconcept: Abstract ideas or principlesproject: Work initiatives or tasksdocument: Any form of documentationtool: Software tools or utilitiesorganization: Companies or groupslocation: Physical or virtual placesevent: Time-bound occurrences
Observations
- Non-empty strings
- Maximum length of 500 characters
- Must be unique per entity
- Should be factual and objective statements
- Include timestamp when relevant
Relations
The following relation types are supported:
knows: Person to person connectioncontains: Parent/child relationshipuses: Entity utilizing another entitycreated: Authorship/creation relationshipbelongs-to: Membership/ownershipdepends-on: Dependency relationshiprelated-to: Generic relationship
Additional relation rules:
- Both source and target entities must exist
- Self-referential relations not allowed
- No circular dependencies allowed
- Must use predefined relation types
Usage
The server provides tools for managing a knowledge graph:
Get Entity
result = await session.call_tool("get_entity", {
"entity_name": "example"
})
if not result.success:
if result.error_type == "NOT_FOUND":
print(f"Entity not found: {result.error}")
elif result.error_type == "VALIDATION_ERROR":
print(f"Invalid input: {result.error}")
else:
print(f"Error: {result.error}")
else:
entity = result.data
print(f"Found entity: {entity}")
Get Graph
result = await session.call_tool("get_graph", {})
if result.success:
graph = result.data
print(f"Graph data: {graph}")
else:
print(f"Error retrieving graph: {result.error}")
Create Entities
# Valid entity creation
entities = [
Entity(
name="python-project", # Lowercase with hyphens
entityType="project", # Must be a valid type
observations=["Started development on 2024-01-29"]
),
Entity(
name="john-doe",
entityType="person",
observations=["Software engineer", "Joined team in 2024"]
)
]
Установка
This server does not publish a one-line install command.
Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →