Commit graph

54 commits

Author SHA1 Message Date
Stephen Toub
08b0a04dab
Overhaul McpClientFactory/McpServerFactory (#87)
Handlers are now specified before connecting the client/server. Otherwise, race conditions exist. Handlers move into being a part of the McpClientOptions/McpServerOptions, so that they're provided to the factories. Where relevant, the handlers are specified as part of the capability descriptors, so that they go hand in hand.

The factories are no longer stateful. Instead of allocating a factory and then calling a create method on it, you just call a static factory method.
2025-03-16 12:08:52 -04:00
Peder Holdgaard Pedersen
63b24a4036
Upgrade Anthropic.SDK to 4.7.1 (#86)
Tweak AnthropicTools sample prompt
2025-03-15 23:07:45 -04:00
Peder Holdgaard Pedersen
7bf450e443
Fix docker based integration tests to be more robust (#74)
* Fix docker based integration tests to be more robust
* Make docker based integration tests manual
2025-03-15 20:56:46 +01:00
Stephen Toub
729c8b5eb9
Make logging optional in all public APIs (#72) 2025-03-13 18:16:21 -04:00
Stephen Toub
2c852f0757
Update README to work with latest code (#70) 2025-03-13 12:50:37 -04:00
Stephen Toub
9e92bc9ce0
Remove InputOutputStreams and clean up StdioServerTransport ctors (#71)
- There doesn't appear to be a meaningful scenario for injecting different readers/writers than stdin/stdout, and having InputOutputStreams complicates the API.
- Logically folks talk about "input and output", "readers and writers", etc., and "stdio" is "standard input and output", so having input specified first is less likely to be a source of bugs.
- Logger should be optional, not required, to simplify the common and getting-started cases.
2025-03-13 12:45:30 -04:00
Peder Holdgaard Pedersen
9c500b4be7
Ensure CamelCase of enum serialization (#67) 2025-03-13 15:28:38 +01:00
Stephen Toub
67320b22d5
Move functionality out of IMcpClient/Server into extensions (#60) 2025-03-13 07:55:06 -04:00
Clay Upton
cdcf134e7a
Update StdioClientTransport.cs (#68) 2025-03-13 06:26:53 +01:00
Peder Holdgaard Pedersen
d83640d552
Bump version to 1.1.0 (#65) 2025-03-12 21:20:06 +01:00
Toni Wenzel
b5076263d1
Add more tests (#51)
* Add more tests

* Fix some code smells

* Remove more code smells

* Combine "ServerIntegrationTests" and "ClientIntegrationTests" because both are client integration tests just using different servers

* Clean up resources after test

* Improve kill logic for spawned child processes

* Improved testability for Stdio

* Fix SseIntegration tests
2025-03-12 18:55:52 +01:00
Stephen Toub
fe632617dc
Update to M.E.AI 9.3.0-preview.1.25161.3 (#61) 2025-03-12 15:23:13 +01:00
Toni Wenzel
24c706b4ff
Improve code coverage (#40)
* Add tests for tool generation

* Add couple of MCPServer tests

* Fix merge issues

* More tests for McpServer

* Some more tests

* Fix merge issues
2025-03-10 18:19:49 +01:00
Toni Wenzel
709b2e0a74
Fix some code smells (#39)
* Fix some code smells

* Fix build

* Fix come issues

* Revert some changes
2025-03-10 18:03:47 +01:00
Stephen Toub
04af21046b
Remove fast-path cancellation check from CallTool (#48) 2025-03-09 11:18:21 +01:00
Stephen Toub
33d2b0d762
Use DescriptionAttribute and HasDefaultValue in server builder extensions (#46) 2025-03-09 11:16:00 +01:00
Stephen Toub
e187ebacc4
Remove nop use of Console.OpenStandardInput (#49) 2025-03-09 11:03:13 +01:00
Peder Holdgaard Pedersen
967d7a4cc8
Fixed two reliability issues highlighted by SonarCloud (#44) 2025-03-08 20:21:14 +01:00
Eirik Tsarpalis
a2e8ecc23d
Attempt to re-enable net472 tests (#38) 2025-03-08 19:02:21 +01:00
Stephen Toub
587e05f057
Enable .NET SDK code analyzers (#41) 2025-03-08 17:18:09 +01:00
Stephen Toub
9c597aad90
Add netstandard2.0 support (#33)
* Add netstandard2.0 support
2025-03-07 20:46:40 +01:00
Stephen Toub
9f0beec63a
Avoid new JsonSerializerOptions instances (#34)
We try hard to avoid creating unnecessary JsonSerializerOptions, as each can have a non-trivial overhead due to how reflection is used by JsonSerializer and the JSO instance serving as a cache.  Rather than creating a new JSO for each transport / endpoint, this can just use a singleton. The only thing it loses is logging when the converter fails, but all of those paths are also throwing an exception, which can be logged higher in the call stack.
2025-03-07 19:50:27 +01:00
Stephen Toub
e5c26d6285
Fix McpAIFunction to override Name/Description (#35) 2025-03-07 19:48:42 +01:00
Stephen Toub
f15b94c244
Use System.Net.ServerSentEvents for parsing SSE response (#32) 2025-03-07 18:41:01 +01:00
Peder Holdgaard Pedersen
c9bc402fb3
Workflow tweak (#36)
Removed redundant fetch, as the checkout@v4 action already fetches the complete repo history.
2025-03-07 18:38:40 +01:00
Toni Wenzel
ec9bdfcf5d
Improve tool handling (#28)
* Improve tool handling

* Rework stuff with new hosting options

* Update readme

* Fix build

* Try run client tests

* Fix build

* Fix issues on linux

* Try to run testserver on linux

* Fix test issue

* Fix code smells
2025-03-07 16:48:55 +01:00
Toni Wenzel
7d69499ad5
Remove warnings from build (#29)
* Remove warnings from build

* More fixes.

* Using const for transport types
2025-03-06 21:02:13 +01:00
Toni Wenzel
80daa5b73d
Add ci build workflow (#31)
* Add ci build workflow

* Using cake build

* Update readme
2025-03-06 20:49:59 +01:00
Toni Wenzel
257a97a659
Improve how to host McpServer (#30) 2025-03-05 21:15:22 +01:00
Peder Holdgaard Pedersen
30f3f192ca
SSE ClientTransport fixes and tests (#27)
SSE fixes
Additional SSE integration tests with everything server
2025-02-27 21:14:20 +01:00
Peder Holdgaard Pedersen
89c4913ed7
Microsoft.Extensions.AI.Abstractions integration (#25)
* MEAI integration
* README and xmldocs
2025-02-23 13:23:56 +01:00
Peder Holdgaard Pedersen
502a09d9fc
Linux-related stdio fixes and update version (#22)
- Modified `GetCommand` to return OS-specific commands and changed return type to `string?`.
- Improved `InitializeCommand` for better command initialization and logging.
- Cleaned up using directives in `Log.cs` and `SseClientTransport.cs`.
- Updated `CreateNoWindow` property in `StdioClientTransport` to be OS-dependent.
- Bumped version number in `mcpdotnet.csproj` to 1.0.1.1.
2025-02-19 19:52:56 +01:00
Peder Holdgaard Pedersen
535d342367
Update README.MD (#21) 2025-02-08 17:15:04 +01:00
Peder Holdgaard Pedersen
c99076094f
Update README.MD (#20) 2025-02-08 17:14:29 +01:00
Peder Holdgaard Pedersen
8fe797e1f3
Server support (stdio) (#19)
* Server support (stdio)
* TestServer project
* Refactored McpClient class to extract shared endpoint logic (with McpServer) to a base class, McpJsonRpcEndpoint.
* Improved xmldoc comments for protocol types, mirroring specification schema comments.
* Update README.MD
2025-02-08 16:21:26 +01:00
Peder Holdgaard Pedersen
c384c7d3de
Fix CallToolAsync for tools with no arguments (#18) 2025-02-07 09:26:42 +01:00
Peder Holdgaard Pedersen
86f1edfe38
Server instructions added to IMcpClient (#17) 2025-01-24 20:36:05 +01:00
Peder Holdgaard Pedersen
107c7acc8f
Completion support (#15) 2025-01-19 12:59:21 +01:00
Peder Holdgaard Pedersen
3e35efe79c
Reorganize folders, samples, minor bug fix (#14)
Reorganize folders
Samples
Casing fixes
2025-01-18 12:34:13 +01:00
Peder Holdgaard Pedersen
e51c78e5e4
SSE Transport Support (#13)
* First iteration

* Tests

* SSE support
2025-01-12 16:35:39 +01:00
Peder Holdgaard Pedersen
e5abb4bb8e
Roots capability support (#12)
Notification sending support
2025-01-09 21:10:29 +01:00
Peder Holdgaard Pedersen
4b8df6638e
Logging (#11)
* Logging
Fixed bug in stdio transport argument promotion

* Logging
Fixed bug in stdio transport argument promotion

* Version bump
2025-01-09 19:39:11 +01:00
Bradley Grainger
67bcba5af4
Fix example in Getting Started docs. (#10)
The variable name was misspelt. Additionally, use collection expression syntax to simplify the example.
2025-01-07 19:43:28 +01:00
Peder Holdgaard Pedersen
80c31fb91b
Badge (#9) 2025-01-06 16:45:09 +01:00
Peder Holdgaard Pedersen
f862dc338f
Update README (#8) 2025-01-05 20:13:47 +01:00
Peder Holdgaard Pedersen
8c6dfd53c8
Sampling capability (#7) 2025-01-05 20:05:32 +01:00
Peder Holdgaard Pedersen
211cd2175b
Clean up types (#6) 2025-01-05 13:19:24 +01:00
Peder Holdgaard Pedersen
c9ace236a0
Resource capability (#5)
Prompt capability
Pagination support
2025-01-04 19:39:22 +01:00
Peder Holdgaard Pedersen
85cefc23ff
Code example (#4) 2025-01-04 13:32:13 +01:00
Peder Holdgaard Pedersen
7ccdeb20eb
Package properties (#3)
Dependency upgrades
Comment cleanup
2025-01-03 13:34:16 +01:00