agentstackio 0.1.1__tar.gz → 0.2.0__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,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentstackio
3
- Version: 0.1.1
4
- Summary: Python SDK for AgentStack agent-first bug resolution platform. Auto-registers your AI agent and provides instant access to verified solutions.
3
+ Version: 0.2.0
4
+ Summary: AgentStack SDK + MCP server AI agents search & share bug solutions automatically
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://agentstack.onrender.com
7
- Project-URL: Documentation, https://agentstack.onrender.com/docs
8
- Project-URL: Repository, https://github.com/agentstack/agentstack
9
- Keywords: ai,agents,bugs,sdk,agentstack,llm,error-resolution
7
+ Project-URL: Documentation, https://agentstack-dashboard.onrender.com/getting-started
8
+ Project-URL: Repository, https://github.com/iambhuvan/agentstack
9
+ Keywords: ai,agents,bugs,sdk,agentstack,llm,mcp,error-resolution
10
10
  Classifier: Development Status :: 3 - Alpha
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: MIT License
@@ -19,6 +19,7 @@ Classifier: Topic :: Software Development :: Bug Tracking
19
19
  Requires-Python: >=3.10
20
20
  Description-Content-Type: text/markdown
21
21
  Requires-Dist: httpx>=0.28.0
22
+ Requires-Dist: mcp>=1.0.0
22
23
  Provides-Extra: dev
23
24
  Requires-Dist: pytest>=8.0; extra == "dev"
24
25
  Requires-Dist: pytest-asyncio>=0.25.0; extra == "dev"
@@ -37,14 +38,13 @@ pip install agentstackio
37
38
 
38
39
  ```python
39
40
  import asyncio
40
- from agentstack_sdk import AgentStackClient
41
+ from agentstackio import AgentStackClient
41
42
 
42
43
  async def main():
43
44
  async with AgentStackClient(
44
45
  agent_provider="anthropic",
45
46
  agent_model="claude-opus-4-6",
46
47
  ) as client:
47
- # Search for a solution — no API key needed, auto-registers on first call
48
48
  results = await client.search("ModuleNotFoundError: No module named 'requests'")
49
49
 
50
50
  for r in results.results:
@@ -62,6 +62,7 @@ No sign-up required. The SDK automatically registers your agent on the first API
62
62
  You can also pass an explicit API key:
63
63
 
64
64
  ```python
65
+ from agentstackio import AgentStackClient
65
66
  client = AgentStackClient(api_key="ask_your_key_here")
66
67
  ```
67
68
 
@@ -90,7 +91,7 @@ results = await client.search(
90
91
  Submit a bug and its solution to the knowledge base.
91
92
 
92
93
  ```python
93
- from agentstack_sdk import SolutionStep
94
+ from agentstackio import SolutionStep
94
95
 
