MatteoMass commited on
Commit
7a451f9
·
1 Parent(s): 76d79ae

refactoring

Browse files
Files changed (40) hide show
  1. pmcp/mcp_server/{__init__.py → github/__init__.py} +0 -0
  2. pmcp/mcp_server/{github.py → github/github.py} +1 -1
  3. pmcp/{mcp_github_main.py → mcp_server/github/mcp_github_main.py} +1 -5
  4. pmcp/mcp_server/{models.py → github/models.py} +0 -0
  5. pmcp/mcp_server/{services → github/services}/__init__.py +0 -0
  6. pmcp/mcp_server/{services → github/services}/branches.py +1 -1
  7. pmcp/mcp_server/{services → github/services}/contents.py +1 -1
  8. pmcp/mcp_server/{services → github/services}/issues.py +1 -1
  9. pmcp/mcp_server/{services → github/services}/pull_requests.py +1 -1
  10. pmcp/mcp_server/{services → github/services}/repo.py +1 -1
  11. pmcp/mcp_server/{services → github/services}/repo_to_text.py +1 -1
  12. pmcp/mcp_server/{tools → github/tools}/__init__.py +0 -0
  13. pmcp/mcp_server/{tools → github/tools}/branches.py +1 -1
  14. pmcp/mcp_server/{tools → github/tools}/contents.py +3 -3
  15. pmcp/mcp_server/{tools → github/tools}/issues.py +1 -1
  16. pmcp/mcp_server/{tools → github/tools}/pull_requests.py +1 -1
  17. pmcp/mcp_server/{tools → github/tools}/repo.py +1 -1
  18. pmcp/mcp_server/{tools → github/tools}/repo_to_text.py +1 -1
  19. pmcp/mcp_server/{tools → github/tools}/tools.py +1 -1
  20. pmcp/mcp_server/{utils → github/utils}/__init__.py +0 -0
  21. pmcp/mcp_server/{utils → github/utils}/github_api.py +1 -1
  22. pmcp/mcp_server/{utils → github/utils}/repo_to_text_utils.py +0 -0
  23. pmcp/{trello_server → mcp_server/trello}/__init__.py +0 -0
  24. pmcp/{trello_server → mcp_server/trello}/dtos/update_card.py +0 -0
  25. pmcp/{mcp_trello_main.py → mcp_server/trello/mcp_trello_main.py} +1 -5
  26. pmcp/{trello_server → mcp_server/trello}/models.py +0 -0
  27. pmcp/{trello_server → mcp_server/trello}/services/__init__.py +0 -0
  28. pmcp/{trello_server → mcp_server/trello}/services/board.py +2 -2
  29. pmcp/{trello_server → mcp_server/trello}/services/card.py +2 -2
  30. pmcp/{trello_server → mcp_server/trello}/services/checklist.py +1 -1
  31. pmcp/{trello_server → mcp_server/trello}/services/list.py +2 -2
  32. pmcp/{trello_server → mcp_server/trello}/tools/__init__.py +0 -0
  33. pmcp/{trello_server → mcp_server/trello}/tools/board.py +3 -3
  34. pmcp/{trello_server → mcp_server/trello}/tools/card.py +4 -4
  35. pmcp/{trello_server → mcp_server/trello}/tools/checklist.py +2 -2
  36. pmcp/{trello_server → mcp_server/trello}/tools/list.py +3 -3
  37. pmcp/{trello_server → mcp_server/trello}/tools/tools.py +1 -1
  38. pmcp/{trello_server → mcp_server/trello}/trello.py +1 -1
  39. pmcp/{trello_server → mcp_server/trello}/utils/__init__.py +0 -0
  40. pmcp/{trello_server → mcp_server/trello}/utils/trello_api.py +0 -0
pmcp/mcp_server/{__init__.py → github/__init__.py} RENAMED
File without changes
pmcp/mcp_server/{github.py → github/github.py} RENAMED
@@ -2,7 +2,7 @@ import os
2
 
3
  from dotenv import load_dotenv
4
 
5
- from pmcp.mcp_server.utils.github_api import GithubClient
6
 
7
 
8
  # Load environment variables
 
2
 
3
  from dotenv import load_dotenv
4
 
5
+ from pmcp.mcp_server.github.utils.github_api import GithubClient
6
 
7
 
8
  # Load environment variables
