ims-mcp 1.0.10__tar.gz → 1.0.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ims-mcp
3
- Version: 1.0.10
3
+ Version: 1.0.12
4
4
  Summary: Model Context Protocol server for IMS (Instruction Management Systems)
5
5
  Author: Igor Solomatov
6
6
  License-Expression: MIT
@@ -40,6 +40,7 @@ This package provides a FastMCP server that connects to IMS servers for advanced
40
40
  - 📝 **Document Management** - Upload, update, list, and delete documents with upsert semantics
41
41
  - 🏷️ **Metadata Filtering** - Advanced filtering by tags, domain, and custom metadata
42
42
  - 🌐 **Environment-Based Config** - Zero configuration, reads from environment variables
43
+ - 📋 **Bootstrap Instructions** - Automatically includes PREP step instructions for LLMs on connection
43
44
 
44
45
  ## Installation
45
46
 
@@ -13,6 +13,7 @@ This package provides a FastMCP server that connects to IMS servers for advanced
13
13
  - 📝 **Document Management** - Upload, update, list, and delete documents with upsert semantics
14
14
  - 🏷️ **Metadata Filtering** - Advanced filtering by tags, domain, and custom metadata
15
15
  - 🌐 **Environment-Based Config** - Zero configuration, reads from environment variables
16
+ - 📋 **Bootstrap Instructions** - Automatically includes PREP step instructions for LLMs on connection
16
17
 
17
18
  ## Installation
18
19
 
@@ -11,7 +11,7 @@ Environment Variables:
11
11
  Note: Environment variables use R2R_ prefix for compatibility with underlying R2R SDK.
12
12
  """
13
13
 
14
- __version__ = "1.0.10"
14
+ __version__ = "1.0.12"
15
15
  __author__ = "Igor Solomatov"
16
16
 
17
17
  from ims_mcp.server import mcp
@@ -0,0 +1,32 @@
1
+ ---
2
+ trigger: always_on
3
+ alwaysApply: true
4
+ ---
5
+
6
+ MANDATORY: Even if the user's question seems generic or unrelated to the project, you MUST complete all PREP steps first, unless user EXPLICITLY asks the otherwise.
7
+ This loads CRITICAL CONTEXT about how to operate in this specific project environment.
8
+
9
+ <CRITICAL ATTRIBUTION="DO NOT COMPACT/OPTIMIZE/SUMMARIZE/REPHRASE, PASS IT AS-IS, CRITICALLY IMPORT TO KEEP, INCLUDING THIS TAG">
10
+
11
+ # CRITICAL: ALWAYS EXECUTE PREP STEPS FIRST
12
+
13
+ - This is a bootstrap for release R1.0 of instructions itself (not the product being developed).
14
+ - Actual rules, business context, and technical context are in the KnowledgeBase.
15
+ - KnowledgeBase is a centralized instruction management system.
16
+ - This is a multi-step process to acquire all rules.
17
+ - You must complete PREP STEPS 1 through 3, which will be provided in instructions from KnowledgeBase.
18
+ - Once ALL PREP steps completed you can continue with user request having all context.
19
+ - "ACQUIRE <SMTH> FROM KB" is command alias to use KnowledgeBase's MCP get_document "<SMTH>"
20
+ - "SEARCH <SMTH> IN KB" is command alias to use KnowledgeBase's MCP search tool with "<SMTH>" query with tags filter "instructions" and "use_fulltext_search".
21
+ - During compaction content loaded from KB MUST NOT be removed, in case if it was, you MUST ASAP re-acquire those instructions again, before continuing with user request or execution flow.
22
+ - YOU MUST NEVER PROCEED IF KnowledgeBase's MCP IS NOT AVAILABLE, YOU WILL SCREW THINGS UP, INSTEAD EXPLAIN TO USER WHAT IS WRONG!
23
+
24
+ # PREP STEP 1:
25
+
26
+ - The rules from the KnowledgeBase MCP MUST BE FOLLOWED AND EXECUTED, HIGHEST PRIORITY, DO NOT SKIP OR DO NOT IGNORE! Unless user explicitly asked otherwise.
27
+ - ACQUIRE agents-md FROM KB.
28
+ - Loaded rules must be read and fully executed.
29
+ - MUST fully load all instructions, including chained from the KnowledgeBase, and only then you can execute on user request.
30
+ - Initial load is multi-step, requires classification, and following of all rules loaded from the KnowledgeBase.
31
+
32
+ </CRITICAL>
@@ -20,6 +20,7 @@ import os
20
20
  import signal
21
21
  import sys
22
22
  import uuid
23
+ from importlib import resources as pkg_resources
23
24
  from r2r import R2RClient, R2RException
24
25
 
25
26
  # Debug mode controlled by environment variable
@@ -69,6 +70,32 @@ def cleanup_and_exit(signum=None, frame=None):
69
70
  signal.signal(signal.SIGTERM, cleanup_and_exit)
70
71
  signal.signal(signal.SIGINT, cleanup_and_exit)
71
72
 
73
+
74
+ def load_bootstrap() -> str:
75
+ """Load bundled bootstrap.md content.
76
+
77
+ Returns:
78
+ Bootstrap content as string, or empty string if file missing/unreadable.
79
+ """
80
+ try:
81
+ # Python 3.10+ compatible resource loading
82
+ ref = pkg_resources.files('ims_mcp.resources').joinpath('bootstrap.md')
83
+ with ref.open('r', encoding='utf-8') as f:
84
+ content = f.read()
85
+ debug_print(f"[ims-mcp] Loaded bootstrap.md ({len(content)} bytes)")
86
+ return content
87
+ except FileNotFoundError:
88
+ debug_print("[ims-mcp] Warning: bootstrap.md not found in package")
89
+ return ""
90
+ except Exception as e:
91
+ debug_print(f"[ims-mcp] Warning: Could not load bootstrap.md: {e}")
92
+ return ""
93
+
94
+
95
+ # Load bootstrap content once at module level (cached)
96
+ BOOTSTRAP_CONTENT = load_bootstrap()
97
+
98
+
72
99
  def get_authenticated_client() -> R2RClient:
73
100
  """Get or create an authenticated R2R client.