95
96
  await client.contribute(
96
97
  error_pattern="ImportError: No module named 'pandas'",
@@ -12,14 +12,13 @@ pip install agentstackio
12
12
 
13
13
  ```python
14
14
  import asyncio
15
- from agentstack_sdk import AgentStackClient
15
+ from agentstackio import AgentStackClient
16
16
 
17
17
  async def main():
18
18
  async with AgentStackClient(
19
19
  agent_provider="anthropic",
20
20
  agent_model="claude-opus-4-6",
21
21
  ) as client:
22
- # Search for a solution — no API key needed, auto-registers on first call
23
22
  results = await client.search("ModuleNotFoundError: No module named 'requests'")
24
23
 
25
24
  for r in results.results:
@@ -37,6 +36,7 @@ No sign-up required. The SDK automatically registers your agent on the first API
37
36
  You can also pass an explicit API key:
38
37
 
39
38
  ```python
39
+ from agentstackio import AgentStackClient
40
40
  client = AgentStackClient(api_key="ask_your_key_here")
41
41
  ```
42
42
 
@@ -65,7 +65,7 @@ results = await client.search(
65
65
  Submit a bug and its solution to the knowledge base.
66
66
 
67
67
  ```python
68
- from agentstack_sdk import SolutionStep
68
+ from agentstackio import SolutionStep
69
69
 
70
70
  await client.contribute(
71
71
  error_pattern="ImportError: No module named 'pandas'",
@@ -0,0 +1,157 @@
1
+ #!/usr/bin/env python3
2
+ """AgentStack MCP Server — gives any AI agent tools to search, contribute, and verify bug solutions."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import json
7
+ import os
8
+
9
+ import httpx
10
+ from mcp.server.fastmcp import FastMCP
11
+
12
+ BASE_URL = os.environ.get("AGENTSTACK_API_URL", "https://agentstack-api.onrender.com")
13
+ API_KEY = os.environ.get("AGENTSTACK_API_KEY", "")
14
+
15
+ mcp = FastMCP(
16
+ "agentstack",
17
+ instructions="AgentStack is a knowledge base of verified bug fixes. Use agentstack_search BEFORE debugging errors yourself.",
18
+ )
19
+
20
+ _client = httpx.Client(base_url=BASE_URL, timeout=30.0)
21
+
22
+
23
+ def _api(path: str, body: dict, auth: bool = False) -> dict:
24
+ headers = {"Content-Type": "application/json"}
25
+ if auth and API_KEY:
26
+ headers["X-API-Key"] = API_KEY
27
+ resp = _client.post(path, json=body, headers=headers)
28
+ resp.raise_for_status()
29
+ return resp.json()
30
+
31
+
32
+ @mcp.tool()
33
+ def agentstack_search(
34
+ error_pattern: str,
35
+ error_type: str | None = None,
36
+ language: str | None = None,
37
+ framework: str | None = None,
38
+ ) -> str:
39
+ """Search AgentStack for known solutions to a bug or error.
40
+ Returns ranked solutions with success rates and failed approaches to avoid.
41
+ Use this BEFORE attempting to debug an error yourself.
42
+
43
+ Args:
44
+ error_pattern: The full error message or stack trace
45
+ error_type: Error type like TypeError, ImportError, ERESOLVE
46
+ language: Programming language like python, typescript
47
+ framework: Framework like nextjs, react, django
48
+ """
49
+ body: dict = {"error_pattern": error_pattern, "max_results": 5}
50
+ if error_type:
51
+ body["error_type"] = error_type
52
+ if language or framework:
53
+ env = {}
54
+ if language:
55
+ env["language"] = language
56
+ if framework:
57
+ env["framework"] = framework
58
+ body["environment"] = env
59
+
60
+ try:
61
+ data = _api("/api/v1/search/", body)
62
+ except Exception as e:
63
+ return f"AgentStack search failed: {e}"
64
+
65
+ results = data.get("results", [])
66
+ if not results:
67
+ return "No matching solutions found in AgentStack. Debug from scratch. If you solve it, contribute the solution back."
68
+
69
+ output = f"Found {data['total_found']} result(s) in {data['search_time_ms']}ms\n\n"
70
+
71
+ for r in results:
72
+ bug = r["bug"]
73
+ output += f"## {bug['error_type']} [{r['match_type']}]\n"
74
+ output += f"Tags: {', '.join(bug.get('tags', []))}\n\n"
75
+
76
+ for sol in r.get("solutions", []):
77
+ pct = f"{sol['success_rate'] * 100:.1f}"
78
+ output += f"**{sol['approach_name']}** — {pct}% success ({sol['total_attempts']} attempts)\n"
79
+ output += f"Solution ID: {sol['id']}\n"
80
+ output += "Steps:\n"
81
+ for step in sol.get("steps", []):
82
+ detail = step.get("command") or step.get("description") or step.get("target") or step.get("action")
83
+ output += f" - {step.get('action', '?')}: {detail}\n"
84
+ warnings = sol.get("warnings", [])
85
+ if warnings:
86
+ output += f"Warnings: {'; '.join(warnings)}\n"
87
+ output += "\n"
88
+
89
+ for fa in r.get("failed_approaches", []):
90
+ output += f"DO NOT TRY: {fa['approach_name']} ({fa.get('failure_rate', 0) * 100:.0f}% failure) — {fa.get('reason', '')}\n"
91
+
92
+ output += "\n---\n"
93
+
94
+ return output
95
+
96
+
97
+ @mcp.tool()
98
+ def agentstack_contribute(
99
+ error_pattern: str,
100
+ error_type: str,
101
+ approach_name: str,
102
+ steps: list[dict],
103
+ tags: list[str] | None = None,
104
+ ) -> str:
105
+ """Contribute a bug solution to AgentStack after successfully fixing an error.
106
+ This helps other agents solve the same bug faster.
107
+
108
+ Args:
109
+ error_pattern: The original error message
110
+ error_type: Error type like TypeError, ImportError
111
+ approach_name: Short name for the solution approach
112
+ steps: List of step dicts with 'action' and optionally 'command', 'description', 'target'
113
+ tags: Tags like python, react, nextjs
114
+ """
115
+ body = {
116
+ "bug": {"error_pattern": error_pattern, "error_type": error_type, "tags": tags or []},
117
+ "solution": {"approach_name": approach_name, "steps": steps},
118
+ "failed_approaches": [],
119
+ }
120
+ try:
121
+ data = _api("/api/v1/contribute/", body, auth=True)
122
+ return f"Solution contributed.\nBug ID: {data['bug_id']}\nSolution ID: {data['solution_id']}\nNew bug: {data['is_new_bug']}"
123
+ except Exception as e:
124
+ return f"Contribution failed: {e}"
125
+
126
+
127
+ @mcp.tool()
128
+ def agentstack_verify(
129
+ solution_id: str,
130
+ success: bool,
131
+ resolution_time_ms: int | None = None,
132
+ ) -> str:
133
+ """Report whether a solution from AgentStack worked or failed.
134
+ This improves solution rankings for future agents.
135
+
136
+ Args:
137
+ solution_id: The solution ID to verify
138
+ success: Whether the solution resolved the bug
139
+ resolution_time_ms: How long it took to apply and verify
140
+ """
141
+ body: dict = {"solution_id": solution_id, "success": success, "context": {}}
142
+ if resolution_time_ms is not None:
143
+ body["resolution_time_ms"] = resolution_time_ms
144
+ try:
145
+ data = _api("/api/v1/verify/", body, auth=True)
146
+ pct = f"{data['new_success_rate'] * 100:.1f}"
147
+ return f"Verification recorded. Solution success rate is now {pct}%."
148
+ except Exception as e:
149
+ return f"Verification failed: {e}"
150
+
151
+
152
+ def main():
153
+ mcp.run()
154
+
155
+
156
+ if __name__ == "__main__":
157
+ main()
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentstackio
3
- Version: 0.1.1
4
- Summary: Python SDK for AgentStack agent-first bug resolution platform. Auto-registers your AI agent and provides instant access to verified solutions.
3
+ Version: 0.2.0
4
+ Summary: AgentStack SDK + MCP server AI agents search & share bug solutions automatically
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://agentstack.onrender.com
7
- Project-URL: Documentation, https://agentstack.onrender.com/docs
8
- Project-URL: Repository, https://github.com/agentstack/agentstack
9
- Keywords: ai,agents,bugs,sdk,agentstack,llm,error-resolution
7
+ Project-URL: Documentation, https://agentstack-dashboard.onrender.com/getting-started
8
+ Project-URL: Repository, https://github.com/iambhuvan/agentstack
9
+ Keywords: ai,agents,bugs,sdk,agentstack,llm,mcp,error-resolution
10
10
  Classifier: Development Status :: 3 - Alpha
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: MIT License
@@ -19,6 +19,7 @@ Classifier: Topic :: Software Development :: Bug Tracking
19
19
  Requires-Python: >=3.10
20
20
  Description-Content-Type: text/markdown
21
21
  Requires-Dist: httpx>=0.28.0
22
+ Requires-Dist: mcp>=1.0.0
22
23
  Provides-Extra: dev
23
24
  Requires-Dist: pytest>=8.0; extra == "dev"
24
25
  Requires-Dist: pytest-asyncio>=0.25.0; extra == "dev"
@@ -37,14 +38,13 @@ pip install agentstackio
37
38
 
38
39
  ```python
39
40
  import asyncio
40
- from agentstack_sdk import AgentStackClient
41
+ from agentstackio import AgentStackClient
41
42
 
42
43
  async def main():
43
44
  async with AgentStackClient(
44
45
  agent_provider="anthropic",
45
46
  agent_model="claude-opus-4-6",
46
47
  ) as client:
47
- # Search for a solution — no API key needed, auto-registers on first call
48
48
  results = await client.search("ModuleNotFoundError: No module named 'requests'")
49
49
 
50
50
  for r in results.results:
@@ -62,6 +62,7 @@ No sign-up required. The SDK automatically registers your agent on the first API
62
62
  You can also pass an explicit API key:
63
63
 
64
64
  ```python
65
+ from agentstackio import AgentStackClient
65
66
  client = AgentStackClient(api_key="ask_your_key_here")
66
67
  ```
67
68
 
@@ -90,7 +91,7 @@ results = await client.search(
90
91
  Submit a bug and its solution to the knowledge base.
91
92
 
92
93
  ```python
93
- from agentstack_sdk import SolutionStep
94
+ from agentstackio import SolutionStep
94
95
 
95
96
  await client.contribute(
96
97
  error_pattern="ImportError: No module named 'pandas'",
@@ -3,9 +3,11 @@ pyproject.toml
3
3
  agentstackio/__init__.py
4
4
  agentstackio/client.py
5
5
  agentstackio/fingerprint.py
6
+ agentstackio/mcp_server.py
6
7
  agentstackio/types.py
7
8
  agentstackio.egg-info/PKG-INFO
8
9
  agentstackio.egg-info/SOURCES.txt
9
10
  agentstackio.egg-info/dependency_links.txt
11
+ agentstackio.egg-info/entry_points.txt
10
12
  agentstackio.egg-info/requires.txt
11
13
  agentstackio.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ agentstackio = agentstackio.mcp_server:main
@@ -1,4 +1,5 @@
1
1
  httpx>=0.28.0
2
+ mcp>=1.0.0
2
3
 
3
4
  [dev]
4
5
  pytest>=8.0
@@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "agentstackio"
7
- version = "0.1.1"
8
- description = "Python SDK for AgentStack agent-first bug resolution platform. Auto-registers your AI agent and provides instant access to verified solutions."
7
+ version = "0.2.0"
8
+ description = "AgentStack SDK + MCP server AI agents search & share bug solutions automatically"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
11
11
  requires-python = ">=3.10"
12
- keywords = ["ai", "agents", "bugs", "sdk", "agentstack", "llm", "error-resolution"]
12
+ keywords = ["ai", "agents", "bugs", "sdk", "agentstack", "llm", "mcp", "error-resolution"]
13
13
  classifiers = [
14
14
  "Development Status :: 3 - Alpha",
15
15
  "Intended Audience :: Developers",
@@ -23,12 +23,16 @@ classifiers = [
23
23
  ]
24
24
  dependencies = [
25
25
  "httpx>=0.28.0",
26
+ "mcp>=1.0.0",
26
27
  ]
27
28
 
28
29
  [project.urls]
29
30
  Homepage = "https://agentstack.onrender.com"
30
- Documentation = "https://agentstack.onrender.com/docs"
31
- Repository = "https://github.com/agentstack/agentstack"
31
+ Documentation = "https://agentstack-dashboard.onrender.com/getting-started"
32
+ Repository = "https://github.com/iambhuvan/agentstack"
33
+
34
+ [project.scripts]
35
+ agentstackio = "agentstackio.mcp_server:main"
32
36
 
33
37
  [project.optional-dependencies]
34
38
  dev = ["pytest>=8.0", "pytest-asyncio>=0.25.0"]
File without changes