Commit graph

79 commits

Author SHA1 Message Date
Eirik Tsarpalis
50cc48830e
Add strong naming (#49) 2025-03-21 17:51:05 +00:00
Eirik Tsarpalis
0be5963f8c
Remove InternalsVisibleTo from main project. (#46) 2025-03-21 17:35:19 +00:00
Eirik Tsarpalis
c8c974ada3
Add a markdown link checker (#17)
* Add a markdown link checker

* Fix broken link

* Fix more broken links
2025-03-21 14:29:30 +00:00
Stephen Toub
3e4dd011a1
Simplify client samples (#14)
- Remove duplicate projects
- Replace client sample with a simple chat app
2025-03-20 23:25:10 -04:00
Stephen Toub
33b9582199
Address some static analysis and TODOs (#12) 2025-03-20 23:09:38 -04:00
Stephen Toub
3de19d38e4
Change type of Tool.InputSchema to be JsonElement (#4)
* Change type of Tool.InputSchema to be JsonElement

* Add schema validation in the InputSchema property setter.

* Simplify AIFunction tool adapter.

---------

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
2025-03-20 19:16:41 +02:00
Mike Kistler
d23e065945
Update copyright in LICENSE file and add THIRD-PARTY-NOTICES.txt (#9) 2025-03-20 11:32:16 -04:00
Stephen Toub
27ba8b1b6a
Upgrade to xunit.v3 (#8)
* Upgrade to xunit.v3

* Use Assert.Skip where applicable.

---------

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
2025-03-20 16:19:35 +02:00
Stephen Toub
6b8c288029
Make McpJsonUtilities public and remove IVT to sample (#5)
Also adds in the same encoder used by AIJsonUtilities.
2025-03-20 16:00:23 +02:00
Stephen Toub
555933a06e
Ensure all test client instances are cleaned up (#3) 2025-03-19 17:27:49 -04:00
Stephen Toub
fd358b437d Fix GetAIFunctionsAsync test to be more deterministic 2025-03-19 16:20:45 -04:00
Stephen Toub
37214bdc70 Fix nuget config 2025-03-19 15:12:55 -04:00
Stephen Toub
17fe8a0e93 Fix global.json's SDK version 2025-03-19 14:57:21 -04:00
Stephen Toub
79b34976ad Fix a few issues in the README 2025-03-19 14:35:08 -04:00
Eirik Tsarpalis
a1b2803e55
Merge pull request #2 from modelcontextprotocol/update-infra
Add Directory.Build.props, apply CPM, use NB.GitVersioning, update package publishing
2025-03-19 17:46:00 +02:00
Eirik Tsarpalis
2e1e20645f Add Directory.Build.props, apply CPM, use NB.GitVersioning, update package publishing 2025-03-19 17:27:18 +02:00
Eirik Tsarpalis
32f5e07254 Update README.md 2025-03-19 15:42:48 +02:00
Eirik Tsarpalis
c9ed453745 Rename project and namespaces 2025-03-19 15:02:38 +02:00
Eirik Tsarpalis
e7fa6194f6
Turn on the AOT analyzer. (#92)
* Turn on the AOT analyzer.

* Address feedback

* Add missing types.

* Fix build and react to conflicts.

* Fix failing test.

* Address feedback.
2025-03-18 18:48:28 +02:00
Diego Colombo
c0e1d0dd9a
Change handlers to support cancellation token (#99)
* wire the cancellation

* missed file
2025-03-18 17:36:22 +02:00
Stephen Halter
90dfc35fbd
Add AspNetCoreSseServer sample (#81)
* Add AspNetCoreSseMcpTransport sample

* Fix build errors after rebase

* React to McpServerFactory changes

* Make Utf8JsonWriter non thread static

* Fix test errors caused by not rebasing the HttpLister changes on factory overhaul commit
2025-03-18 12:56:44 +02:00
Peder Holdgaard Pedersen
b5a26e4c33
HttpListener based SSE Server Support (#73) 2025-03-17 14:56:03 -07:00
Stephen Toub
4597bbd7c2
Integrate Microsoft.Extensions.AI as a foundational building block (#94)
* Integrate Microsoft.Extensions.AI as a foundational building block

As with logging abstractions coming from M.E.Logging and DI abstractions coming from M.E.DependencyInjection, M.E.AI provides the relevant AI abstractions.

- Adds AsAIFunction and GetAIFunctionsAsync methods for getting functions for tools via a client.
- Uses AIFunctionFactory to implement McpServerBuilderExtensions.WithTools.
- Adds a RequestSamplingAsync overload that accepts ChatMessages/Options.
- Adds an AsSamplingChatClient method that provides an IChatClient usable on the server to request sampling of the client.
- Adds a CreateSamplingHandler method to enable an IChatClient to be easily used to satisfy sampling requests on the client.
- Deprecate McpDotNet.Extensions.AI.

* Address PR feedback
2025-03-17 16:34:00 -04:00
Stephen Toub
a0afc28ad6
Remove TextReader/Writer parameterization from StdioServerTransport (#96)
It had been added only for tests.
2025-03-17 18:30:37 +01:00
Peder Holdgaard Pedersen
34a6f1c665
Fix resource subscription handling (#89)
* Fix resource subscription handling
Add resource subscription tests

* Fix typo

* Typo

* small fixes

* Fix concurrency issue with test

* Align with specification schemas
2025-03-17 17:54:29 +01:00
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