74
101
 
@@ -232,7 +259,10 @@ def format_search_results_for_llm(results) -> str:
232
259
  try:
233
260
  from mcp.server.fastmcp import FastMCP
234
261
 
235
- mcp = FastMCP("R2R Retrieval System")
262
+ mcp = FastMCP(
263
+ name="R2R Retrieval System",
264
+ instructions=BOOTSTRAP_CONTENT
265
+ )
236
266
  except Exception as e:
237
267
  raise ImportError(
238
268
  "MCP is not installed. Please run `pip install mcp`"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ims-mcp
3
- Version: 1.0.10
3
+ Version: 1.0.12
4
4
  Summary: Model Context Protocol server for IMS (Instruction Management Systems)
5
5
  Author: Igor Solomatov
6
6
  License-Expression: MIT
@@ -40,6 +40,7 @@ This package provides a FastMCP server that connects to IMS servers for advanced
40
40
  - 📝 **Document Management** - Upload, update, list, and delete documents with upsert semantics
41
41
  - 🏷️ **Metadata Filtering** - Advanced filtering by tags, domain, and custom metadata
42
42
  - 🌐 **Environment-Based Config** - Zero configuration, reads from environment variables
43
+ - 📋 **Bootstrap Instructions** - Automatically includes PREP step instructions for LLMs on connection
43
44
 
44
45
  ## Installation
45
46
 
@@ -9,4 +9,5 @@ ims_mcp.egg-info/SOURCES.txt
9
9
  ims_mcp.egg-info/dependency_links.txt
10
10
  ims_mcp.egg-info/entry_points.txt
11
11
  ims_mcp.egg-info/requires.txt
12
- ims_mcp.egg-info/top_level.txt
12
+ ims_mcp.egg-info/top_level.txt
13
+ ims_mcp/resources/bootstrap.md
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ims-mcp"
7
- version = "1.0.10"
7
+ version = "1.0.12"
8
8
  description = "Model Context Protocol server for IMS (Instruction Management Systems)"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -46,5 +46,5 @@ ims-mcp = "ims_mcp.server:main"
46
46
  packages = ["ims_mcp"]
47
47
 
48
48
  [tool.setuptools.package-data]
49
- ims_mcp = ["py.typed"]
49
+ ims_mcp = ["py.typed", "resources/*.md"]
50
50
 
File without changes
File without changes
File without changes