-
Notifications
You must be signed in to change notification settings - Fork 6
Fix event loop warning filter and example configs #104
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5aa1bfd
Test fastmcp fix-stdio-cleanup-warning branch
jlowin 587c20b
Test fastmcp main branch instead
jlowin 3dd7ce0
Fix event loop warning with keep_alive=False for stdio MCP servers
jlowin 91500cc
Fix examples
jlowin 768d932
Temporarily disable S3 tests to isolate event loop warning
jlowin 1fd84d2
Restore S3 tests and warning filter
jlowin bd641a2
Fix examples
jlowin 6cb2e2b
Fix filterwarnings syntax
jlowin f25fb7d
Remove ineffective gc.collect()
jlowin 3c8a0fa
Fix filterwarnings to match actual warning message
jlowin 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
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
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
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
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,9 @@ | ||
| # MCP Demo | ||
|
|
||
| ## Resource Example | ||
|
|
||
| Hello, World! Welcome to the demo. | ||
|
|
||
| ## Prompt Example | ||
|
|
||
| Summarize the following in a detailed style. |
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,55 @@ | ||
| { | ||
| "version": "1", | ||
| "project_name": "mcp", | ||
| "config_hash": "f6a9b770bee3be5d", | ||
| "compiled_at": "2026-01-07T21:57:28.998543Z", | ||
| "documents": { | ||
| "project://greeting.md": { | ||
| "uri": "project://greeting.md", | ||
| "source_path": null, | ||
| "source_hash": "44d23c70d58c7e85", | ||
| "output_hash": "326780bff734af74", | ||
| "output_path": "greeting.md", | ||
| "is_published": true, | ||
| "compiled_at": "2026-01-07T21:53:49.341310Z", | ||
| "refs": [ | ||
| { | ||
| "provider": "mcp", | ||
| "connection": "demo", | ||
| "method": "config", | ||
| "args": {} | ||
| }, | ||
| { | ||
| "provider": "mcp", | ||
| "connection": "demo", | ||
| "method": "resource", | ||
| "args": { | ||
| "uri": "demo://greeting/World" | ||
| } | ||
| }, | ||
| { | ||
| "provider": "mcp", | ||
| "connection": "demo", | ||
| "method": "prompt", | ||
| "args": { | ||
| "name": "summarize", | ||
| "arguments": { | ||
| "style": "detailed" | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| "ref_versions": { | ||
| "{\"args\": {}, \"connection\": \"demo\", \"method\": \"config\", \"provider\": \"mcp\"}": "e0569178996485f6", | ||
| "{\"args\": {\"uri\": \"demo://greeting/World\"}, \"connection\": \"demo\", \"method\": \"resource\", \"provider\": \"mcp\"}": "6236c65af4fdeed5", | ||
| "{\"args\": {\"arguments\": {\"style\": \"detailed\"}, \"name\": \"summarize\"}, \"connection\": \"demo\", \"method\": \"prompt\", \"provider\": \"mcp\"}": "e31eb0daa2d308b8" | ||
| }, | ||
| "llm_calls": {}, | ||
| "total_cost_usd": 0.0, | ||
| "artifacts": [], | ||
| "sections": {}, | ||
| "config_hash": "f6a9b770bee3be5d" | ||
| } | ||
| }, | ||
| "cache": {} | ||
| } |
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,18 @@ | ||
| [project] | ||
| name = "mcp" | ||
| model-path = "models" | ||
| output-path = "output" | ||
|
|
||
| [[providers.mcp]] | ||
| name = "demo" | ||
| command = "uvx" | ||
| args = [ | ||
| "--with", | ||
| "fastmcp", | ||
| "fastmcp", | ||
| "run", | ||
| "--no-banner", | ||
| "--log-level", | ||
| "ERROR", | ||
| "examples/mcp/mcp_server.py", | ||
| ] | ||
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,21 @@ | ||
| """Simple MCP server for the mcp example.""" | ||
|
|
||
| from fastmcp import FastMCP | ||
|
|
||
| mcp = FastMCP("demo") | ||
|
|
||
|
|
||
| @mcp.resource(uri="demo://greeting/{name}") | ||
| def greeting(name: str) -> str: | ||
| """Get a personalized greeting.""" | ||
| return f"Hello, {name}! Welcome to the demo." | ||
|
|
||
|
|
||
| @mcp.prompt() | ||
| def summarize(style: str = "brief") -> str: | ||
| """Summarization guidance.""" | ||
| return f"Summarize the following in a {style} style." | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| mcp.run() |
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,13 @@ | ||
| --- | ||
| name: MCP Greeting | ||
| description: Demonstrates MCP resource and prompt usage | ||
| --- | ||
| # MCP Demo | ||
|
|
||
| ## Resource Example | ||
|
|
||
| {{ colin.mcp.demo.resource('demo://greeting/World') }} | ||
|
|
||
| ## Prompt Example | ||
|
|
||
| {{ colin.mcp.demo.prompt('summarize', style='detailed') }} |
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,9 @@ | ||
| # MCP Demo | ||
|
|
||
| ## Resource Example | ||
|
|
||
| Hello, World! Welcome to the demo. | ||
|
|
||
| ## Prompt Example | ||
|
|
||
| Summarize the following in a detailed style. |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
The MCP command arg points to
examples/mcp/mcp_server.py, but this config’s project root isexamples/mcpandcolin runuses the current directory as the project by default, so running the example from its own directory resolves the path toexamples/mcp/examples/mcp/mcp_server.pyanduvxcannot find the script. This only works when invoked from the repo root with an explicit project path; use a project-relative path likemcp_server.py(or set a cwd) so the example works when run fromexamples/mcp.Useful? React with 👍 / 👎.