Skip to content

Commit 26bd0f7

Browse files
committed
Move MCP out into a separate package
1 parent e235cfb commit 26bd0f7

File tree

6 files changed

+15
-211
lines changed

6 files changed

+15
-211
lines changed

splunklib/mcp/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import logging
2+
3+
mcp_package_name = "splunklib.mcp"
4+
5+
# <https://packaging.python.org/en/latest/guides/packaging-namespace-packages/>
6+
try:
7+
__import__(mcp_package_name)
8+
9+
except ModuleNotFoundError as mnfe:
10+
logging.error("Tried to import splunk-sdk-mcp without installing int", mnfe)
11+
12+
raise ModuleNotFoundError(
13+
"PLease install splunk-sdk-mcp package to use these features."
14+
) from mnfe

splunklib/mcp/mcp.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

splunklib/mcp/tools/models.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

splunklib/mcp/tools/registrations.py

Lines changed: 0 additions & 98 deletions
This file was deleted.

tests/system/test_apps/mcp_enabled_app/bin/execute_tool_example.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/system/test_apps/mcp_enabled_app/bin/mcp_tools.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import asyncio
21
import json
32
import time
43

@@ -45,20 +44,11 @@ async def generating_csc(count: int, ctx: Context) -> list[str]:
4544
await ctx.report_progress((progress + 1) * 2, 100, "Addition in progress")
4645
time.sleep(0.25)
4746

48-
quuuuuux = [json.dumps(r) for r in list(results)]
49-
print(quuuuuux)
50-
return quuuuuux
47+
return list(results)
5148

5249

5350
if __name__ == "__main__":
5451
MCP_SERVER_HOST: str = "0.0.0.0"
5552
MCP_SERVER_PORT: int = 2137
5653

5754
app_mcp_server.run("stdio", show_banner=False)
58-
# asyncio.run(
59-
# app_mcp_server.run_async(
60-
# show_banner=False,
61-
# # host=MCP_SERVER_HOST,
62-
# # port=MCP_SERVER_PORT
63-
# )
64-
# )

0 commit comments

Comments
 (0)