pmcp/{mcp_github_main.py → mcp_server/github/mcp_github_main.py} RENAMED
@@ -1,13 +1,9 @@
1
  import logging
2
- import os
3
 
4
- import uvicorn
5
  from dotenv import load_dotenv
6
  from mcp.server.fastmcp import FastMCP
7
- from starlette.applications import Starlette
8
- from starlette.routing import Mount
9
 
10
- from pmcp.mcp_server.tools.tools import register_tools
11
 
12
  # Configure logging
13
  logging.basicConfig(
 
1
  import logging
 
2
 
 
3
  from dotenv import load_dotenv
4
  from mcp.server.fastmcp import FastMCP
 
 
5
 
6
+ from pmcp.mcp_server.github.tools.tools import register_tools
7
 
8
  # Configure logging
9
  logging.basicConfig(
pmcp/mcp_server/{models.py → github/models.py} RENAMED
File without changes
pmcp/mcp_server/{services → github/services}/__init__.py RENAMED
File without changes
pmcp/mcp_server/{services → github/services}/branches.py RENAMED
@@ -1,4 +1,4 @@
1
- from pmcp.mcp_server.utils.github_api import GithubClient
2
 
3
 
4
  class BranchService:
 
1
+ from pmcp.mcp_server.github.utils.github_api import GithubClient
2
 
3
 
4
  class BranchService:
pmcp/mcp_server/{services → github/services}/contents.py RENAMED
@@ -1,4 +1,4 @@
1
- from pmcp.mcp_server.utils.github_api import GithubClient
2
 
3
 
4
  class ContentService:
 
1
+ from pmcp.mcp_server.github.utils.github_api import GithubClient
2
 
3
 
4
  class ContentService:
pmcp/mcp_server/{services → github/services}/issues.py RENAMED
@@ -1,7 +1,7 @@
1
  """
2
  Service for managing GitHub issues in the MCP server.
3
  """
4
- from pmcp.mcp_server.utils.github_api import GithubClient
5
 
6
 
7
 
 
1
  """
2
  Service for managing GitHub issues in the MCP server.
3
  """
4
+ from pmcp.mcp_server.github.utils.github_api import GithubClient
5
 
6
 
7
 
pmcp/mcp_server/{services → github/services}/pull_requests.py RENAMED
@@ -1,4 +1,4 @@
1
- from pmcp.mcp_server.utils.github_api import GithubClient
2
 
3
 
4
  class PullRequestService:
 
1
+ from pmcp.mcp_server.github.utils.github_api import GithubClient
2
 
3
 
4
  class PullRequestService:
pmcp/mcp_server/{services → github/services}/repo.py RENAMED
@@ -1,4 +1,4 @@
1
- from pmcp.mcp_server.utils.github_api import GithubClient
2
 
3
 
4
  class RepoService:
 
1
+ from pmcp.mcp_server.github.utils.github_api import GithubClient
2
 
3
 
4
  class RepoService:
pmcp/mcp_server/{services → github/services}/repo_to_text.py RENAMED
@@ -1,7 +1,7 @@
1
  """
2
  Service for managing Github issues in MCP server.
3
  """
4
- from pmcp.mcp_server.utils.github_api import GithubClient
5
 
6
 
7
 
 
1
  """
2
  Service for managing Github issues in MCP server.
3
  """
4
+ from pmcp.mcp_server.github.utils.github_api import GithubClient
5
 
6
 
7
 
pmcp/mcp_server/{tools → github/tools}/__init__.py RENAMED
File without changes
pmcp/mcp_server/{tools → github/tools}/branches.py RENAMED
@@ -3,7 +3,7 @@ Branch listing tool.
3
  """
4
  from typing import List, Dict
5
  from mcp.server.fastmcp import Context
6
- from pmcp.mcp_server.services.branches import BranchService
7
  from pmcp.mcp_server.github import client
8
 
9
  service = BranchService(client)
 
3
  """
4
  from typing import List, Dict
5
  from mcp.server.fastmcp import Context
6
+ from pmcp.mcp_server.github.services.branches import BranchService
7
  from pmcp.mcp_server.github import client
8
 
9
  service = BranchService(client)
pmcp/mcp_server/{tools → github/tools}/contents.py RENAMED
@@ -4,7 +4,7 @@ Commit and file-content tools.
4
  import base64
5
  from typing import List, Dict
6
  from mcp.server.fastmcp import Context
7
- from pmcp.mcp_server.services.contents import ContentService
8
  from pmcp.mcp_server.github import client
9
 
10
  service = ContentService(client)
@@ -57,6 +57,6 @@ async def get_file_contents(
57
  content = base64.b64decode(blob["content"]).decode()
58
  return {"path": path, "content": content}
59
  except Exception as exc:
60
- error_msg = f"Error while getting the content of file {path} in repository {repo}. Error: {error_msg}"
61
- await ctx.error(str(exc))
62
  raise
 
4
  import base64
5
  from typing import List, Dict
6
  from mcp.server.fastmcp import Context
7
+ from pmcp.mcp_server.github.services.contents import ContentService
8
  from pmcp.mcp_server.github import client
9
 
10
  service = ContentService(client)
 
57
  content = base64.b64decode(blob["content"]).decode()
58
  return {"path": path, "content": content}
59
  except Exception as exc:
60
+ error_msg = f"Error while getting the content of file {path} in repository {repo}. Error: {exc}"
61
+ await ctx.error(str(error_msg))
62
  raise
pmcp/mcp_server/{tools → github/tools}/issues.py RENAMED
@@ -4,7 +4,7 @@ MCP Tools exposing GitHub issue operations.
4
  from typing import List, Dict, Any
5
  from mcp.server.fastmcp import Context
6
 
7
- from pmcp.mcp_server.services.issues import IssueService
8
  from pmcp.mcp_server.github import client
9
 
10
 
 
4
  from typing import List, Dict, Any
5
  from mcp.server.fastmcp import Context
6
 
7
+ from pmcp.mcp_server.github.services.issues import IssueService
8
  from pmcp.mcp_server.github import client
9
 
10
 
pmcp/mcp_server/{tools → github/tools}/pull_requests.py RENAMED
@@ -3,7 +3,7 @@ Pull-request utilities (read-only).
3
  """
4
  from typing import List, Dict
5
  from mcp.server.fastmcp import Context
6
- from pmcp.mcp_server.services.pull_requests import PullRequestService
7
  from pmcp.mcp_server.github import client
8
 
9
  service = PullRequestService(client)
 
3
  """
4
  from typing import List, Dict
5
  from mcp.server.fastmcp import Context
6
+ from pmcp.mcp_server.github.services.pull_requests import PullRequestService
7
  from pmcp.mcp_server.github import client
8
 
9
  service = PullRequestService(client)
pmcp/mcp_server/{tools → github/tools}/repo.py RENAMED
@@ -2,7 +2,7 @@
2
  Repository-level stats tool.
3
  """
4
  from mcp.server.fastmcp import Context
5
- from pmcp.mcp_server.services.repo import RepoService
6
  from pmcp.mcp_server.github import client
7
 
8
 
 
2
  Repository-level stats tool.
3
  """
4
  from mcp.server.fastmcp import Context
5
+ from pmcp.mcp_server.github.services.repo import RepoService
6
  from pmcp.mcp_server.github import client
7
 
8
 
pmcp/mcp_server/{tools → github/tools}/repo_to_text.py RENAMED
@@ -2,7 +2,7 @@
2
  This module contains tools for managing Github.
3
  """
4
 
5
- from pmcp.mcp_server.services.repo_to_text import RepoToTextService
6
  from pmcp.mcp_server.github import client
7
 
8
  from mcp.server.fastmcp import Context
 
2
  This module contains tools for managing Github.
3
  """
4
 
5
+ from pmcp.mcp_server.github.services.repo_to_text import RepoToTextService
6
  from pmcp.mcp_server.github import client
7
 
8
  from mcp.server.fastmcp import Context
pmcp/mcp_server/{tools → github/tools}/tools.py RENAMED
@@ -2,7 +2,7 @@
2
  This module contains tools for managing Github Issues
3
  """
4
 
5
- from pmcp.mcp_server.tools import issues, pull_requests, repo, repo_to_text,branches, contents
6
 
7
 
8
  def register_tools(mcp):
 
2
  This module contains tools for managing Github Issues
3
  """
4
 
5
+ from pmcp.mcp_server.github.tools import issues, pull_requests, repo, repo_to_text,branches, contents
6
 
7
 
8
  def register_tools(mcp):
pmcp/mcp_server/{utils → github/utils}/__init__.py RENAMED
File without changes
pmcp/mcp_server/{utils → github/utils}/github_api.py RENAMED
@@ -1,6 +1,6 @@
1
  import logging
2
  import httpx
3
- from pmcp.mcp_server.utils.repo_to_text_utils import fetch_file_contents, fetch_repo_sha, fetch_repo_tree, format_repo_contents, parse_repo_url
4
 
5
 
6
  GITHUB_API_BASE = "https://api.github.com/repos"
 
1
  import logging
2
  import httpx
3
+ from pmcp.mcp_server.github.utils.repo_to_text_utils import fetch_file_contents, fetch_repo_sha, fetch_repo_tree, format_repo_contents, parse_repo_url
4
 
5
 
6
  GITHUB_API_BASE = "https://api.github.com/repos"
pmcp/mcp_server/{utils → github/utils}/repo_to_text_utils.py RENAMED
File without changes
pmcp/{trello_server → mcp_server/trello}/__init__.py RENAMED
File without changes
pmcp/{trello_server → mcp_server/trello}/dtos/update_card.py RENAMED
File without changes
pmcp/{mcp_trello_main.py → mcp_server/trello/mcp_trello_main.py} RENAMED
@@ -1,13 +1,9 @@
1
  import logging
2
- import os
3
 
4
- import uvicorn
5
  from dotenv import load_dotenv
6
  from mcp.server.fastmcp import FastMCP
7
- from starlette.applications import Starlette
8
- from starlette.routing import Mount
9
 
10
- from server.tools.tools import register_tools
11
 
12
  # Configure logging
13
  logging.basicConfig(
 
1
  import logging
 
2
 
 
3
  from dotenv import load_dotenv
4
  from mcp.server.fastmcp import FastMCP
 
 
5
 
6
+ from pmcp.mcp_server.trello.tools.tools import register_tools
7
 
8
  # Configure logging
9
  logging.basicConfig(
pmcp/{trello_server → mcp_server/trello}/models.py RENAMED
File without changes
pmcp/{trello_server → mcp_server/trello}/services/__init__.py RENAMED
File without changes
pmcp/{trello_server → mcp_server/trello}/services/board.py RENAMED
@@ -4,8 +4,8 @@ Service for managing Trello boards in MCP server.
4
 
5
  from typing import List
6
 
7
- from pmcp.trello_server.models import TrelloBoard, TrelloLabel
8
- from pmcp.trello_server.utils.trello_api import TrelloClient
9
 
10
 
11
  class BoardService:
 
4
 
5
  from typing import List
6
 
7
+ from pmcp.mcp_server.trello.models import TrelloBoard, TrelloLabel
8
+ from pmcp.mcp_server.trello.utils.trello_api import TrelloClient
9
 
10
 
11
  class BoardService:
pmcp/{trello_server → mcp_server/trello}/services/card.py RENAMED
@@ -4,8 +4,8 @@ Service for managing Trello cards in MCP server.
4
 
5
  from typing import Any, Dict, List
6
 
7
- from pmcp.trello_server.models import TrelloCard
8
- from pmcp.trello_server.utils.trello_api import TrelloClient
9
 
10
 
11
  class CardService:
 
4
 
5
  from typing import Any, Dict, List
6
 
7
+ from pmcp.mcp_server.trello.models import TrelloCard
8
+ from pmcp.mcp_server.trello.utils.trello_api import TrelloClient
9
 
10
 
11
  class CardService:
pmcp/{trello_server → mcp_server/trello}/services/checklist.py RENAMED
@@ -1,7 +1,7 @@
1
  import logging
2
  from typing import Dict, List, Optional
3
 
4
- from pmcp.trello_server.utils.trello_api import TrelloClient
5
 
6
 
7
  class ChecklistService:
 
1
  import logging
2
  from typing import Dict, List, Optional
3
 
4
+ from pmcp.mcp_server.trello.utils.trello_api import TrelloClient
5
 
6
 
7
  class ChecklistService:
pmcp/{trello_server → mcp_server/trello}/services/list.py RENAMED
@@ -1,7 +1,7 @@
1
  from typing import List
2
 
3
- from pmcp.trello_server.models import TrelloList
4
- from pmcp.trello_server.utils.trello_api import TrelloClient
5
 
6
 
7
  class ListService:
 
1
  from typing import List
2
 
3
+ from pmcp.mcp_server.trello.models import TrelloList
4
+ from pmcp.mcp_server.trello.utils.trello_api import TrelloClient
5
 
6
 
7
  class ListService:
pmcp/{trello_server → mcp_server/trello}/tools/__init__.py RENAMED
File without changes
pmcp/{trello_server → mcp_server/trello}/tools/board.py RENAMED
@@ -7,9 +7,9 @@ from typing import List
7
 
8
  from mcp.server.fastmcp import Context
9
 
10
- from pmcp.trello_server.models import TrelloBoard, TrelloLabel
11
- from pmcp.trello_server.services.board import BoardService
12
- from pmcp.trello_server.trello import client
13
 
14
 
15
 
 
7
 
8
  from mcp.server.fastmcp import Context
9
 
10
+ from pmcp.mcp_server.trello.models import TrelloBoard, TrelloLabel
11
+ from pmcp.mcp_server.trello.services.board import BoardService
12
+ from pmcp.mcp_server.trello.trello import client
13
 
14
 
15
 
pmcp/{trello_server → mcp_server/trello}/tools/card.py RENAMED
@@ -7,10 +7,10 @@ from typing import List
7
 
8
  from mcp.server.fastmcp import Context
9
 
10
- from pmcp.trello_server.models import TrelloCard
11
- from pmcp.trello_server.services.card import CardService
12
- from pmcp.trello_server.trello import client
13
- from pmcp.trello_server.dtos.update_card import UpdateCardPayload
14
 
15
 
16
  service = CardService(client)
 
7
 
8
  from mcp.server.fastmcp import Context
9
 
10
+ from pmcp.mcp_server.trello.models import TrelloCard
11
+ from pmcp.mcp_server.trello.services.card import CardService
12
+ from pmcp.mcp_server.trello.trello import client
13
+ from pmcp.mcp_server.trello.dtos.update_card import UpdateCardPayload
14
 
15
 
16
  service = CardService(client)
pmcp/{trello_server → mcp_server/trello}/tools/checklist.py RENAMED
@@ -5,8 +5,8 @@ This module contains tools for managing Trello checklists.
5
  import logging
6
  from typing import Dict, List, Optional
7
 
8
- from pmcp.trello_server.services.checklist import ChecklistService
9
- from pmcp.trello_server.trello import client
10
 
11
  service = ChecklistService(client)
12
 
 
5
  import logging
6
  from typing import Dict, List, Optional
7
 
8
+ from pmcp.mcp_server.trello.services.checklist import ChecklistService
9
+ from pmcp.mcp_server.trello.trello import client
10
 
11
  service = ChecklistService(client)
12
 
pmcp/{trello_server → mcp_server/trello}/tools/list.py RENAMED
@@ -7,9 +7,9 @@ from typing import List
7
 
8
  from mcp.server.fastmcp import Context
9
 
10
- from pmcp.trello_server.models import TrelloList
11
- from pmcp.trello_server.services.list import ListService
12
- from pmcp.trello_server.trello import client
13
 
14
 
15
 
 
7
 
8
  from mcp.server.fastmcp import Context
9
 
10
+ from pmcp.mcp_server.trello.models import TrelloList
11
+ from pmcp.mcp_server.trello.services.list import ListService
12
+ from pmcp.mcp_server.trello.trello import client
13
 
14
 
15
 
pmcp/{trello_server → mcp_server/trello}/tools/tools.py RENAMED
@@ -2,7 +2,7 @@
2
  This module contains tools for managing Trello boards, lists, and cards.
3
  """
4
 
5
- from pmcp.trello_server.tools import board, card, checklist, list
6
 
7
 
8
  def register_tools(mcp):
 
2
  This module contains tools for managing Trello boards, lists, and cards.
3
  """
4
 
5
+ from pmcp.mcp_server.trello.tools import board, card, checklist, list
6
 
7
 
8
  def register_tools(mcp):
pmcp/{trello_server → mcp_server/trello}/trello.py RENAMED
@@ -3,7 +3,7 @@ import os
3
 
4
  from dotenv import load_dotenv
5
 
6
- from pmcp.trello_server.utils.trello_api import TrelloClient
7
 
8
 
9
  # Load environment variables
 
3
 
4
  from dotenv import load_dotenv
5
 
6
+ from pmcp.mcp_server.trello.utils.trello_api import TrelloClient
7
 
8
 
9
  # Load environment variables
pmcp/{trello_server → mcp_server/trello}/utils/__init__.py RENAMED
File without changes
pmcp/{trello_server → mcp_server/trello}/utils/trello_api.py RENAMED
File without changes