-
Notifications
You must be signed in to change notification settings - Fork 2
Switches to FastMCP and adds resource support #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
saramaebee
wants to merge
20
commits into
devrev:main
Choose a base branch
from
saramaebee:3-separate-devrev-resources-into-distinct-resource-types
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
8db3bc1
adds debug handling
saramaebee e89f337
separates tools out into their own file
saramaebee d99f8c5
adds resources
saramaebee d840f8b
switching over to fastmcp
saramaebee 651813a
Merge branch 'main' into sara-mcp-resources
saramaebee 45462c6
Merge pull request #4 from saramaebee/sara-mcp-resources
saramaebee 92f0025
has it working
saramaebee 724ff22
removing unnecessary debug info
saramaebee 6c3e413
removes unnecessary watchdog
saramaebee 12a8df0
cleaning things up
saramaebee e7c98f1
adds download_artifact tool
saramaebee e878e2c
adds visibility understanding
saramaebee 12904a4
cleanup for PR
saramaebee ec6ea52
error handling + pr cleanup
saramaebee ef140c1
more PR cleanup
saramaebee 0584f87
slight cache improvement / docs improvement
saramaebee b2535da
gets issues and comments working
saramaebee e652b9e
cleaning up
saramaebee c8c0af4
more cleanup :)
saramaebee 9319296
Merge pull request #6 from saramaebee/sara-adds-issues
saramaebee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This project uses `uv` for package management | ||
- Reference https://gofastmcp.com/llms.txt | ||
- Reference https://developer.devrev.ai/llms.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,18 @@ version = "0.1.2" | |
description = "A MCP server project" | ||
readme = "README.md" | ||
requires-python = ">=3.11" | ||
dependencies = [ "mcp>=1.0.0", "requests"] | ||
dependencies = [ | ||
"fastmcp>=2.0.0", | ||
"requests" | ||
] | ||
|
||
[[project.authors]] | ||
name = "Sunil Pandey" | ||
email = "[email protected]" | ||
|
||
[build-system] | ||
requires = [ "hatchling",] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[project.scripts] | ||
devrev-mcp = "devrev_mcp:main" | ||
devrev-mcp = "devrev_mcp:main_cli" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
""" | ||
Simple size-limited cache for DevRev MCP server. | ||
|
||
Prevents unbounded memory growth by limiting cache size and using simple LRU eviction. | ||
""" | ||
|
||
from collections import OrderedDict | ||
from typing import Any, Dict, Optional, Union | ||
import json | ||
|
||
# Cache configuration constants | ||
DEFAULT_CACHE_SIZE = 500 | ||
|
||
|
||
class SimpleCache: | ||
"""Simple LRU cache with size limit to prevent memory leaks.""" | ||
|
||
def __init__(self, max_size: int = DEFAULT_CACHE_SIZE): | ||
"""Initialize cache with maximum size limit.""" | ||
self.max_size = max_size | ||
self._cache: OrderedDict[str, str] = OrderedDict() | ||
|
||
def get(self, key: str) -> Optional[str]: | ||
"""Get value from cache, moving it to end (most recently used).""" | ||
if key in self._cache: | ||
# Move to end (most recently used) | ||
value = self._cache.pop(key) | ||
self._cache[key] = value | ||
return value | ||
return None | ||
|
||
def set(self, key: str, value: Union[str, Dict[str, Any]]) -> None: | ||
"""Set value in cache, evicting oldest if needed.""" | ||
# Convert dict to JSON string if needed | ||
if isinstance(value, dict): | ||
cache_value = json.dumps(value, indent=2) | ||
else: | ||
cache_value = str(value) | ||
|
||
# Remove if already exists | ||
if key in self._cache: | ||
del self._cache[key] | ||
|
||
# Add to end | ||
self._cache[key] = cache_value | ||
|
||
# Evict oldest if over limit | ||
while len(self._cache) > self.max_size: | ||
self._cache.popitem(last=False) # Remove oldest (first item) | ||
|
||
def delete(self, key: str) -> bool: | ||
"""Remove key from cache.""" | ||
if key in self._cache: | ||
del self._cache[key] | ||
return True | ||
return False | ||
|
||
def size(self) -> int: | ||
"""Get current number of cache entries.""" | ||
return len(self._cache) | ||
|
||
def __contains__(self, key: str) -> bool: | ||
"""Check if key exists in cache.""" | ||
return key in self._cache | ||
|
||
|
||
# Global cache instance - replaces devrev_cache = {} | ||
devrev_cache = SimpleCache(max_size=DEFAULT_CACHE_SIZE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
""" | ||
DevRev API Endpoints Constants | ||
|
||
This module defines all DevRev API endpoint strings used throughout the application. | ||
Centralizing these constants prevents typos and makes API changes easier to manage. | ||
""" | ||
|
||
|
||
class DevRevEndpoints: | ||
"""DevRev API endpoint constants for consistent usage across the application.""" | ||
|
||
# Works (Tickets, Issues, etc.) | ||
WORKS_GET = "works.get" | ||
WORKS_CREATE = "works.create" | ||
WORKS_UPDATE = "works.update" | ||
|
||
# Timeline Entries | ||
TIMELINE_ENTRIES_LIST = "timeline-entries.list" | ||
TIMELINE_ENTRIES_GET = "timeline-entries.get" | ||
TIMELINE_ENTRIES_CREATE = "timeline-entries.create" | ||
|
||
# Artifacts | ||
ARTIFACTS_GET = "artifacts.get" | ||
ARTIFACTS_LOCATE = "artifacts.locate" | ||
|
||
# Search | ||
SEARCH_HYBRID = "search.hybrid" | ||
|
||
# Links | ||
LINKS_LIST = "links.list" | ||
LINK_TYPES_LIST = "link-types.custom.list" | ||
|
||
|
||
# Convenience exports for simpler imports | ||
WORKS_GET = DevRevEndpoints.WORKS_GET | ||
WORKS_CREATE = DevRevEndpoints.WORKS_CREATE | ||
WORKS_UPDATE = DevRevEndpoints.WORKS_UPDATE | ||
TIMELINE_ENTRIES_LIST = DevRevEndpoints.TIMELINE_ENTRIES_LIST | ||
TIMELINE_ENTRIES_GET = DevRevEndpoints.TIMELINE_ENTRIES_GET | ||
TIMELINE_ENTRIES_CREATE = DevRevEndpoints.TIMELINE_ENTRIES_CREATE | ||
ARTIFACTS_GET = DevRevEndpoints.ARTIFACTS_GET | ||
ARTIFACTS_LOCATE = DevRevEndpoints.ARTIFACTS_LOCATE | ||
SEARCH_HYBRID = DevRevEndpoints.SEARCH_HYBRID | ||
LINKS_LIST = DevRevEndpoints.LINKS_LIST | ||
LINK_TYPES_LIST = DevRevEndpoints.LINK_TYPES_LIST |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why named it claude.md ?